238 Commits

Author SHA1 Message Date
Sunil Mohan Adapa
1cf0748a49
apache2: Allow downloads in openvpn and backups with latest browsers
Closes: #2002.

Entire FreedomBox UI is served within a sandbox that is originally meant for
cross-site iframes.

A newly introduced flag allow-downloads is required to trigger downloads. Two
instances where this is used in FreedomBox is openvpn profiled download and
backup download. Firefox 81 and Chrome 83 implement this flag.

Add 'allow-downloads' to sandbox directives to fix this.

References:

- https://github.com/whatwg/html/pull/4293
- https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe
- https://bugzilla.mozilla.org/show_bug.cgi?id=1558394
- https://www.chromestatus.com/feature/5706745674465280

Tests:

- Check that OpenVPN profile can be downloaded.
- Check that backups can be downloaded.
- Check on Firefox 78 and Chromium 83.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
2021-01-02 13:52:59 +02:00
Sunil Mohan Adapa
6574ec2d44
apache2: Disallow all inline styling in sandbox settings
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
2020-12-19 16:26:54 +02:00
Sunil Mohan Adapa
8ab551f285
apache: Relax CSP to allow web workers for JSXC
Closes: #1893.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
2020-06-29 23:31:03 +03:00
Sunil Mohan Adapa
110ec7d744
apache: Set CSP and other common security headers
Tests performed:

- Fonts Lato is properly and displayed.

- No <frame>, <iframe>, <video>, <audio>, <track>, <embed>, <object>, <applet>
tags are used in FreedomBox source code.

- Checked that there are no images referring to external URLs. Most of the
common images such as apps lists, system list, networks and manual show images
properly.

- Styles specified in main.css work as well as page specific styles such as in
networks. Firefox developer console shows inline styles loaded.

- JSXC is able to make XHR requests to ejabberd.

- Able to launch <a> links with _target='blank' such as in /help/support/.

- When visiting external websites, such as in donate page, Referer header is not
sent. When visiting page within FreedomBox interface, Referer header is sent
with path.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
2020-06-29 10:09:36 +03:00
Sunil Mohan Adapa
384c34bb3f
*: Drop files paths in data/var
data/var/log and data/var/run were not being used for a while.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2020-06-28 21:02:07 -04:00
Sunil Mohan Adapa
9def9750c0
frontpage: Drop empty custom shortcut files
Installing an empty file in /etc/ that is meant to be modified is an unnecessary
invitation to upgrade issues.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2020-06-28 21:01:20 -04:00
Sunil Mohan Adapa
4263f9e2c8
cfg: Drop the default configuration file
- The configuration module defaults to values in the production configuration
file.

- If the file is found, it is read and the read values overwrite the defaults.
If the file is not found, no error is raised. This allows us to not ship the
configuration file. User may create the configuration if they want to change the
defaults. This eases upgrades when configuration is edited. This also make
FreedomBox robust to deployments where /etc/ is not populated by default such as
OSTree. It is also a good practice for daemons as followed by the likes of
systemd.

- If the file partly populated only the values read override the defaults and
the remaining values don't change. This allows the user to write simpler
configuration file.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2020-06-28 21:01:15 -04:00
James Valleroy
941142f241
data: Print hostname and IP addresses before console login
- Incorporate changes proposed by Sunil.

Closes freedom-maker#60.

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
2020-05-03 08:08:01 -04:00
Sunil Mohan Adapa
172f5f3160
debian: Separate binary packages for each language manual
- When there are multiple binary packages, a common practice is to install into
  debian/tmp using the Makefile and then use dh_install and .install files. This
  splits the contents installed into debian/tmp to various package directories
  debian/{package}.

- Install documentation in to /usr/share/freedombox instead of
  /usr/share/doc/freedombox. Then create a link to /usr/share/doc/freedombox/.
  This approach is recommended Debian Policy Manual in section 12.3[1] because
  it should safe for administrator to delete files in /usr/share/doc safely
  without breaking the application functionality. The doc-base must refer to the
  documentation in /usr/share/doc as per doc-base documentation.

Links

1) https://www.debian.org/doc/debian-policy/ch-docs.html#additional-documentation

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2020-03-25 17:52:22 -04:00
Sunil Mohan Adapa
365c29ba1a
*: Update remaining misc files to use SPDX license identifier
None of the files are installed into /etc/. They will unconditionally override
older versions of themselves. They are not likely to cause any configuration
file prompts.

Reviewed-by: Veiko Aasa <veiko17@disroot.org>
2020-02-19 14:40:32 +02:00
Sunil Mohan Adapa
cff9a61f09
pagekite: Remove first wizard step for danube edition
- The code was never used by end users.

