2850 Commits

Author SHA1 Message Date
Sunil Mohan Adapa
cd2b2f5f2c
*: Use django.urls.re_path() instead of its alias url()
- In Django 2.2 django.conf.urls.url() is an alias to django.urls.re_path().

- In Django 4.0, url() function will be removed. On Django 3.2, it throws a
warning that this function will be removed in future.

Tests:

- Run unit tests with Django 3.2 and Django 2.2.

- With Django 3.2 there are no warnings when running unit tests and when running
FreedomBox Service.

- Visit a few affected apps with both Django versions.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-09-20 16:50:47 -04:00
Sunil Mohan Adapa
a3e21adc8b
*: Various isort fixes
- Done automatically by running isort . in top level directory.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-09-20 16:50:37 -04:00
Sunil Mohan Adapa
74214c18ae
*: Use Django gettext functions instead of ugettext
- ugettext functions will be removed in Django 4.0. Each use emits a warning
when running with Django 3.2. Since we have warnings enabled in developer mode,
we see quite a few messages because of this.

- ugettext is already a simple alias of gettext. So, no regressions are
expected.

Tests:

- Accessing an affected app in UI with Django 3.2 and Django 2.2 works fine.

- Using Django 3.2 there are no warnings related to removal of ugettext
functions.

- Ran regular unit tests.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-09-20 16:50:16 -04:00
Sunil Mohan Adapa
2abe7315f9
calibre: tests: functional: Use newer splinter API for finding links
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
2021-09-19 07:48:11 +03:00
Sunil Mohan Adapa
e6b1fe6783
dynamicdns: tests: functional: Use newer splinter API for finding links
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
2021-09-19 07:48:05 +03:00
Sunil Mohan Adapa
9811ce1b79
mediawiki: tests: functional: Use newer splinter API for finding links
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
2021-09-19 07:48:00 +03:00
Sunil Mohan Adapa
104cbc0b0d
users: tests: functional: Use newer splinter API for finding links
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
2021-09-19 07:47:55 +03:00
Sunil Mohan Adapa
978fdec9eb
backups: tests: functional: Use newer splinter API for finding links
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
2021-09-19 07:47:44 +03:00
Sunil Mohan Adapa
f759275b0e
openvpn: tests: functional: Use newer splinter API for finding links
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
2021-09-19 07:47:34 +03:00
Sunil Mohan Adapa
68a6427b19
ikiwiki: tests: functional: Use newer splinter API for finding links
Minimum required version of splinter is 0.13.0.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
2021-09-19 07:47:11 +03:00
Veiko Aasa
e31053eb92
samba: tests: Convert functional tests to non-BDD python format
- Also, fix an issue where share writability tests were performed always as an admin user.

Signed-off-by: Veiko Aasa <veiko17@disroot.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2021-09-18 17:05:08 -07:00
Veiko Aasa
c5c1f5594d
gitweb: tests: functional: Fix test failure if initial default branch is not master
Closes #2101.

Signed-off-by: Veiko Aasa <veiko17@disroot.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2021-09-18 00:04:33 -07:00
Veiko Aasa
00be64036a
gitweb: tests: Convert functional tests to non-BDD python format
Signed-off-by: Veiko Aasa <veiko17@disroot.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2021-09-18 00:04:24 -07:00
James Valleroy
7cc3419935
backups: Convert functional tests to non-BDD python format
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
[sunil: Add markers]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2021-09-13 19:04:10 -07:00
James Valleroy
e097250d90
jsxc: Convert functional tests to non-BDD python format
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
[sunil: Add markers]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2021-09-13 19:03:58 -07:00
James Valleroy
9cc69ed32c
matrixsynapse: Convert functional tests to non-BDD python format
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
[sunil: Add markers]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2021-09-13 19:03:45 -07:00
James Valleroy
c2844d358e
performance: Convert functional tests to non-BDD python format
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
[sunil: Add markers]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2021-09-13 19:03:32 -07:00
James Valleroy
b91d2d8c7f
minidlna: Convert functional tests to non-BDD python format
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
[sunil: Add markers]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2021-09-13 19:03:15 -07:00
James Valleroy
fa6aed9c7a
minetest: Convert functional tests to non-BDD python format
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
[sunil: Add markers]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2021-09-13 19:03:00 -07:00
James Valleroy
dc1f6ef732
infinoted: Convert functional tests to non-BDD python format
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
[sunil: Add markers]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2021-09-13 19:02:47 -07:00
James Valleroy
00bbae33ff
i2p: Convert functional tests to non-BDD python format
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
[sunil: Add markers]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2021-09-13 19:02:35 -07:00
James Valleroy
f8277c09ca
cockpit: Convert functional tests to non-BDD python format
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
[sunil: Add markers]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2021-09-13 19:02:22 -07:00
James Valleroy
42c2bcfde7
avahi: Convert functional tests to non-BDD python format
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
[sunil: Add markers]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2021-09-13 19:01:51 -07:00
Sunil Mohan Adapa
857ab0afe1
apache: Enable and prioritize HTTP/2 protocol
- Enabling the module automatically sets 'Protocols h2 h2c http/1.1' in shipped
module configuration.

