2748 Commits

Author SHA1 Message Date
James Valleroy
83bfc51931
upgrades: Add button to test dist-upgrade in development mode
Tests:

- In non-development mode, button does not appear.

- On testing system, button does not appear.

- On stable system in development mode, the button appears.

- Pressing the button starts a dist-upgrade.

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
[sunil: Join strings that fit in the same line]
[sunil: Fix indentation in template]
[sunil: Change 'dist-upgrade' to 'distribution upgrade' in UI strings]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2022-08-18 08:47:03 -07:00
James Valleroy
fd3166442f
ejabberd: Set hostname for test that relies on it
The test uses freedombox.local as the domain. This requires that Avahi
is enabled, and the hostname is set to freedombox.

Fixes #2232.

Test:
- ejabberd functional tests pass even after running tests for config
and avahi.

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2022-08-16 10:47:40 -07:00
James Valleroy
18a79e1420
avahi: Don't disable after tests
It is used by other tests, such as ejabberd's.

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2022-08-16 10:47:26 -07:00
Sunil Mohan Adapa
bd90e59fa3
wireguard: Fix module.app usage that is no longer available
Tests:

- Add a new server and delete it.

- Add a new client and delete it.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2022-08-15 10:36:51 -04:00
Sunil Mohan Adapa
f8136e8c8f
sharing: Add installing and enable/disable like other apps
- With the new setup mechanism automatic setup of app is no longer possible.

- Enabling/disabling is desirable by the user.

- During initial setup, ensure that Apache configuration file exists. Upgrade
for existing users to create the file.

- Enabling/disabling the app enables/disables the web server configuration file.

- Diagnostics are not available, disable them explicitly as auto-detect does not
work.

- Use the regular app base template instead of custom one.

- Use framework base classes for view and functional tests.

Tests:

- Run functional tests.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2022-08-15 10:36:49 -04:00
Sunil Mohan Adapa
d96a0a0a38
sharing: tests: functional: Fix a flaky test by waiting
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2022-08-15 10:36:47 -04:00
Sunil Mohan Adapa
b140a8104f
ssh: tests: functional: Keep service enabled after tests
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2022-08-15 10:36:44 -04:00
Sunil Mohan Adapa
2dfa8abeca
ejabberd: Fix showing the status messages
Django template language does not support overriding blocks that are from
included pages. The status messages were shown as part of the description and
when app header was introduced, these messages were no longer being shown.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2022-08-15 10:36:42 -04:00
Sunil Mohan Adapa
6af46e8e00
matrixsynapse: Fix showing the status messages
Django template language does not support overriding blocks that are from
included pages. The status messages were shown as part of the description and
when app header was introduced, these messages were no longer being shown.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2022-08-15 10:36:39 -04:00
Sunil Mohan Adapa
4b570e38da
backups: tests: Mark need for Django database during API tests
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2022-08-15 10:36:37 -04:00
Sunil Mohan Adapa
4cb1477c0d
setup: Drop setup_helper and use the new Operation API
- Task of managing an operation's progress is now performed by the new Operation
class. Drop them from setup helper.

- Task of providing install() method is now moved to package module. Instead of
storing operation specific data in setup_helper like objects, store them in
thread specific storage that can retrieved anywhere during the operation without
holding references.

- Progress of an operation show as a progress bar is currently missing. This
will be regression until fixed later.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2022-08-15 10:36:32 -04:00
Sunil Mohan Adapa
900c0d30b9
*: Drop module level app property
module.app property usage is greatly reduced because setup() and force_upgrade()
method are now part of App class instead of at the module level. Remove the
remaining minor cases of usage and drop the property altogether.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2022-08-15 10:36:29 -04:00
Sunil Mohan Adapa
7a36ee23f5
app: Drop optimization that skips setup process
When an app does not implement module setup() method, trying to get setup
version automatically results in App being updated to latest version. This
optimization seems hardly used and does not work when setup() is moved to App
from module level. Remove it.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2022-08-15 10:36:24 -04:00
Sunil Mohan Adapa
bb2cbace6c
*: Make force upgrading part of app rather than a module
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2022-08-15 10:36:22 -04:00
Sunil Mohan Adapa
f6ef0135d2
*: Add setup method on all apps that don't have it
This is needed for the apps to get enabled soon after installation. In case of
'sharing' app, a shortcut will appear on the apps page. This also brings
uniformity to help later refactoring.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2022-08-15 10:36:19 -04:00
Sunil Mohan Adapa
75f6abac1e
*: Make setup method part of App class for all apps
- Primary purpose is to complete the App API and allow for multiple apps to be
present in a module without a single clashing setup() method. Secondary
objective is to get rid of SetupHelper instance simple use App instance instead.

