2139 Commits

Author SHA1 Message Date
James Valleroy
863b3cdfe0
mumble: Implement force upgrade for 1.3.*
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2020-12-13 15:51:38 -08:00
Veiko Aasa
dd6a03442e
diagnostics: Show app name and fallback to app id if not exist
Tests performed:
- The diagnostics app page and individual app diagnostics pages have
app names.
- When the app name is missing (the apache app), app id is shown instead.

Signed-off-by: Veiko Aasa <veiko17@disroot.org>
2020-12-13 15:24:04 -08:00
Veiko Aasa
8775137546
diagnostics: Improve exception handling in app diagnostics
Fixes the problem when the app throws an error when running diagnostics,
the app's diagnostics page shows an html 500 error and on the diagnostics
app page, only an excpetion message is shown without other apps diagnostics.
(I encountered this when the network app diagnostics threw an exception
because of a particular network configuration.)

Tests performed:
- Checked that an app diagnostics page and the diagnostics app shows
all info correctly.
- Modified the networks app diagnostics code so that it throws an exception.
Checked that the app diagnostics page shows an exception message and
the diagnostics module shows all the apps and the networks app section
shows an exception message.

Signed-off-by: Veiko Aasa <veiko17@disroot.org>
[sunil: Re-add removed relevant comment]
[sunil: Remove ability to dismiss the exception message, not much gain for user]
[sunil: Remove unnecessary redundant if condition in template]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2020-12-13 15:21:52 -08:00
Veiko Aasa
b447627ec8
snapshot: Check that / is a btrfs subvolume before setup
Skip setup the snapshots app if the filesystem type is btrfs
but / is not a btrfs subvolume. For example, this may happen in
containers where / is a bind mounted btrfs filesystem.

Closes #1994

Tests performed:
- Install freedombox on a lxc container inside Pioneer-FreedomBox.
(In a container, / is a bind mounted btrfs filesystem). The snapshot app
setup is skipped.
- Install freedombox inside dev container (which uses btrfs filesystem
image). The snapshot app setup succeeds.
- Install freedombox inside container that uses a host directory as a base
and the filesystem is ext4. The snapshot app setup is skipped.

Signed-off-by: Veiko Aasa <veiko17@disroot.org>
[sunil: Add comment explaining the check, fix a flake8 message]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2020-12-13 14:37:21 -08:00
Veiko Aasa
8a7a4a97d1
apache: Add app name
Signed-off-by: Veiko Aasa <veiko17@disroot.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2020-12-13 14:24:53 -08:00
James Valleroy
6531babe06
config: Mark test_homepage_field as needs_root
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
2020-12-13 08:20:32 -05:00
Fioddor Superconcentrado
ec870a1766
config: rename functions (improve readability)
Idem for apache component. See !1952.

Signed-off-by: Fioddor Superconcentrado <fioddor@gmail.com>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2020-12-13 08:20:29 -05:00
Fioddor Superconcentrado
337e8c28dd
config: Add user websites as choices for homepage config.
Closes: #1981
Closes also most of threads in !1952.

Signed-off-by: Fioddor Superconcentrado <fioddor@gmail.com>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2020-12-13 08:20:26 -05:00
Veiko Aasa
fcc4a933d2
Samba: UI: Show toggle buttons and share names
Closes #1989

I checked that all Samba tests pass.

Signed-off-by: Veiko Aasa <veiko17@disroot.org>
[sunil: Minor indentation and styling fixes in template]
[sunil: Prevent multiple HTML attributes with same name in case of vfat]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2020-11-30 13:27:50 -08:00
James Valleroy
c5e0c68bec
sso: Add test to generate ticket
Related to
https://salsa.debian.org/freedombox-team/freedombox/-/merge_requests/1957

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
[sunil: Fix name of the fixture method copied from other code]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2020-11-29 15:07:51 -08:00
James Valleroy
f968ac6023
upgrades: Add progress page for initial update
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2020-11-25 21:18:02 -08:00
James Valleroy
8b02c2bf3a
upgrades: Add first boot step to run initial update
Closes: #1708.

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2020-11-25 21:17:55 -08:00
Joseph Nuthalapati
377010b078
openvpn: Deny access to users not in group "vpn"
A new function called `user_group_view` has been added to
restrict access to only users in the groups "vpn" and "admin".

