5522 Commits

Author SHA1 Message Date
Sunil Mohan Adapa
8cb5716f76
tor: Fix problems with running a relay
This is a fix for regression introduced by
ebe6a0ed026e27dc650b4c2fed8426357f959ddc. I have incorrectly assumed that
providing only IPv6 ORPort is sufficient to listen on IPv4 and IPv6. As a
result, Tor does not run when relay is enabled. Fix this by adding ORPorts for
both IPv6 and IPv4.

Tests performed:

- Tor shows as running after enabling relay functionality.

- Adding single or multiple ORPort values in the configuration file leads to
actions/tor get-status reporting that relay is enabled.

- Functional tests for Tor run properly.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2020-05-24 08:59:55 -04:00
Joseph Nuthalapati
a4dab3cc36
tests: functional: Add pytest-xdist to install.sh
pytest-xdist is a dependency for parallel execution of functional tests.
2020-05-22 23:16:33 +05:30
Sunil Mohan Adapa
63ab11143a
test: functional: Fix for Apache restart after domain change
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Joseph Nuthalapati <njoseph@riseup.net>
2020-05-22 22:58:38 +05:30
Sunil Mohan Adapa
863789e47e
snapshot: Fix functional test to account for non-removable snapshots
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Joseph Nuthalapati <njoseph@riseup.net>
2020-05-22 22:57:15 +05:30
Sunil Mohan Adapa
aa414eb68b
ttrss: Fix functional tests
Looks like the old 'Actions...' menu has been changed into a burger menu. Keep
compatibility with earlier version too.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Joseph Nuthalapati <njoseph@riseup.net>
2020-05-22 22:56:39 +05:30
Sunil Mohan Adapa
84a7d7c928
coturn: Fix functional test for backup/restore
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Joseph Nuthalapati <njoseph@riseup.net>
2020-05-22 22:56:25 +05:30
Sunil Mohan Adapa
80dff7bf9c
tests: functional: Re-organize step definitions and helper methods
- Move non-reusable app specific step definitions and helper methods into
<app>/tests/test_functional.py.

- Merge reusable helper methods into plinth.tests.functional

- Merge reusable step definitions into plinth.tests.functional.step_definitions

- avahi, datetime, ikiwiki: Reuse common methods to avoid repetition. Avoid
mapping from app nicknames to actual app names.

- deluge, transmission: Make a copy of sample.torrent for each app to avoid
clogging common place.

- Implement functional.visit() to simplify a lot of browser.visit() calls.

- Ensure that name of the mark on functional tests for an app is same as name of
the app. This will help with predicting the mark when running tests for a
particular app.

Tests performed:

- Run all functional tests.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Joseph Nuthalapati <njoseph@riseup.net>
2020-05-22 22:52:40 +05:30
Sunil Mohan Adapa
8fac6a71fe
tests: functional: cosmetic: flake8 fixes
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Joseph Nuthalapati <njoseph@riseup.net>
2020-05-22 21:27:29 +05:30
Joseph Nuthalapati
575f07b8e5
tests: functional: Document running tests in parallel
Signed-off-by: Joseph Nuthalapati <njoseph@riseup.net>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2020-05-22 21:27:17 +05:30
Sunil Mohan Adapa
bff294ed39
storage: Fix failing path validation unit tests
Due to improper python include path. Don't know why the problem surfaced.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Joseph Nuthalapati <njoseph@riseup.net>
2020-05-22 21:26:41 +05:30
Sunil Mohan Adapa
80d67c2054
tests: functional: Merge into main source hierarchy
- Add pytest hooks to ignore all functional tests if pytest_bdd is not
installed.

- Update pytest hooks to skip tests in file named 'test_functional.py' if
--include-functional argument is not provided.

- Move functional_tests/install.py into plinth/tests/functional and update
reference in Vagrantfile.

- Move scenario files into individual app folders. Rename them after the app
they are testing. Merge TODO items listed in todo.org into corresponding feature
files.

- Add test_functional.py in each app to build tests from the features file using
pytest_bdd.

- Move all step_definitions, support and data into plinth/tests/functional/.
Include all step_definitions from conftest.py. Update to relative imports
instead of absolute imports.

Tests performed:

- Run py.test-3 --collect-only shows all functional tests and lists 574 tests.
No errors show that name of feature files are correct. The number says that all
functional test features are included.

- Remove pytest_bdd (or modify the import name) and run py.test-3 --collect-only
skips collecting all functional tests and shows only 300+ tests.

- Run functional tests for a few apps with py.test-3 --include-functional -m
app. For storage, deluge.

