2850 Commits

Author SHA1 Message Date
Sunil Mohan Adapa
6e8b825d44
email_server: aliases: Drop hash DB and use sqlite3 directly
- Postfix has the ability to use sqlite3 databases directly. There is no need to
synchronize to a hash db and then use that.

- Store the aliases database in /var/lib/postfix/. This will make backup and
restore easier and remove dependence on FreedomBox and its data directory.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-10-30 16:15:26 -04:00
Sunil Mohan Adapa
91f18a0e52
email_server: yapf formatting
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-10-30 16:14:58 -04:00
Sunil Mohan Adapa
c742d18f3c
email_server: aliases: Drop unused regex
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-10-30 15:23:24 -04:00
Sunil Mohan Adapa
3e7037d0ea
email_server: aliases: Drop unused sanitizing method
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-10-30 15:23:21 -04:00
Sunil Mohan Adapa
c89a7fdb9d
email_server: aliases: Drop unnecessary sanitizing
- In the list form, the values are already sanitized as they are retrieved from
the database. Don't refuse to manage existing aliases that don't fit the format.

- In the create form, the form already sanitizes as necessary.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-10-30 15:23:18 -04:00
Sunil Mohan Adapa
6e236a41a8
email_server: aliases: Move sanitizing to form
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-10-30 15:23:16 -04:00
Sunil Mohan Adapa
19d45514de
email_server: aliases: Drop validation already done by form
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-10-30 15:23:12 -04:00
Sunil Mohan Adapa
f5d1cb474f
email_server: aliases: Using Django forms instead of custom forms
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-10-30 15:23:09 -04:00
Sunil Mohan Adapa
b0e460b433
email_server: aliases: Add method for checking of an alias is taken
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-10-30 15:23:06 -04:00
Sunil Mohan Adapa
b0d3bdb170
email_server: Reduce the size of headings for aliases/homedir pages
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-10-30 15:23:03 -04:00
Sunil Mohan Adapa
54b9a93400
email_server: Add heading for manage aliases page
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-10-30 11:03:57 -04:00
Sunil Mohan Adapa
9c7c39e61d
email_server: Remove aliases view from tabs list
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-10-30 11:03:27 -04:00
Sunil Mohan Adapa
b20d5a96c3
email_server: Add button for managing aliases
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-10-30 11:03:21 -04:00
Sunil Mohan Adapa
8ac0751f5b
email_server: Turn home view into a simple page rather than a tab
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-10-30 11:03:00 -04:00
Sunil Mohan Adapa
b7445e659b
email_server: Add button for setting up home directory
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-10-30 11:02:46 -04:00
Sunil Mohan Adapa
910714d435
email_server: Refactor the home directory page
- Add a header to the page.

- Move message outside the form.

- Remove warning and strong emphasis. Since this is only content in the page.

- Derive from regular base.