Some changes are made in AdminRequiredMiddleware to handle this.

Signed-off-by: Joseph Nuthalapati <njoseph@riseup.net>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2020-11-25 13:15:22 -05:00
Joseph Nuthalapati
21326cfe46
openvpn: Add functional tests for user group "vpn"
This is the first functional test which tests the permissions of a
non-administrator user in a group.

Some changes had to be made in the form shown in users module for this
to work. The id of each checkbox in the "Permissions" section is now
predictable based on the name of the group. For example, the id of the
checkbox for the group "vpn" is `id_group_vpn`. Changes are also made in
`CheckboxSelectMultipleReadOnly` form class for consistency, though it
is not being used by this functional test.

Some utility functions for functional tests have been moved out of users
module to be usable by other app modules for testing group permissions.

One additional utility function to skip creating user if it already
exists has been added. Not using this function wouldn't break the test
but using it saves some time.

Changed password format string to use `S` instead of `w` to support
special characters in password.

Signed-off-by: Joseph Nuthalapati <njoseph@riseup.net>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2020-11-25 13:15:19 -05:00
Joseph Nuthalapati
7663b763f9
OpenVPN: Create user group "vpn"
A user in this user group will be able to download and use an .ovpn
profile to connect to the OpenVPN server on the FreedomBox.

Signed-off-by: Joseph Nuthalapati <njoseph@riseup.net>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2020-11-25 13:15:15 -05:00
Fioddor Superconcentrado
5f6add64bd
snapshots: Translate snapshot types (field description)
Helps: #1938

BTW, columns centered.

Signed-off-by: Fioddor Superconcentrado <fioddor@gmail.com>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2020-11-25 11:25:13 -05:00
Fioddor Superconcentrado
a110c70b6f
bepasty: Apply translation to autogenerated comments.
Helps: #1938

Signed-off-by: Fioddor Superconcentrado <fioddor@gmail.com>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2020-11-25 11:25:10 -05:00
Fioddor Superconcentrado
20f0b25ff5
networks: Apply translation to a tooltip.
Helps: #1938
It also corrects the transliteration of another tooltip.

Signed-off-by: Fioddor Superconcentrado <fioddor@gmail.com>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2020-11-25 11:25:07 -05:00
Matthias Dellweg
4b4f8187ef
Enable dynamicdns module to handle IPv6
Signed-off-by: Matthias Dellweg <2500@gmx.de>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2020-11-15 19:17:50 -05:00
Joseph Nuthalapati
030e6ce98d
openvpn: Remove opinion on which curve to use
Signed-off-by: Joseph Nuthalapati <njoseph@riseup.net>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2020-11-14 18:29:49 -05:00
Joseph Nuthalapati
3676fd1a87
openvpn: Improve migrate_to_ecc template
Signed-off-by: Joseph Nuthalapati <njoseph@riseup.net>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2020-11-14 18:29:47 -05:00
Joseph Nuthalapati
721d51bd4a
openvpn: Remove explicit setup step
Setup is now run as a post installation step.

Signed-off-by: Joseph Nuthalapati <njoseph@riseup.net>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2020-11-14 18:29:45 -05:00
Joseph Nuthalapati
2b33a752d0
openvpn: ECC: Setup and Migration
Signed-off-by: Joseph Nuthalapati <njoseph@riseup.net>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2020-11-14 18:29:42 -05:00
Joseph Nuthalapati
eecd4b4d5f
openvpn: Function to detect ECC/RSA configuration
Signed-off-by: Joseph Nuthalapati <njoseph@riseup.net>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2020-11-14 18:29:40 -05:00
Joseph Nuthalapati
de6030b46c
openvpn: Cleanup easyrsa 2 to 3 upgrade code
Debian Buster has easyrsa 3. Since we're nearing Bullseye now, it is
safe to asssume that most users are already using easyrsa 3.