- Run unit tests with py.test-3. Functional tests are listed by skipped.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Joseph Nuthalapati <njoseph@riseup.net>
2020-05-22 21:26:05 +05:30
Artem
1bf3a27174
Translated using Weblate (Russian)
Currently translated at 74.4% (945 of 1270 strings)
2020-05-21 15:41:35 +02:00
Etienne
c89fdcdc9d
Translated using Weblate (French)
Currently translated at 100.0% (1270 of 1270 strings)
2020-05-21 15:41:35 +02:00
Luis A. Arizmendi
953de1cd20
Translated using Weblate (Spanish)
Currently translated at 100.0% (1270 of 1270 strings)
2020-05-21 15:41:34 +02:00
Sunil Mohan Adapa
058702f2b8
openvpn: Use app toggle button and common app view
Tests performed:

- When app is not setup, app toggle button is not shown. Running status of the
app is also not present in the page. Profile download is not shown. Setup button
is shown.

- When app is being setup, app toggle button is not shown. Running status of the
app is also not present in the page. Page keeps refreshing every 3 seconds
during setup. Profile download is not shown. A progress spinner is shown that
setup is currently running.

- When app setup has completed, app toggle button is shown. Running status is
shown. When daemon is stopped, a message that daemon is not running is show.
Profile download is shown.

- Transition from being setup into setup completed is done with a single page
refresh. Message that setup is completed is shown.

- Port forwarding information is always shown (before, during and after setup).

- Run functional tests for OpenVPN.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Joseph Nuthalapati <njoseph@riseup.net>
2020-05-20 19:40:50 +05:30
Joseph Nuthalapati
cce51cd9d0
functional-tests: Leave tor+http test disabled
Downloading software packages over tor+http is a significant performance
cost to subsequent tests.

Signed-off-by: Joseph Nuthalapati <njoseph@riseup.net>
[sunil: Drop unnecessary changes to step definitions]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2020-05-18 21:39:09 -07:00
Joseph Nuthalapati
b3fd24ce6f
functional-tests: Move @backups to Scenario level
Signed-off-by: Joseph Nuthalapati <njoseph@riseup.net>
[sunil: Fix marks for quassel app]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2020-05-18 21:39:05 -07:00
Joseph Nuthalapati
2bf652f469
functional-tests: Use Name attribute in backups
- The operations create backup, restore, delete and download are done
based on the name of the backup archive.
- Using select-all to uncheck all checkboxes for a minor speedup while
creating backups.
- Using the new name-based tests for backups for 3 apps

Signed-off-by: Joseph Nuthalapati <njoseph@riseup.net>
[sunil: Minor indentation fix]
[sunil: Use older API for searching links in Splinter, no advantage with new]
[sunil: Update patch for coturn and coquelicot]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>

test use name fixes

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
2020-05-18 21:39:02 -07:00
Joseph Nuthalapati
f13ad07ecb
backups: Add optional field - Name
Signed-off-by: Joseph Nuthalapati <njoseph@riseup.net>
[sunil: Perform validation for name field]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2020-05-18 21:38:58 -07:00
James Valleroy
10924a1dca
Release v20.9 to unstable
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
v20.9
2020-05-18 19:43:25 -04:00
James Valleroy
eac1256b4b
doc: Fetch latest manual
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
2020-05-18 19:42:28 -04:00
James Valleroy
3da46d40b9
locale: Update translation strings
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
2020-05-18 18:39:09 -04:00
Artem
d31ee29d0e
Translated using Weblate (Russian)
Currently translated at 74.8% (946 of 1264 strings)
2020-05-19 00:17:52 +02:00
Luis A. Arizmendi
6e32ae9045
Translated using Weblate (Spanish)
Currently translated at 100.0% (1264 of 1264 strings)
2020-05-19 00:17:52 +02:00
Sunil Mohan Adapa
f74ca9044a
performance: Launch the Cockpit graphs directly if possible
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2020-05-18 18:13:21 -04:00
Sunil Mohan Adapa
d93de4fa61
upgrades: Add information about service restart and system reboot
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
2020-05-18 14:28:03 -07:00
Sunil Mohan Adapa
6ee60647c9
upgrades: Always schedule a reboot at 02:00 local time
Test:

- Downgrade kernel (linux-image-amd64) to earlier version.
- Reboot into the older kernel.
- Remove the newer kernel package.
- Run FreedomBox in develop mode.
- Run unattended-upgrades --debug to upgrade all packages.
- At the end a message is printed that shutdown is scheduled.
- Check /run/systemd/shutdown/scheduled file and see that microseconds since
  epoch is set to tomorrow 02:00 local time.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