- The code was expected to be used long back but the plans didn't materialize.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-10-02 17:21:39 -04:00
Nikolas Nyby
d2e987ef3c
Fix a handful of typos in docs and comments
Found with [codespell](https://github.com/codespell-project/codespell/)

Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-07-24 12:39:11 -07:00
Sunil Mohan Adapa
d205455cda
dbus: Allow plinth user to own FreedomBox DBus service
Without this fix, the daemon plinth will not able to acquire a DBus connection
and listen for the FreedomBox DBus service when running as user plinth user.
This is the case for production FreedomBox machines.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-07-09 19:40:04 -04:00
Sunil Mohan Adapa
463c620c65
backups: Remove known_hosts file from config file
- There is no compelling reason to make the file configurable. Simplifies
  configuration file if we make it relative to FreedomBox data directory.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
2019-07-03 12:44:34 +05:30
Joseph Nuthalapati
2c97e1e02e
backups: Read file path of known_hosts directly from plinth.config
Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
2019-07-03 12:43:02 +05:30
Sunil Mohan Adapa
c35938e180
apache: Serve SVG files compressed using gzip
- SVG is not one of the formats for which compress is turned on automatically by
  Apache configuration.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-05-16 06:42:01 -04:00
Sunil Mohan Adapa
d76526dbb6
setup: Remove unused /var/run directory
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-03-17 16:21:00 -04: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
Joseph Nuthalapati
530423d490
config: Revert changes in freedombox.conf to avoid conffile prompt
The changes made to freedombox.conf in moving the apache homepage configuration
to an external file freedombox-apache-homepage.conf will cause a conffile prompt
when upgrading to freedombox 19.2. Reverting changes in freedombox.conf to avoid
this.

Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-03-01 13:22:32 -08:00
Joseph Nuthalapati
241d3a98d5
Disable Coquelicot for Buster release
As confirmed by multiple users, Coquelicot is no longer useful for uploading
files, which makes it useless as a file sharing application.

We might enable it in the future if it's actively maintained once again, or find
an alternative.

- Skip functional tests

- Disable modules-enabled file

Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-02-28 18:34:14 -05:00
Sunil Mohan Adapa
2df02b059c
dbus: Add new module for D-Bus services
- Implement listening for CacheUpdated notification.

- Configuration to allow only root to trigger the notification.

- Trigger the notification from an apt update hook.

- Retrieve the list of packages available for upgrade and print them to log.

- Add dependency on libglib2.0-bin for the gdbus command line tool.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-02-26 06:24:05 -05:00
Joseph Nuthalapati
bd43ed515e
config: Remove Apache home page configuration from freedombox.conf
Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-02-23 10:31:05 -05:00
Joseph Nuthalapati
8bc34f84c3
config: Rename Default App to Webserver Home Page
Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-02-23 10:30:59 -05:00
Sunil Mohan Adapa
91f68cc7b5
mldonkey: Enable app
- Problems with stopping the daemon have been solved.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-02-09 13:31:59 -05:00
Sunil Mohan Adapa
2b45a8cff9
mldonkey: Add systemd service file with security options
- This solves the problem with init that causes the daemon not to stop.

- The file is installed with same name as init script so as to make sure init
  script become overridden.

- It is installed in /lib/systemd/system/mldonkey-server.service.d/ so
  that this service file can one day be upstreamed and at that time it
  does not conflict with freedombox package carrying the same file.

- Add strict security options.

- Tested by watching mldonkey logs, doing some searching and downloading from
  the UI.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-02-09 13:31:51 -05:00
Sunil Mohan Adapa
e36a4b85ee
apache: Add support for mod_ssl in addition to mod_gnutls
Depending on which module is enabled, different configuration is used.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-02-09 12:28:06 -05:00
Sunil Mohan Adapa
511f5c09c0
apache: Cleanup domain configuration
- Don't set log level explicitly. Fallback to value set in global Apache
  configuration.

- Don't set directory options already set in global configuration.

- Remove /cgi-bin/. Only ikiwiki uses cgi and it is served from a different path
  than /usr/lib/cgi-bin.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-02-09 12:28:03 -05:00
Sunil Mohan Adapa
5a159f7d39
upgrades: Improve handling of backports
- Merge backports functionality into upgrades module.

- No need to enable systemd timer as dh_installsystemd automatically enables
  this during package installation and upgrade.

- Use https:// and deb.debian.org for repository checking. When using Tor for
  package installations request the URL via Tor.

- Make daily checking service more generic for all kind of future apt repository
  updates.

- Force removal of repository file during purge to avoid failures.

- Don't add contrib/non-free as backports is intended to be enabled for just the
  freedombox package and it is free. When the need arises, we can introduce
  contrib/non-free. This also eliminates an issue that adding these components
  doesn't work without the usage of tor.

- Allow generate apt preferences file to avoid lintian complaining about its
  presence. Remove on purge.

- Add unattended upgrades origin pattern to allow it to upgrade from backports
  repositories.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-02-05 14:58:55 -08:00
Joseph Nuthalapati
3d38b8a686
backports: Add buster-backports to apt sources list
Fixes freedombox-team/freedom-maker#149

Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-02-05 14:58:27 -08:00
Prachi Srivastava
b1c8c22b92
repro: Disable app due to issues with Debian package
Signed-off-by: Prachi Srivastava <prachi.chs.2009@gmail.com>
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-02-04 10:07:17 -08:00
Sunil Mohan Adapa
dc9ab52edc
axes: Minor fixes to configuration for IP blocking
- Use the X-Forwarded-For header only if specified in the configuration. This
  makes FreedomBox safe to use when not behind a reverse proxy server (although
  we are unlikely to do this).

- When fetching the IP address to reset after successful login, use the
  X-Forwarded-For header only if specified in the configuration.

- Minor flake8 refactorings.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-01-28 17:17:32 -05:00
Sunil Mohan Adapa
dfd46281c5
Serve default favicon for apps that don't provide one
Based on: https://salsa.debian.org/freedombox-team/plinth/merge_requests/1306

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-01-26 20:23:16 -08:00
Sunil Mohan Adapa
9295914a6c
mldonkey: Disable app due to bug during restart
See:

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=920466
https://salsa.debian.org/ocaml-team/mldonkey/merge_requests/1

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-01-25 14:39:35 -08:00
Sunil Mohan Adapa
260dcd4d32
mldonkey: Update description and minor updates
- Update description to simply and talk about multiple protocols supported.

- Don't diagnose on IPv6 as mldonkey does not listen there.

- Run yapf and isort.

- Minor styling fixes.

- Update functional tests to check for service running.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-01-25 14:39:31 -08:00
J. Carlos Romero
548c6b98f3
mldonkey: Add new module for the eDonkey network
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-01-25 14:39:10 -08:00
Sunil Mohan Adapa
f113a3bfc9
fail2ban: Split and update configuration files
- Easy to configure for separate services.

- Unique names ensure that system administrator FreedomBox configuration files
  don't conflict with system administrator created ones.

- Set maximum attempts to 10 globally instead of 5.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-01-24 14:20:27 -08:00
Prachi Srivastava
760fa77b70
fail2ban: Enable bans for apache auth failures
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-01-24 13:41:09 -08:00
James Valleroy
72b59c0190
radicale: Switch to uwsgi for radicale 2.x
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
2019-01-14 19:51:21 -05:00
Sunil Mohan Adapa
8dbf73d3f5
syncthing: Use exact matches when enforcing trailing '/'
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-01-06 17:58:10 -05:00
Sunil Mohan Adapa
7cf279ccd0
radicale: Redirect to well-known URLs according to version
- Radicale 1 needs to have /radicale/.well-known/*dav to the URLs where as
  Radicale 2 needs to have /radicale to be the URLs. Hence have two separate
  apache configuration files.

- Use expr= when setting X-REMOTE-USER header to set the authenticated user name
  properly. Without this all users are using a single user '(null)' data.

Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-01-06 17:58:00 -05:00
James Valleroy
49acfa5ad1
radicale: Add support for radicale 2.x
- Remove obsolete base_prefix and well-known configs.
- Use http_x_remote_user auth type.
- Rewrite /radicale to /radicale/.
- Add ProxyPassReverse.
- Set X-Script-Name and X-Remote-User request headers.

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
2019-01-06 17:57:56 -05:00
Sunil Mohan Adapa
5f8965df25
debian: Rename plinth package to freedombox
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2018-12-31 15:59:08 -05:00
Sunil Mohan Adapa
2e8d28c7f8
Move update-motd script from freedombox-setup
Significant re-indentation due to yapf.

Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2018-12-31 15:58:22 -05:00
Sunil Mohan Adapa
dfd9a7a298
sudoers: Allow all admin users to become superusers
- Migrated settings from freedombox-setup.

Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2018-12-31 15:58:16 -05:00
Sunil Mohan Adapa
35c70861dc
logging: Remove references to old log files
- Remove access/error log references in configuration files and tests.

- Ensure that /var/log/plinth directory is not created anymore.

Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2018-12-30 13:45:23 -05:00
Sunil Mohan Adapa
f1d475bb4e
letsencrypt: Remove outdated Apache configuration
No need to have explicit configuration to allow all requests. This is the
default.

Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2018-12-26 09:20:16 -05:00
Sunil Mohan Adapa
91ba56e3ce
letsencrypt: Use macros for configuring sites
Makes it trivial to alter site configuration for all domains at once. Also
possible to easily switch to TLS modules other than mod_gnutls.

Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2018-12-26 09:20:05 -05:00
Sunil Mohan Adapa
a48471680d
sso: Update outdated Apache configuration
Use Require instead of Deny directive.

Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2018-12-26 09:19:56 -05:00
Sunil Mohan Adapa
5076488c7f
searx: Update outdated Apache configuration
- Avoid Satisfy and Allow which are deprecated.

- Make sure the redirection rule applies only to the URL intended.

- Fix issue with Proxy matching of URLs.

Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2018-12-26 09:19:41 -05:00