- HTTP/2 is given higher priority over HTTP/1.1 for supported clients.

- Clients not supporting HTTP/2 continue to work with HTTP/1.1.

- Clients work by using APLN extension in TLS to figure out that server supports
HTTP/2 and use it.

- HTTP/2 improves performance.

- Recommended by Mozilla's SSL configurator: https://ssl-config.mozilla.org/.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-09-11 14:31:30 -04:00
Veiko Aasa
abbec6b8e9
gitweb: tests: Fix test failures if initial default branch is not master
Since Git 2.28, it is possible to change initial default branch name using
the configuration option init.defaultBranch.

Closes #2101.

Signed-off-by: Veiko Aasa <veiko17@disroot.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2021-09-09 12:50:38 -07:00
fliu
41c86e0ba3
email: configure postfix domain names 2021-09-05 18:00:43 -07:00
fliu
63746ce39f
email: postconf.get_many_unsafe: batch query 2021-09-05 18:00:35 -07:00
fliu
06d8aade23
email: Fix self.critical not callable error 2021-09-05 18:00:30 -07:00
James Valleroy
1e2ee690d7
backups: Add functional test to disable schedule backups
This test is at the end so that it leaves scheduled backups disabled
while other tests are running.

Helps #2058.

Tests:

- Ran functional tests for backups. All tests passed.

- Confirmed that scheduled backups are disabled after backup tests are
  complete.

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2021-09-05 17:54:42 -07:00
Joseph Nuthalapati
94ce316f41
mediawiki: Enable a subset of default extensions
Full list of default extensions in MediaWiki
https://www.mediawiki.org/wiki/Bundled_extensions_and_skins

This initial set of extensions are chosen from:
- extensions that I've used myself over the past 3 years
- testing done in #1267

Extensions that are advanced features for administrators, meant for spam
control, advanced tags or suitable only to a specific kind of user are
not included.

Fixes #1382

More extensions can be enabled in the future if they're generally useful.

Signed-off-by: Joseph Nuthalapati <njoseph@riseup.net>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2021-09-04 13:48:49 -07:00
Sunil Mohan Adapa
06ded9fe48
mediawiki: tests: functional: Fix races after flipping flags
When flags are updated and mediawiki is interface is loaded, somehow, it does
not always happen that the page immediate loaded reflects the changes. So, wait
for the change to reflect.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
2021-09-04 12:43:36 -07:00
Joseph Nuthalapati
7fe5cf172b
mediawiki: Bump version number for 1.35 upgrade
We already did a version bump (8 to 9) to run the maintenance script
`update.php` for Debian testing. However, this had no effect on Debian
stable installations (essentially idempotent since no version change
happened then).

Bumping version to 10 to ensure that update.php script runs for
FreedomBoxes on Debian Bullseye.

Signed-off-by: Joseph Nuthalapati <njoseph@riseup.net>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2021-09-04 12:43:32 -07:00
Joseph Nuthalapati
beaf431ee6
mediawiki: Backup and restore uploaded files
Fixes #1747

MediaWiki on Debian seems to store all uploaded files under images/
folder. The administrator can enable additional file types. In the
default configuration, only image files are permitted.

Manually tested that backup/restore works irrespective of file type.

Signed-off-by: Joseph Nuthalapati <njoseph@riseup.net>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2021-09-04 12:43:22 -07:00
James Valleroy
4b51396860
security: Remove display of past vulnerabilities
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2021-08-26 14:22:07 -07:00
Sunil Mohan Adapa
efa615201b
wordpress: New app to manage a WordPress site/blog
- Use php-fpm instead of using mod-php.

- Create database and setup permissions manually. Tables and initial data are
created during the initial setup process done by WordPress. Database upgrades
are handled by WordPress. Minor versions are upgraded automatically and major
version need user intervention.