2020-05-18 14:28:00 -07:00
James Valleroy
7c38dad03d
upgrades: Enable Automatic-Reboot option of unattended-upgrades
Closes #654.

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2020-05-18 14:27:52 -07:00
James Valleroy
0b5c195e17
upgrades: Add needrestart to restart services as needed
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2020-05-18 14:27:28 -07:00
Sunil Mohan Adapa
935db83d8b
tor: Fix stopping server during backup/restore
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2020-05-18 13:47:28 -04:00
Sunil Mohan Adapa
664067aa13
quassel: Fix stopping server during backup/restore
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2020-05-18 13:47:25 -04:00
Sunil Mohan Adapa
e66988840b
mumble: Stop server during backup/restore
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2020-05-18 13:47:22 -04:00
Sunil Mohan Adapa
317b5207f6
minidlna: Stop daemon during backup/restore
Backup and restore the configuration file too.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2020-05-18 13:47:20 -04:00
Sunil Mohan Adapa
74dac0b49d
mediawiki: Stop jobrunner during backup/restore
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2020-05-18 13:47:16 -04:00
Sunil Mohan Adapa
d44283d9ba
minidlna: cosmetic: isort fixes
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2020-05-18 08:49:31 -04:00
James Valleroy
3c85846fa2
minidlna: Move sysctl config to /etc/sysctl.d/50-freedombox.conf
/etc/sysctl.conf is owned by procps package.

Test: Run minidlna install on fresh image.
- /etc/sysctl.conf is not modified.
- /etc/sysctl.d/50-freedombox.conf has the expected content.
- /proc/sys/fs/inotify/max_user_watches contains 100000.

- Running with these changes upgrades app version and triggers a setup. Changes
in /etc/sysctl.conf are removed. After undoing the changes /etc/sysctl.conf is
identical to pristine version installed from procps package. This can be
obtained by running; rm -f /etc/sysctl.conf ; apt install --reinstall procps -o
Dpkg::Options::=--force-confmiss

Closes #1802.

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
[sunil: Undo changes done in /etc/sysctl.conf in older versions]
[sunil: Increment app version to trigger configuration migration]
[sunil: Ensure that app is not re-enabled during migration]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2020-05-18 08:49:24 -04:00
Sunil Mohan Adapa
0b1219a90c
first_setup: Fix regression with logo not showing
Logo is not shown when first setup is running in the background and the first
setup busy page is shown. This is a regression when PNG logos were moved to a
different folder.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2020-05-17 17:36:55 -04:00
Sunil Mohan Adapa
4dfa9436b1
power: cosmetic: Fix flake8 warnings
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2020-05-17 17:36:52 -04:00
Sunil Mohan Adapa
355b2be90e
package: Fix error log when checking if package manager is busy
Reuse the method in package.py that checks is package manager is busy without
printing and error log.

Tests performed:

- Try to install a package and wait at the apt confirmation prompt.

- Go to power index page /sys/power/ . It shows a warning that package manager
is busy. No error log is printed.

- Go to system restart page. It shows a warning that package manager is busy. No
error log is printed.

- Go to system poweroff page. It shows a warning that package manager is busy.
No error log is printed.

- Without package manager being busy, above warnings are not shown.

- Go to manual update package. It shows as updating if apt is busy, otherwise
shows the manual update button.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2020-05-17 17:36:49 -04:00
James Valleroy
dbf70b9fef
quassel: Use systemd sandboxing features
Tests:
- Installed Quassel and diagnostics are passed.
- Quassel client connection is successful.

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
[sunil: Remove RemainAfterExit=no as it is default]
[sunil: Remove ReadWritePaths= as {Logs|State}Directory= take care of it]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2020-05-17 13:41:13 -07:00
Sunil Mohan Adapa
e51d027618
storage: Auto-mount disks, notify of failing disks
- Remove freedombox-udiskie.service file. Don't run udiskie anymore. Use our own
implementation of auto-mounting.

- Schedule disk failure checking to 3 seconds after application initialization.
Also perform auto-mounting at that time.

- Listen to new filesystems added and auto-mount them.

- Listen to disk failing attribute and report to user via a notification.

- Add rules to polkit-1 to allow plinth user to mount drives.

- Add simple abstractions over DBusProxy objects make accessing properties
simpler.

- Replicate udiskie's approach to mounting disks.

- Mount as root user for now using command line instead of DBus API. This is to
keep compatibility with older code that mounted under /media/root with relaxed
permissions.

Udiskie analysis:

  - On device added, media added, perform auto_add
  - On device changed and is addable and old state is not addable or removeable
  - Automount condition:
    - Matches configuration
    - Not ignored
    - is_filesystem and not mounted -> mount
    - crypto device -> try unlock -> if success, mount
    - is partition table
      - Get all non-ignored devices, if partition then mount
  - Mount condition:
    - Is not ignored
    - Is filesystem
    - Find device with path
    - Get options from configuration
    - Is ntfs and executable ntfs-3g is not available
    - Call mount
  - No support for udisks1
  - Built-in rules
    - {'symlinks': '/dev/mapper/docker-*', 'ignore': True}
    - {'symlinks': '/dev/disk/by-id/dm-name-docker-*', 'ignore': True}
    - {'is_loop': True, 'is_ignored': False, 'loop_file': '/*', 'ignore': False}
    - {'is_block': False, 'ignore': True}
    - {'is_external': False, 'is_toplevel': True, 'ignore': True}
    - {'is_ignored': True, 'ignore': True}