- Drop unnecessary reference to bootstrap forms.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-10-30 11:02:06 -04:00
James Valleroy
a503d5db5d
zoph: Use BaseAppTests for functional tests
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2021-10-25 10:16:46 -07:00
James Valleroy
017b1b43da
ssh: Use BaseAppTests for functional tests
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2021-10-25 10:16:38 -07:00
James Valleroy
75f5769c16
quassel: Use BaseAppTests for functional tests
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2021-10-25 10:16:30 -07:00
James Valleroy
70f99eba8f
privoxy: Use BaseAppTests for functional tests
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2021-10-25 10:16:23 -07:00
James Valleroy
338f3d1c0a
performance: Use BaseAppTests for functional tests
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2021-10-25 10:16:15 -07:00
James Valleroy
de029509fc
performance: Add backup support (no data)
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2021-10-25 10:16:07 -07:00
James Valleroy
a055209f54
minidlna: Use BaseAppTests for functional tests
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2021-10-25 10:15:59 -07:00
James Valleroy
cc9cfbcd20
minetest: Use BaseAppTests for functional tests
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2021-10-25 10:15:52 -07:00
James Valleroy
9735a9d342
matrixsynapse: Use BaseAppTests for functional tests
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2021-10-25 10:15:44 -07:00
James Valleroy
b6caa66558
i2p: Use BaseAppTests for functional tests
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2021-10-25 10:15:36 -07:00
James Valleroy
89faf10470
coturn: Use BaseAppTests for functional tests
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2021-10-25 10:15:28 -07:00
James Valleroy
18643b99db
cockpit: Use BaseAppTests for functional tests
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2021-10-25 10:15:18 -07:00
James Valleroy
8adbc3509b
avahi: Use BaseAppTests for functional tests
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2021-10-25 10:15:07 -07:00
Sunil Mohan Adapa
53b4d4e729
storage: tests: Convert class based tests to simple tests
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
[jvalleroy: Fix conflicts with 9bd1f80d]
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-10-24 06:54:21 -04:00
Sunil Mohan Adapa
3b978148ea
storage: tests: Fix tests for expanding disk parititions
- These are only run when tests are executed as root and loop back devices are
available (i.e., outside a container, on host or VM).

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-10-24 06:54:14 -04:00
Sunil Mohan Adapa
244d0ba50c
storage: tests: Refactor disk tests for readability
- Eliminate inter-dependency of objects.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-10-24 06:54:08 -04:00
James Valleroy
6358d4fcd3
roundcube: Use BaseAppTests for functional tests
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2021-10-18 10:28:03 -07:00
James Valleroy
ed46278550
mumble: Use BaseAppTests for functional tests
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2021-10-18 10:27:59 -07:00
James Valleroy
fae88d9fff
infinoted: Use BaseAppTests for functional tests
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2021-10-18 10:27:56 -07:00
Sunil Mohan Adapa
8899bdef7b
email_server: Move roundcube link from My Mail to description
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
[fioddor: squash create and remove commits as parts of the same move]
Reviewed-by: Fioddor Superconcentrado <fioddor@gmail.com>
2021-10-18 12:49:57 +02:00
Sunil Mohan Adapa
f3d9a499eb
email_server: clients: Launch roundcube directly instead of app page
- Maintain consistency with rest of the apps and do what the user will mostly
expect.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Fioddor Superconcentrado <fioddor@gmail.com>
2021-10-18 12:49:57 +02:00
Sunil Mohan Adapa
ba4daeb9bb
email_server: Don't let the My Mail page to blank page
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Fioddor Superconcentrado <fioddor@gmail.com>
2021-10-18 12:49:56 +02:00
Sunil Mohan Adapa
3ee76e38a5
email_server: Add heading for manage aliases page
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
[fioddor: Keep email_alias.html based on email_form_base.html to avoid
inconsistent UI]
Reviewed-by: Fioddor Superconcentrado <fioddor@gmail.com>
2021-10-18 12:44:19 +02:00
Sunil Mohan Adapa
0e207621de
email_server: Add a name for aliases view
So that it can be easily URL reversed.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Fioddor Superconcentrado <fioddor@gmail.com>
2021-10-17 14:24:33 +02:00
Sunil Mohan Adapa
9c578a36fd
email_server: yapf formatting
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Fioddor Superconcentrado <fioddor@gmail.com>
2021-10-17 14:24:17 +02:00
Sunil Mohan Adapa
c7c9d49939
ttrss: Add systemd security hardening to daemon
→ Overall exposure level for tt-rss.service: 1.1 OK 🙂

Tests:

- Run ./setup.py install. systemctl daemon-reload. Subscribe to a new feed and
don't wait for it load the feed. Then start/restart the daemon. The daemon
successfully fetches the feed. When tt-rss interface is loaded again the feed
items are available.

- For getting output of the daemon add StandardOutput=journal option to the
service file.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-10-11 15:47:05 -04:00
Sunil Mohan Adapa
2c4423baaf
ttrss: Fix daemon not running sometimes on startup
- Sometimes when postgres is not available, the daemon fails to create a
database connection. In this case the daemon permanently exits with code 101
instead of trying again.

- This happens more prominently when booting the system and postgres may not be
available. Although tt-rss.service has Wants= and After= on postgres.service, it
appears that postgres does not have proper startup notification with systemd.

- This may also happen in other situations such as when temporarily restarting
postgres during upgrades or backup/restore operations.