- This brings us closer to not needing to implement setup() method for some of
the typical apps.

- Remove default value None for old_version parameter.

  - A valid integer value is always passed to this call.

  - The value of None is undefined.

  - Simplifies the App API slightly.

- Drop setting 'pre', 'post' values to indicate the stage of setup for the App.

  - Simplifies the setup methods significantly. Eliminates a class of
  bugs (some of them seen earlier).

  - The UI can show a simple 'installing...' or progress spinner instead of
  individual stages.

  - There are currently many inconsistencies where many operations are not
  wrapped in helper.call() calls.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2022-08-15 10:36:16 -04:00
Sunil Mohan Adapa
fee21cba0d
notification: Pass full context when rendering body template
- Important information such as id of the notification should be available when
rendering the body template.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2022-08-15 10:36:06 -04:00
Sunil Mohan Adapa
5f8d3e30d0
coturn: Fix link to ejabberd in description
Tests:

- Clicking on the link in the coturn app description takes us to ejabberd app
page.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2022-08-14 18:46:58 -04:00
Veiko Aasa
41a3148d3a
storage: Fix enumerating partitions without mount points
Fixes an issue where accessing Storage and Samba app pages throws a
HTTP error 500 when there are disk partitions without mount points.

Fixes #1904 #2245

Tested when an USB stick with Debian installer image is attached to
Freedombox board - both Storage and Samba apps work.

Signed-off-by: Veiko Aasa <veiko17@disroot.org>
2022-08-13 15:59:57 -07:00
James Valleroy
b372c2e2fa
networks: Remove DNSSEC diagnostics
- test.dnssec-or-not.net is no longer working.

- If the test fails, it is not clear to the user what to do about it.

Closes #1607, helps #1706.

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
2022-08-09 19:17:58 +03:00
Sunil Mohan Adapa
6db1029d27
help: tests: Fix about page test by mocking version calls
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
2022-08-01 16:01:20 -07:00
Sunil Mohan Adapa
9647b00278
help: Update test for contribute view
- Verify that issue data is sent in context properly.

- Ensure that an external request is not made during testing.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
2022-08-01 15:44:10 -07:00
James Valleroy
e5a866dd64
help: Add "How can I help?" section to Contribute page
This doesn't use the how-can-i-help package, but it is a similar
implementation that fetches the same data from udd.debian.org.

There are sections for the following issues:
- Packages that will be removed from Debian testing
- Packages that are not in Debian testing
- Good first issues for beginners
- Issues for which the package maintainer has requested help

The overall "How can I help?" section is collapsed by default.

Test:
- View the page in stable and testing container.
- Run help functional tests.

Closes: #536

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
[sunil: Minor indentation fix]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2022-08-01 14:09:47 -07:00
nbenedek
eeca9c05ba
wordpress: Don't install php-ssh2
Additional plugin and theme installation is done with the 'direct filesystem
method' as opposed to ssh, so this package is not needed.

Signed-off-by: Benedek Nagy <contact@nbenedek.me>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2022-08-01 10:55:05 -07:00
James Valleroy
c72225de40
rssbridge: Fix flake8 errors
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2022-07-17 18:57:13 -07:00
Sunil Mohan Adapa
20081ee5d1
roundcube: Use privileged to simplify actions
Tests:

- Functional tests pass

- Same tests as previous patch for setting logging to syslog.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2022-07-17 17:23:18 -04:00
nbenedek
6c86da022e
roundcube: Add fail2ban jail
Default backend for fail2ban is systemd journal. Roundcube will be configured in
FreedomBox to log to journal (via syslog).

Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2022-07-17 17:22:52 -04:00
Sunil Mohan Adapa
253ddb0c18
roundcube: Configure to log to journald
Tests:

- On a fresh container, install roundcube. log_driver is set to syslog in
freedombox-config.conf.

- Install roundcube without the changes. Enable local only. Apply the changes
and restart service. roundcube setup is run. log_driver is set to syslog in
freedombox-config.conf. Setting is still local-only.