Tests performed:
  - Create a CDROM in VM, inject media. Disk should get mounted.
  - Create a temp file. mkfs.ext4 it at top level. losetup it. It should not get
    auto mounted as it is a top level internal device.
  - Create a temp file. Create two partitions and format the partitions. kpartx
    -a on it. Both the file systems should get mounted.
  - Create a temp file. luksformat it. Create a filesystem. luksopen the file.
    It should get auto mounted.
  - Checking for disk space repeatedly happens every 3 minutes.
  - Drives are checked for healthy status only once, 3 seconds after FreedomBox is started.
  - FreedomBox is able to mount disks while running as 'plinth' user with
    policykit-1 version 0.105-26.
  - FreedomBox is able to mount disks while running as 'plinth' user with
    policykit-1 version 0.116-2 from experimental.
  - Temporarily flip the is_failing condition in report_failing_drive. When
    FreedomBox is restarted, notification about drives failing show up. When the
    condition is reverted to normal, the notification is withdrawn.
  - Build new Debian package and upgrade system with 20.8 installed. Two files
    should be removed:
    /var/lib/systemd/deb-systemd-helper-enabled/freedombox-udiskie.service.dsh-also
    /etc/systemd/system/multi-user.target.wants/freedombox-udiskie.service .
    systemctl status freedombox-udiskie.service should report no such unit.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
2020-05-16 11:42:23 +03:00
Sunil Mohan Adapa
b3663075a0
notification: Expand and clarify restriction on id property
- This is to allow arbitrary strings to be part of id property via base32
encoding.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
2020-05-15 18:00:53 -07:00
Sunil Mohan Adapa
6216f7872c
glib: Allow scheduling non-repeating tasks in separate threads
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
2020-05-15 18:00:49 -07:00
Joseph Nuthalapati
8b721a27ef
functional-tests: Move Disable tests to the end
Disabling an application at the end of test suite frees us system
resources for the remaining applications.

Signed-off-by: Joseph Nuthalapati <njoseph@riseup.net>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2020-05-12 18:27:50 -07:00
Joseph Nuthalapati
adc1c67e12
functional-tests: Skip network setup wizard
Fixes #1781

Signed-off-by: Joseph Nuthalapati <njoseph@riseup.net>
[sunil: Update to work with latest code]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2020-05-12 17:50:06 -07:00
Sunil Mohan Adapa
55f4573e93
firewall: Reload firewalld so it works with newly installed services
firewalld has no problem retrieving service information for just-installed
files, it only fails when adding/removing those services to zones. A reload is
needed before those services can be used.

Don't perform firewalld reload during setup.py or debian/postinst. Instead
reload when firewalld throws an error that it does not know a service. This
approach is more minimally intrusive and does not run reload operations when no
services need to be loaded, during Debian package building etc.

Closes: #376.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2020-05-12 10:59:55 -04:00
Sunil Mohan Adapa
b763391dfb
daemon: bind: cosmetic: yapf, isort formatting
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2020-05-12 08:11:30 -04:00
Sunil Mohan Adapa
e3228467f3
bind: Add daemon alias for bind9 -> named
bind9 package version 1:9.16.1-2 in unstable renamed bind9.service to
named.service. The new service file contains Alias=bind9.service. Use this
support multiple versions of the package across Debian stable, testing and
unstable.

Closes: #1816.

Tests performed:

- Enable the service. 'service enable bind9' is called but fails with error
ignored. 'service enable named' is also called but succeeds. Running 'service
is-enable bind9' and 'service is-enabled named' return success. App page show
enabled, there are no errors on the page.

- When app is enabled, there is no message that service is not running.

- When diagnostics are run, it shows that bind9 service is running.

- Disable the app. 'service disable bind9' is called. Running 'service is-enable
bind9' and 'service is-enabled named' return errors. App page shows disabled,
there are no errors.

- Repeat tests on Debian stable.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2020-05-12 08:11:26 -04:00
Sunil Mohan Adapa
6d2f4b6cea
daemon: Allow using an alias when enabling a daemon
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2020-05-12 08:11:23 -04:00
Sunil Mohan Adapa
7f7b5b4e67
performance: Add basic functional tests
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
2020-05-11 22:26:45 -07:00