- Fix the issue by make the daemon restart after a failure. This seems
appropriate because the daemon is coded like a web page to fail and exit on
all, even temporary, errors.

Tests:

- Without the patch, stop postgres@13-main.service. Start tt-rss.service. It
will fail permanently and not try to restart.

- With the patch, daemon-reload systemd. Notice that the intended changes
reflect with systemd status. Start the service. It fails. But retries 2 minutes
later with failure again. When postgres is started again, the next attempt
succeeds.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-10-11 15:46:59 -04:00
Sunil Mohan Adapa
9bd1f80d5c
*: Always pass check= argument to subprocess.run()
- Avoid flake8 warnings.

- Makes the call more explicitly readable in case an exception is expected but
check=True is not passed by mistake.

Tests:

- Many tests are skipped since the changes are considered trivial.
check=False is already the default for subprocess.run() method.

- actions/package: Install an app when it is not installed.

- actions/upgrade: Run manual upgrades.

- actions/users: Change a user password. Login. Create/remove a user.

- actions/zoph: Restore a database.

- container: On a fresh repository, run ./container up,ssh,stop,destroy for a
testing container.

- plinth/action_utils.py: Enable/disable an app that has a running service.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-10-11 14:34:40 -04:00
Sunil Mohan Adapa
ebd357476d
performance: Cleanup code meant for cockpit version < 235
Bullseye and higher has version 239 or higher.

Tests:

- From performance app, launch the web interface in a testing container. Web
interface shows up properly.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-10-11 06:36:25 -04:00
Fioddor Superconcentrado
376fe5a85b
email: Manage known installation conflicts
Signed-off-by: Fioddor Superconcentrado <fioddor@gmail.com>
[sunil: Don't show warning on conflict]
[sunil: Add statement to description about conflicts]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2021-10-10 19:22:22 -07:00
Sunil Mohan Adapa
4b708214e4 storage: tests: functional: Fix tests always getting skipped
- The method to check if we are running inside a container is not being called.
Call it.

- Also fix the assumption that tests and freedombox service run on the same
machine. Be conservative and assume running in container if we can't determine
the accurate state.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>

Reviewed-by: Fioddor Superconcentrado <fioddor@gmail.com>
2021-10-10 18:22:11 +02:00
Sunil Mohan Adapa
1c47877f6b
calibre: Run service only if when installed
- This avoids attempting to run the service soon after FreedomBox is installed.

Tests:

- When old freedombox.deb is installed, the service is enabled. When upgraded to
newer .deb with the changes, the service is still enabled but no start attempt
is made by systemd.

- After installation of calibre, the service is running as expected.

- On a fresh installation, calibre service is working as expected.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-10-09 22:09:00 -04:00
Sunil Mohan Adapa
cf054b0888
wordpress: Run service only if when installed and configured
- This avoids attempting to run the service soon after FreedomBox is installed.

Tests:

- When old freedombox.deb is installed, the service is enabled. When upgraded to
newer .deb with the changes, the service is still enabled but no start attempt
is made by systemd.

- After installation of WordPress, the service is running as expected.

- On a fresh installation, WordPress service is working as expected.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-10-09 22:08:56 -04:00
Sunil Mohan Adapa
071d61bcc8
*: Move all systemd service files from /lib to /usr
This is now the preferred location in Debian. See:

https://lintian.debian.org/tags/systemd-service-in-odd-location
https://bugs.debian.org/992465
https://bugs.debian.org/987989
d70caa69c6
https://lists.debian.org/debian-devel/2021/08/msg00275.html

Tests:

- Lintian no longer shows errors:
  E: freedombox: systemd-service-in-odd-location lib/.../calibre-server-freedombox.service

- Comparing the old .deb and newly generated .deb with these changes. All the
systemd files show that they are moved from /lib to /usr/lib/systemd.

- After upgrading the deb from older version to a version these changes,
services installed by the package are available (tested after restart with
wordpress and claibre). Services tweaked by the package have the changed
configuration reflected as shown by systemctl show
{service-name}.service (tested after restart with quassel).

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-10-09 22:08:50 -04:00