- Backup/restore functionality including database.

- Install recommended extensions for performance.

- Setup and run cron jobs to ensure that scheduled publications are
completed (among other things). Service has systemd security features. Timer is
set to run every 10 minutes.

- Functional tests for adding/removing posts and backup/restore.

- Increase file upload size limit to 128MiB.

- A private mode (default) for keeping the setup process secure. Should be
disabled after first setup is completed. This uses a new approach using
file-based flag for different Apache configurations.

TODO:

- Find a nice way to allow WordPress to upload plugins/themes. Currently this
operation files and users are expected to manually scp the files to
/var/lib/wordpress/wp-content/{plugins,themes} directory.

Tests:

- Functional tests.

- Schedule publishing of a post. Notice that post got published.

- Test uploading a file larger than 2MiB.

- Test enabling permalinks. This leads to nicer looking URLs.

- Test adding images to posts/pages.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-08-25 08:20:01 -04:00
Sunil Mohan Adapa
5340cf3119
tests: functional: Add a convenience method to logout
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-08-25 08:19:57 -04:00
fliu
f400eb9439
email: implemented service alert
- Better error handling
- You may retroactively diagnose and fix problems
- Shows the most important issues first

audit.models.Diagnosis
  - Added JSON serialization (needed for IPC)
  - Replaced ambiguous vocabulary
  - Provided a sorting key

audit, diagnosis
  - Support title translation
2021-08-20 19:24:21 -07:00
fliu
3ff823e837
email: Sender spoofing patch 1/2: domain rewriting
A sender canonical map deletes the domain part from sender addresses.
Postfix will append @$myhostname after the rewriting.
2021-08-17 19:44:24 -07:00
fliu
1e712f6bc4
email: setup: Configure Roundcube 2021-08-17 19:44:21 -07:00
fliu
5a9c7e5077
email: Documentation, code cleanup
- Audit: finalize MainCfDiagnosis API
- Doc: document Diagnosis models
- Doc: remove hacky imports and replace them with autodoc mock imports
- Views: add `email_` prefix to email server templates
- Apache: delete unnecessary directives (robots tag, cookie header etc.)
2021-08-17 19:44:17 -07:00
fliu
ea8150d9dd
email: setup: Find Let's Encrypt certificates 2021-08-17 19:44:14 -07:00
fliu
9a98ddadd4
email: postfix: dovecot: Set strong security parameters
Other changes:
- Fix linter error
- Postfix port 25: do not trust localhost IP addresses
2021-08-17 19:44:11 -07:00
fliu
b172b0b1cd
email: Local delivery: use full email address
If the domain part was not provided, $myhostname will be used.
In case $myhostname is not in $mydestinations, the email will be relayed.
In case $myhostname is invalid, the email will be bounced.

The next hop should always be LMTP (local: transport)
and hence the `@localhost`
2021-08-17 19:44:08 -07:00
fliu
2f77d99899
email: Code cleanup, address reviews
- View: security.html -> email_security.html
- Setup: will not install Redis
- Setup: put clamav packages on hold
- Crash recovery: opening firewall ports becomes the last post action
- Crash recovery: group postconf.set_many into small transactions
- Crash recovery: safer postconf.set_master_cf_options
2021-08-17 19:44:05 -07:00
fliu
240b67c49e
email: Reload postfix in domain view 2021-08-17 19:44:02 -07:00
fliu
27387d4a9c
email: Implement outbound mail filtering
- Make extensive use of the milter protocol
- Milter: add X-Fbx- headers to emails
- All submitted mails go to smtp:localhost:10025 for filtering
- Header privacy for submitted mails
- Rspamd: be able to inject and replace FreedomBox-managed config
- Reserve special addresses for future use

Known issue: internal emails do not go through spam filtering
2021-08-17 19:43:58 -07:00
fliu
85c6b91fbc
email: Code cleanup
- Move render_tabs into plinth.views
- Move admin_tabs and user_tabs into the class
- New interproc module contains inter-process functions
- New helper methods in TabMixin
2021-08-17 19:43:55 -07:00
fliu
e454e8ac1b
email: LMTP: remove the recipient's UID number from email headers 2021-08-17 19:43:52 -07:00
fliu
cdfef82bf6
email: Implement auto-discovery 2021-08-17 19:43:49 -07:00
fliu
355cc84a1b
email: apache: X-Robots-Tag header, full URL match 2021-08-17 19:43:46 -07:00