The code to do the upgrade is 2 years old already. Removing it.

Signed-off-by: Joseph Nuthalapati <njoseph@riseup.net>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2020-11-14 18:29:37 -05:00
Joseph Nuthalapati
e5b149baa3
ci: Fix flake8 errors
Signed-off-by: Joseph Nuthalapati <njoseph@riseup.net>
2020-11-07 17:45:26 +05:30
Onurb
b16f99b3e8
apache: setup uwsgi by default
Moved uwsgi and uwsgi-plugin-python3 from radicale and searx to apache.

Fixes: #1501

Signed-off-by: Onurb <onurb8966@gmail.com>
[jvalleroy: Move uwsgi managed service to apache app]
[jvalleroy: Also update bepasty app]
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2020-11-02 18:36:47 -05:00
Joseph Nuthalapati
658e260d23
mediawiki: Add action to set domain name
- Set domain name during app setup

- Improve tests for settings. Prefer to call functions in plinth which invoke
actions than test actions directly.

- Also, '$wgServer' is not a domain name since it also includes the protocol.

- Add domain selection form. Make server url a text input field.

- Added a functional test to set the value of server url to the value provided
by FREEDOMBOX_URL before doing running any other tests.

- Make server url setting a pre-requisite.

Signed-off-by: Joseph Nuthalapati <njoseph@riseup.net>
[sunil: Squash commits as they were fixing themselves]
[sunil: Simplify configuration reading]
[sunil: Use 'server_url' terminology consistently]
[sunil: cosmetic: Minor styling]
[sunil: Update test_settings.py to use fixture pattern]
[sunil: Remove seemingly incorrectly used aria-describedby attribute]
[sunil: Don't rely solely on env variable value in functional tests]
[sunil: Fix issue with http/https mismatch when checking site availability]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2020-10-31 22:04:10 -07:00
Sunil Mohan Adapa
9827b8d33f
upgrades: Disable the option when not able to dist upgrade
Tests:

- When running on unstable, the form is disabled.

- When can_dist_upgrade() returns True, the option is selectable again.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
2020-10-30 20:45:22 -07:00
James Valleroy
49c21cabc8
upgrades: Add a setting to enable dist upgrade
- Setting is stored in kvstore.

- Enable for new installs, and once when upgrading from version
  without flag.

- Split action subcommands for activating backports and for performing
  dist upgrade.

Tests:
- Dist upgrade is enabled by default in stable container.
- Dist upgrade is disabled by default in testing container.
- Enable dist upgrade. Dist upgrade is attempted periodically.
- Disable dist upgrade. Dist upgrade is no longer attempted.

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
[sunil: kvstore need to be locally imported anymore, import as usual]
[sunil: Minor changes to comments for PEP compliance]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2020-10-30 20:41:58 -07:00
Fioddor Superconcentrado
c88acb36d0
networks: css: Make button wider in network list
testing:
- Might this impact somewhere else (same form-button combination)?
- Yapf: not applicable.
- Flake8: without errors or warnings for changed files.
- (Unit) tests: run without errors.

Signed-off-by: Fioddor Superconcentrado <fioddor@gmail.com>
[sunil: Use min width instead of fixed width]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2020-10-20 11:57:21 -07:00
Fioddor Superconcentrado
9cde408c86
notifications: i18n: Mark app names and extra data for translation
Helps: 1938.

Testing:
- Yapf applied.
- Flake8 without errors or warnings for changed files.
- (Unit) tests run without errors.

Signed-off-by: Fioddor Superconcentrado <fioddor@gmail.com>
[sunil: Translate app_name with 'translate:' prefix]
[sunil: Also mark additional data]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2020-10-20 11:57:17 -07:00
Fioddor Superconcentrado
ff9d0ace31
networks: i18n: Mark various strings for translation
Helps: #1938.

- Translate various states passed in by Network Manager:
  - Device state
  - Device state reason
  - Device type
  - Firewall zone
  - IPv4/IPv6 connection method
  - Wireless mode
- forms.py: Move zones list to network.py, reuse in views.py.

Testing:
- Yapf applied.
- Flake8 without errors or warnings for changed files.
- (Unit) tests run without errors.
- Screnshots attached to #1938.

Signed-off-by: Fioddor Superconcentrado <fioddor@gmail.com>
[sunil: Add strings for many more states]
[sunil: Don't allow None to be selected as firewall zone]
[sunil: Drop forced_literals.py as it reduces modularity of the code]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2020-10-20 11:57:12 -07:00
Fioddor Superconcentrado
67edecb8ab
networks: i18n: Mark string for translation on delete page
Helps: #1938.

Signed-off-by: Fioddor Superconcentrado <fioddor@gmail.com>
[sunil: Don't split the string into two, mark it in full]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2020-10-20 11:57:08 -07:00
Sunil Mohan Adapa
b1f64bb7bd
backups: i18n: Mark form success messages for translation
Helps: #1938.

Signed-off-by: Fioddor Superconcentrado <fioddor@gmail.com>
[sunil: Also mark restore success message]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2020-10-20 11:57:03 -07:00
Fioddor Superconcentrado
4ea6e952c9
updates: Eliminate delay and better status for manual upgrade
Helps: #1939.

Implements a proposal by Sunil Mohan Adapa in !1936.

Signed-off-by: Fioddor Superconcentrado <fioddor@gmail.com>
[sunil: Cosmetic changes]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2020-10-19 16:57:37 -07:00
Fioddor Superconcentrado
792c2cd00f
help: Link to updates page when new version is available
Closes: #1332.

Signed-off-by: Fioddor Superconcentrado <fioddor@gmail.com>
[sunil: Simplify the message for link to upgrade page]
[sunil: Use url method instead of hard-coded path]
[sunil: Cosmetic changes]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2020-10-19 16:57:34 -07:00
Sunil Mohan Adapa
9c013be54b
calibre: Update group description to reflect 'using' app
- It is incorrect to say that group membership is needed to administer calibre.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2020-10-18 14:47:26 -04:00
Sunil Mohan Adapa
f9fd278e8c
calibre: Add link to donation page
- This is the link open by the desktop application when donate button is hit.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2020-10-17 19:51:32 -04:00
Fioddor Superconcentrado
633f54b75c
diagnostics: Lazy format all diagnostic test strings properly
Helps: #1938.

Fixed application of available translations in daemon.py and apache,
diagnostics, networks, firewall and users modules.

diagnostics:
- __init__.py: return the app name along its results.
- diagnostics.html: display the app name instead of its id.
- diagnostics_results.html:
  - mark for translation,
  - apply class to results <td> HTML tag.

main.css: center-align the results.

Locale files excluded. Will be regenerated automatically and translations to be
done via Weblate.

original testing (rebased later):
- Yapf applied.
- Flake8 without errors or warnings for changed files.
- (Unit) tests run without errors.

Signed-off-by: Fioddor Superconcentrado <fioddor@gmail.com>
[sunil: Translate 'None' app name]
[sunil: Don't translate tests strings second time in template]
[sunil: Tweak the center rule]
[sunil: Don't split a translation string]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2020-10-13 15:43:44 -07:00
Fioddor Superconcentrado
f1f84a2509
upgrades: Add status section showing version and upgrade status
Closes: #1939.

- Force a delay before returning the upgrade result to allow upgrade to kick in.
Otherwise when the flow returns, get_context_data() creates the context too
early and finds the upgrade not yet busy, causing the refresh loop to miss it.
The page renders static and the user gets no clue to the upgrade executing in
the background.

Signed-off-by: Fioddor Superconcentrado <fioddor@gmail.com>
[sunil: Retain the styling for the remainder of the page]
[sunil: Re-style the status section as a simple web-page]
[sunil: Drop unused running-status CSS styles]
[sunil: Rename CSS variables, minor changes to color values]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
2020-10-13 14:41:50 -07:00
James Valleroy
f88ced9706
app: Add donation links in dropdown menu
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
[sunil: Undo a minor isort refactor in searx]
[sunil: Change the menu label to 'Donate']
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2020-10-11 19:49:22 -07:00
Veiko Aasa
d93f2f634d
diagnostics: Show low system memory notifications
Containers specific case: if total memory taken from cgroups is lower
than system memory taken from psutil, calculate memory usage based on
information from cgroups. The formula idea is taken from
https://github.com/moby/moby/issues/40727#issuecomment-604155288

Closes #1780

Tests performed:
- In a non-container environment, filled the memory 90%
```
stress-ng --vm-bytes $(awk '/MemAvailable/{printf "%d\n", $2 * 0.9;}' \
< /proc/meminfo)k --vm-keep -m 1
```
and ensured that correct notification is shown.
- In a container, if no memory limitations are set, notifications are
based on host memory usage
- In a container, if memory limits are set
```
systemctl set-property systemd-nspawn@fbx-testing.service MemoryMax=200M
```
ensured that the notification is shown and is calculated based on
cgroups.

Signed-off-by: Veiko Aasa <veiko17@disroot.org>
[sunil: Fix i18n for notification message]
[sunil: Drop unnecessary type conversion]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2020-10-09 17:41:04 -07:00
James Valleroy
0308d783e3
upgrades: Detect and upgrade to next stable release
Process can be tested by upgrading to testing:
$ sudo ./actions/upgrades --develop --test-upgrade

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
[sunil: cosmetic: isort fixes]
[sunil: Restore BACKPORTS_REQUESTED_KEY that was accidentally removed]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2020-10-05 15:11:19 -07:00
Sunil Mohan Adapa
9ef9a0fb1c
*: Minor flake8 fixes
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
2020-10-05 00:05:54 -07:00
Sunil Mohan Adapa
e5cd5bd796
users: cosmetic: Yapf refactoring
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
2020-10-05 00:05:51 -07:00
Sunil Mohan Adapa
30c326523e
users: Deal with admin user already existing during first boot
- Trying to create another admin user using the first boot wizard will certainly
fail.

- Show the list of admin users in the system so that they an be deleted and
creation of admin by first boot wizard can continue.

- If existing account can already work (such as when Plinth and LDAP entries
exist) allow skipping the step.

- Since the scenario is mostly like encountered only during advanced usage and
not for most regular users, the technical nature of solutions is okay.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
2020-10-05 00:05:47 -07:00
Veiko Aasa
dfaf009d3c
users: Require admin credentials when creating or editing a user
This change prevents the plinth user to become a superuser without
knowing an admin password.

Users module and action script:
- User credentials are now required for the subcommands: create-user,
  set-user-password, add-user-to-group (if the group is admin),
  remove-user-from-group (if the group is admin), set-user-status,
  remove-user (if the removed user is the last admin user.
  Note: the web UI doesn't allow to delete last admin user).
- subcommand remove-users requires authentication if the user is last
  admin user. Password must be provided through standard input.
- subcommand remove-group: do not allow to remove group 'admin'
- User credentials must be provided using the argument
  --auth-user and a passsword must be provided through standard input.
- If there are no users in the admin group, no admin password is
  required and if the --auth-user argument is required, it can be an
  empty string.

Users web UI:
- An admin needs to enter current password to create and edit a user
  and to change user's password.
- Show more detailed error text on exceptions when submitting forms.
- Show page title on the edit and create user pages.

Users unit and functional tests:
- Added a configuration parameters to the pytest configuration file
  to set current admin user/password.
- Added a configuration parameter 'ssh_port' to the functional tests.
  You can overwrite this with the FREEDOMBOX_SSH_PORT environment
  variable. Modified HACKING.md accordingly.
- Added an unit test:
     - test changing the password as a non-admin user.
     - test invalid admin password input.
     - test that removing the admin group fails.
- Capture stdout and stderr in the unit tests when calling an action
  script to be able to see more info on exceptions.
- Added functional tests for setting ssh keys and changing passwords
  for admin and non-admin users.
- Added a functional test for setting a user as active/inactive.

Changes during review [sunil]:
- Move uncommon functional step definitions to users module from global. This is
  keep the common functional step definitions to minimal level and promote when
  needed.
- Minor styling changes, flake8 fixes.
- Don't require pampy module when running non-admin tests. This allows tests to
  be run from outside the container on the host machine without python3-pam
  installed.
- Call the confirm password field 'Authorization Password'. This avoid confusion
  with a very common field 'Confirm Password' which essentially means retype
  your password to ensure you didn't get it wrong. Add label explaining why the
  field exists.
- Don't hard-code /tmp path in test_actions.py. Use tmp_path_factory fixture
  provided by pytest.
- Remove unused _get_password_hash() from actions/users.
- Undo splitting ldapgid output before parsing. It does not seem correct and
  could introduce problems when field values contain spaces.

Tests performed:
- No failed unit tests (run with and without sudo).
- All 'users' functional tests pass.
- Creating an admin user during the first boot wizard succeeds.
- Creating a user using the web UI with an empty or wrong admin
  password fails and with the correct admin password succeeds.
- Editing a user using the web UI with an empty or wrong admin
  password fails and with the correct admin password succeeds.
- Changing user's password using the web UI with an empty or wrong
  admin password fails and with the correct admin password succeeds.
- Above mentioned user action script commands can't be run without
  correct credentials.
- Adding the daemon user to the freedombox-share group succeeds when
  installing certain apps (deluge, mldonkey, syncthing, transmission).

Signed-off-by: Veiko Aasa <veiko17@disroot.org>
[sunil: Move uncommon functional step definitions to users module from global]
[sunil: Minor styling changes, flake8 fixes]
[sunil: Don't require pampy module when running non-admin tests]
[sunil: Call the confirm password field 'Authorization Password']
[sunil: Don't hard-code /tmp path in test_actions.py]
[sunil: Remove unused _get_password_hash() from actions/users]
[sunil: Undo splitting ldapgid output before parsing]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2020-10-05 00:05:44 -07:00
Sunil Mohan Adapa
98f9d59ef1
quassel: Don't handle certificates if not installed
Tests:

- Without these changes, with Quassel not-installed, change the domain name.
Notice that certificate events for Quassel fails due to missing domain
information.

- With these changes, with Quassel not-installed, change the domain name. Notice
that certificate events for Quassel don't result in any actions.

- With these changes, when Quassel is installed, certificate is properly setup
for a domain.

- With these changes, with Quassel installed, change the domain name. Notice
that certificate events for Quassel succeed.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2020-10-03 10:10:26 -04:00
Sunil Mohan Adapa
00683762c8
coturn: Don't handle certificates if not installed
Tests:

- Without these changes, with Coturn not-installed, change the domain name.
Notice that certificate events for Coturn fails due to missing domain
information.

- With these changes, with Coturn not-installed, change the domain name. Notice
that certificate events for Coturn don't result in any actions.

- With these changes, when Coturn is installed, certificate is properly setup
for a domain.

- With these changes, with Coturn installed, change the domain name. Notice that
certificate events for Coturn succeed.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2020-10-03 10:10:23 -04:00