- Install roundcube without the changes. Disable local only. Apply the changes
and restart service. roundcube setup is run. log_driver is set to syslog in
freedombox-config.conf. Setting is still not local-only.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2022-07-17 17:22:30 -04:00
Sunil Mohan Adapa
8c4999eabd
config: Set volatile logging by default
This reduces the number of writes to the disk improving disk longevity and IO
performance. Note that systemd-journald is already very reasonable with how
often it writes to the disk. It's flush interval is 5 minutes.

Most users of FreedomBox are not expected to see logs. Those that see the logs
do so for debugging purposes. Debugging can still be done if reboot does not
occur. Users can change the logging mode to 'persistent' before debugging issues
that require reboot. This makes debugging harder for non-reproducible bugs, but
is, at present, considered an acceptable compromise.

Tests:

- On a fresh container, with the patch applied, config page shows 'volatile' as
the logging mode.

- On an container with changes not applied, start freedombox service. Then apply
the patch and restart service. config app setup will be run. Config page shows
'volatile' as the logging mode.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2022-07-17 16:55:06 -04:00
Sunil Mohan Adapa
80a203bd23
config: Add option to set logging mode: none/volatile/persistent
- None disables logging altogether. This is useful when we want to prevent
FreedomBox from collecting IP addresses of visitors and other sensitive
information.

- Volatile logs are kept in RAM until the system is rebooted. Only 5% of RAM
will be used at most and only 2 days worth of logs are kept.

- Permanent will store logs into /var/log/journal. systemd-journald defaults
will apply. 10% of disk capacity is used at most, capped at 4GiB. Also logging
will stop if free space is below 15%. Maximum of 100 files are kept. No time
based cleanup is done.

Tests:

- Set the logging mode to disabled. Observe that `journalctl -f` does not show
any logs (say when performing plinth actions).

- Set the logging mode to volatile. Observe that `journalctl` shows that logging
is set to /run/log/journal/ and 5% of available memory is set as maximum.

- Set the logging mode to persistent. Observe that `journalctl` shows that
logging is set to /var/log/journal/ and 10% of disk space is set as maximum.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2022-07-17 16:54:46 -04:00
Sunil Mohan Adapa
f8f7dd22b5
apache: Merge old configuration files into a better location
- It is simpler to keep all the configuration in a single file. Any overrides
are expected to be done by writing additional configuration files with higher
priority.

- /etc/apache2/site-available/ is typically reserved for virtual host
configurations. Redirections and proxying for all virtual hosts rather belongs
in /etc/apache2/conf-available/.

- This looses the option of disabling plinth-ssl.conf when needed. In the
initial days of enabling TLS, there was a need felt to keep the option of easily
disabling redirection to TLS in case there is a need for it. However, TLS
certificate setup is mature and the limitations are well understood. There is no
longer a need for it. It still may be possible to avoid the redirection with an
additional configuration.

Tests:

- In a fresh container, setup succeeds. Redirecting to https:// for /plinth
works. FreedomBox web interface is available.

- Without the patch applied created a container. Run setup and access Plinth
interface. Apply the patches. Apache setup is run. a2query -s plinth and a2query
-s plinth-ssl show that sites are not enabled. Redirecting to https:// for
/plinth works. FreedomBox web interface is available.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2022-07-17 12:07:55 -04:00
James Valleroy
2b6b025bcf
janus: Change short description to "Video Room"
This makes it clearer why one would wish to install and use this app.

Closes #2236.

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2022-07-17 09:05:51 -07:00
Sunil Mohan Adapa
b2e6508b16
rssbridge: Add functional tests
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
2022-07-17 09:04:54 -07:00
Sunil Mohan Adapa
556c476de4
rssbridge: Whitelist all bridges by default
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
2022-07-17 09:04:51 -07:00
nbenedek
9efc56368c
rssbridge: New app to generate RSS feeds for websites
[sunil: Update description for simplicity, group info]
[sunil: Indentation fixes]
[sunil: End all URLs with a slash]
[sunil: Update frontpage shortcut to be a simple one]
[sunil: Enable single-sign-on for main interface only]
[sunil: In copyright file, merge with public-domain section]
[sunil: Simplify and vectorify the icon]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2022-07-17 09:04:48 -07:00
Veiko Aasa
545b35c0aa
gitweb: Switch default branch name to main for new repositories
I tested additionally that if the root user has already configured
default branch other than main, it is not changed by the gitweb app
setup process.

