39 Commits

Author SHA1 Message Date
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
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
Sunil Mohan Adapa
fd7bda7ce9
ssh, apache: Make fail2ban use systemd journald backend by default
- This allows disabling syslog daemons.

- Fall back to using file based monitoring for Apache.

Tests performed:

- Before and after the patch, connecting via SSH and typing in incorrect
password leads to a entry in fail2ban.log. 10 incorrect attempts result in a 10
minute ban.

- Before and after the patch, typing in incorrect password for radicale leads to
a entry in fail2ban.log. 10 incorrect attempts result in a 10 minute ban.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
2021-03-05 18:05:23 -08:00
James Valleroy
a8b5a32ff4
setup: Enable essential apps that use firewall
Tests in testing container:
- SSH, Service Discovery, and Web Server are shown as enabled on
Firewall page.
- FreedomBox interface can be accessed after disabling Cockpit.

Closes: #2016.

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2021-01-22 17:34:29 -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
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
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
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
James Valleroy
822c322d20
apache: Disable mod_status
Prevent leaking private info through Tor onion service or Pagekite.

Tests:

- When starting plinth, apache setup is run. Status module is
disabled, and apache2 is restarted.

- sunil: After upgrade, status page is not available.

- sunil: mod_status is available in stable (2.4.38-3+deb10u3) and
testing/unstable (2.4.46-1).

Closes: #1935.

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
Tested-by: Sunil Mohan Adapa <sunil@medhas.org>
2020-08-29 18:27:25 -07:00
Joseph Nuthalapati
d92ca09e19
framework: Remove module init() functions
Fixes #1906

Signed-off-by: Joseph Nuthalapati <njoseph@riseup.net>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2020-08-03 18:06:48 -04:00
Sunil Mohan Adapa
f07a81ef39
apache: Add ssl-cert package as dependency
The make-ssl-cert command is used during initial setup so it is a hard
dependency. Earlier it was being included as a Recommends: via apache2 package.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2020-06-22 17:17:58 -04:00
Sunil Mohan Adapa
2ed47b047d
apache: Handle transition to php 7.4
Directory /etc/php/7.4 became available before php7.4-fpm became available.
Handle this by checking the run time socket of the fpm daemon instead of the
directory.

Discussed and tested in
https://discuss.freedombox.org/t/mediawiki-service-unavailable/711/23

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2020-03-07 16:33:55 -05:00
Sunil Mohan Adapa
9368504da5
*.py: Use SPDX license identifier
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
2020-02-19 14:38:55 +02:00
Sunil Mohan Adapa
b576a77c3d
app: Refactor all apps to use the Info component
- Remove the need to pass all the individual information elements to the AppView
  separately. This eliminates many issues with elements that were mistakenly not
  sent to AppView. Also reduces a lot of code duplication.

- Create App classes for power and sso for consistency.

Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2020-02-16 18:22:01 -05:00
Sunil Mohan Adapa
e0dba2cc17
apache: Move diagnostics for checking URLs into apache module
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-12-30 11:37:57 -05:00
Sunil Mohan Adapa
0d5493dae7
apache: Implement diagnostic test for web server component
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-12-30 11:37:35 -05:00
Alice Kile
eb83e00011
fix formatting issues
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-12-07 13:08:35 -05:00
Sunil Mohan Adapa
86da6a894a
Minor changes to flake8 related updates
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-07-25 11:46:14 -07:00
Nikolas Nyby
5439084c84
Add flake8 to gitlib-ci - closes #58
And fix the rest of the flake8 errors.

Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-07-25 11:07:06 -07:00
Sunil Mohan Adapa
c47a99b25e
apache: Add let's encrypt certificate component
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
2019-07-16 15:13:28 +05:30
Sunil Mohan Adapa
46f162d093
app: Add unique ID to each app class
Also maintain a global list of apps

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-06-13 20:17:59 -04:00
Sunil Mohan Adapa
862d87920a
Introduce uwsgi component to manage uWSGI configuration
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-06-13 20:17:53 -04:00
Sunil Mohan Adapa
4100d36381
Introduce webserver component for managing Apache configuration
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-06-13 20:17:49 -04:00
Sunil Mohan Adapa
ca2c7dbeb0
Introduce firewall component for opening/closing ports
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-06-13 20:17:45 -04:00
Sunil Mohan Adapa
70a9f4a6ae
apache: Add proxy_html module needed by i2p app
Enable by default so that app installation (algo during backup restore) does not
cause apache to restart and show error pages.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-04-01 17:33:38 -07:00
Sunil Mohan Adapa
ff247fa5aa
setup: Move app data files into respective apps
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-03-17 16:20:57 -04:00
Sunil Mohan Adapa
fdcbd46513
setup: Move app enabling files to respective apps
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-03-17 16:20:54 -04:00
Sunil Mohan Adapa
7862325bb6
apache: Increment app version number
To trigger setting up all the necessary modules again.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-02-28 20:13:48 -05:00
Sunil Mohan Adapa
ab64bd17a3
apache: Switch to mod_ssl from mod_gnutls
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-02-09 12:28:09 -05:00
Joseph Nuthalapati
9e4fb5eb59
apache: Switch to php-fpm from mod_php
Also try to automatically work for future versions of PHP.

Fixes #1413
Fixes #1258

Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2018-12-13 18:24:47 -05:00
James Valleroy
bdefb7b863
apache: Run setup again to reload
Reload for new JSXC config.

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
2018-11-24 17:47:49 +05:30
Sunil Mohan Adapa
ae0fd34b73
apache: Increase module version number to fix php7.2
This reruns the Apache setup script and will lead to php7.0 getting disabled and
php7.2 getting enabled. This will fix PHP issue for people who already have
php7.2 installed and not enabled or those who luckily have get php7.2 installed
before FreedomBox package is upgraded.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2018-03-24 20:13:28 -04:00
Sunil Mohan Adapa
7b326870da
apache: Only regenerate snake oil cert when needed
Closes #1230.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2018-03-24 20:12:51 -04:00
Sunil Mohan Adapa
59c64e7872
ssh, avahi, apache: Fix default value for setup arguments
To be consistent with all other apps.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2018-03-24 20:11:34 -04:00
Sunil Mohan Adapa
8f0e2d6381
Rename Plinth to FreedomBox in module doc strings
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2018-02-16 20:10:25 -05:00
Sunil Mohan Adapa
dea4af17fb
Rename Plinth to FreedomBox in license headers
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2018-02-16 20:10:09 -05:00
Sunil Mohan Adapa
602ea6cf16
apache: New module to manage Apache configuration
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2017-09-01 20:04:07 -04:00