Signed-off-by: Veiko Aasa <veiko17@disroot.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2022-07-15 20:54:32 -04:00
Sunil Mohan Adapa
99d8be9d2a
cockpit: Use decorator for privileged actions
Tests:

- Login to Cockpit on a freshly setup container.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2022-07-15 20:37:13 -04:00
Sunil Mohan Adapa
c163601b6c
cockpit: Reconfigure to allow any origin
When Cockpit is not configured any origins, it uses the host and protocol of the
incoming request to set the allowed origin for WebSocket connections. By
ensuring that the original host/protocol is passed on to Cockpit from the
browser, we can eliminate the need for configuring a pre-determined list of
origins. Passing the host and protocol from the browser is done by setting
ProxyPreserveHost and using https:// for proxying.

For a cross-site request, Origin: and Host: entries won't match and '403
Forbidden' is thrown. So, this approach is still safe.

Tests:

- Without the patch, access Cockpit using IP address and it fails. Apply the
patch. Cockpit setup should run. Origins= directive in the configuration file
/etc/cockpit/cockpit.conf should get removed. Accessing with IP address and
logging in succeeds.

- Freshly setup a container with the patch and access Cockpit using IP address.
This works and login succeeds.

- Test on stable and testing containers.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2022-07-15 20:37:04 -04:00
Sunil Mohan Adapa
372ecdcda9
privoxy: Use privileged decorator for actions
Tests:

- App installation works. Proxying works when configured with Firefox.
listen-address and permit-access directives are set as expected in the
configuration file.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
2022-07-13 19:41:45 -07:00
nbenedek
de2c246dbd
privoxy: Restrict to private IPs, prevent access over the internet
- Make sure a user might not run Privoxy as an open proxy, potentially giving
unwanted access to local resources. Only private IP classes are allowed to
connect.

Tests:

- Freshly install privoxy app. permit-access directives are set in the
configuration. Proxy works when tested with a private IP address with Firefox.

- Install privoxy app without the changes. Apply the changes, privoxy setup
should run. permit-access directives are set in the configuration. Proxy works
when tested with a private IP address with Firefox.

- Privoxy works when accessed with IPv4 address (such as 10.42.0.x) and IPv6
address (such as fe80:y:z%ve-fbx-testing).

[sunil: Use Spacevars augeus lens to edit the configuration file]
[sunil: Update IP ranges with auto-configuration, IPv6 addresses, etc.]
[sunil: Update description to mention that only local IPs are allowed]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2022-07-13 19:41:42 -07:00
Sunil Mohan Adapa
08821787bf
cockpit: Depend on apache and setup after it
Closes: #2089.

Tests:

- Regular startup works without errors. Cockpit is ordered after Apache.

- After creating a fresh container, Cockpit works as expected. Cockpit setup
runs after Apache setup.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2022-07-12 20:00:18 -04:00
James Valleroy
d42a07a630
datetime: Fix typo from pylint fix
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
2022-07-04 20:58:21 -04:00
Sunil Mohan Adapa
eaa3a59791
*: pylint: Drop unnecessary 'pass' statements
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2022-07-04 19:46:31 -04:00
Sunil Mohan Adapa
22a120d979
*: pylint: Avoid calling super() with arguments
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2022-07-04 19:46:23 -04:00
Sunil Mohan Adapa
bfa11beb73
*: pylint: Don't inherit from 'object'
- This was required in Python 2 but useless in Python 3.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2022-07-04 19:46:15 -04:00
Sunil Mohan Adapa
3c7bc4a192
*: pylint: Explicitly specify encoding when open a file
This is recommended by PEP-0597: https://peps.python.org/pep-0597/

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2022-07-04 19:45:57 -04:00
Guillermo Lopez Alejos
957ddf5a2d
backups: Unmount repositories before and after backup
[sunil: Make the umount code specific to SSH repositories]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2022-06-30 15:31:16 -07:00
nbenedek
35b50a2c71
users: create home directories for newly created users
Test I made: Created a few users, then appied the changes
and rebooted FreedomBox. After reboot I created another user
whose home directory could now be listed.

Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2022-06-30 09:07:52 -07:00
nbenedek
0d37809eb8
mediawiki: Add regex validator to the domain field
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2022-06-29 13:01:37 -07:00
nbenedek
26f576bb79
mediawiki: Remove wgLogo as it is not needed in Bullseye
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2022-06-29 09:29:37 -07:00