643 Commits

Author SHA1 Message Date
James Valleroy
18f9bc8c28
apache: Disable mod_status
Prevent leaking private info through Tor onion service or Pagekite.

Based on 822c322d20d12f81c6cfca47b66f900542a5aac2.

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
2020-09-21 21:39:47 -04:00
Sunil Mohan Adapa
e448ab6380
matrixsynapse: Better checking for valid certificate
If a valid certificate is available but not yet setup, the earlier code assumes
there is a valid certificate.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-02-13 19:34:04 -08:00
Sunil Mohan Adapa
b169739867
matrixsnapse: Setup certificate after domain selection
Immediately after the installation, a self-signed certificate is used because
domain name is not available. However, after domain name becomes available,
setup a Let's Encrypt certificate.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-02-13 19:00:33 -08:00
Sunil Mohan Adapa
3b257c7a58
matrixsynapse: Fix potential exposure of private key
Setting permissions after copying the file will lead to momentary exposure of
the private key to other users on the system. Use umask instead.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-02-13 17:52:49 -08:00
Sunil Mohan Adapa
b53f675f55
matrixsynapse: Don't check for current domain in renew hook
Don't match the hook's domain against domain set in configuration. We already
check if the domain matches the Matrix Synapse configured domain.

- Fix un-checking letsencrypt option for matrixsynapse. Keep the old certificate
  but don't throw error. This means future certificates are not renewed.

- Use utility get_configured_domain_name()

- Style function names without uppercase.

- Style multi-line docstrings correctly.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-02-13 17:14:08 -08:00
Joseph Nuthalapati
a918f9a885
matrix-synapse: Use Let's Encrypt certificates
Matrix requires valid certificates for federation with other servers from
version 1.0 onward. If the FreedomBox server already has LE cert and private
key, copy them into /etc/matrix-synapse

- Add certificate renewal hooks for Matrix Synapse. Reusing the certificate
  renewal mechanism built for ejabberd with matrix-synapse as well. One notable
  difference is that Matrix Synapse doesn't support switching the domain name or
  dropping the Let's Encrypt certificate.

- Use self-signed certificate if there is no LE certificate. Matrix Synapse
  server startup fails if the files homeserver.tls.crt and homeserver.tls.key
  are missing.

- Copy Apache's snakeoil certificates to /etc/matrix-synapse when LE
  certificates are not available. Prefer LE certificates if available.

- Display warning if no valid LE certificate is found.

Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
2019-02-13 11:29:36 -08:00
Sunil Mohan Adapa
a821517e91
radicale: Simplify upgrading to newer packages
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-02-13 06:42:55 -05:00
Sunil Mohan Adapa
920d083301
setup: Add option to handle configuration prompts during install
This is optional and does not affect normal installations. However, when
performing configuration migration in FreedomBox (due to unattended-upgrades
refusing it), it is useful as a part of strategy to read configuration, force
install new configuration files and apply configuration again. This option can
be used on such cases.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-02-13 06:42:50 -05:00
Sunil Mohan Adapa
67451248eb
upgrades: Fix premature adding of buster-backports sources
It is incorrect to check for backports availability, FreedomBox systems got
added buster-backports sources prematurely. This will lead to apt update
failures resulting in FreedomBox becoming unable to install new apps.

Fix this by removing old sources and adding new sources only after
performing (this time correct) backports URL check.

Closes: #1496.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-02-09 19:36:03 -05:00
Sunil Mohan Adapa
e2f2d337c7
upgrades: Fix priority for buster-backports version
If we release version 50 into testing and version 49 into buster-backports and
assuming version 45 is in stable, then for stable users, version 49 is selected
properly and upgraded due non-availability of 50 for them and high
prioritization of buster-backports over buster/stable. This is as expected.

For the case of testing user, this does not work as expected, however.
buster-backports will be given 800 priority, testing will be given 500
priority (default) and version 49 will be picked instead of the expected 50.

Setting priority to 500 fixes the problem. It will equate the buster-backports
to all other repositories and will let the system pick the highest version
available.

Closes: #1498.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-02-09 19:36:00 -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
Sunil Mohan Adapa
f9a57e4293
monkeysphere: Fix regression with reading new apache domain config
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-02-09 12:28:01 -05:00
Sunil Mohan Adapa
49640fdfce
monkeysphere: Fix handling of multiple domains and keys
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-02-09 12:27:57 -05:00
Sunil Mohan Adapa
2e112d751c
backups: Minor styling fixes
- Ran yapf

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-02-07 19:12:12 -05:00
Sunil Mohan Adapa
5e38b169b9
backups: Increase timeout for SSH operations to 30 seconds
It is easy to run into cases where SSH mounting takes more than 5 seconds.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-02-07 19:12:08 -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
James Valleroy
9aa48091df
radicale: Handle data migration for upgrade to 2.x
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-02-03 22:59:52 -08:00
Sunil Mohan Adapa
01492895c4
backups: Fix incomplete download archives
- Downloaded archives can't be fully extracted as tar.gz is incomplete at the
  end and corrupt. This is due to complete gzip streaming implementation that is
  does not flush the final bytes of gzip stream. Remove custom implementation
  and get gzipped stream directly from borg.

- Fix mimetype for .tar.gz to application/gzip.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-02-03 17:00:32 -05:00
Sunil Mohan Adapa
eb2b3bd86e
backups: Minor refactoring
- Mark some methods private.

- Fix some flake8 warnings.

- Remove unused exception.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-02-03 17:00:29 -05:00
Sunil Mohan Adapa
de22c79665
backups: Minor styling fixes
- Run yapf

- Fix flake8 errors/warnings.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-02-03 17:00:24 -05:00
James Valleroy
3941ec10fe
radicale: Handle migration from 1.x to 2.x
When radicale 2.x is available in testing, the migration can be
triggered by bumping the module's version.

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-02-01 14:53:19 -08:00
Sunil Mohan Adapa
c400c21e88
infinoted: Wait for upto 5 minutes to kill daemon
Closes #1442.

When disk is very busy, sending KILL signal to the process may not kill it
immediately. So wait upto 5 minutes for it. This does not increase the time in a
regular case if the kill works immediately.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-01-28 18:03:49 -05:00
Sunil Mohan Adapa
f6d3af15ec
help: Minor refactoring in get-logs action
- Make command line arguments more readable.

- Don't collect and reprint the logs. Let them be printed directly.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-01-28 10:13:54 -08:00
James Valleroy
5a8873508d
help: Add action script to read logs from journal
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-01-28 09:56:59 -08:00
Sunil Mohan Adapa
1d42081c62
radicale: Fix issue with configuration changes not applying
With newer version of radicale (>2.1), when configuration is changed, it is not
applied until the application is disabled and re-enabled.

Also make sure that configuration changes don't start a daemon when it is
disabled.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-01-27 00:15:44 -08:00
James Valleroy
24f1967b6a
radicale: Use rights file by default for radicale 2.x
The default rights file shipped in radicale 2.x package is equivalent
to owner_only. By setting this as our default, we can avoid any change
to the default config.

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-01-26 22:06:49 -08:00
James Valleroy
bb29e0932e
radicale: Don't change auth type for radicale 2.x
The default, remote_user, works ok when using uwsgi.

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-01-26 22:06:41 -08:00
James Valleroy
15094525b1
radicale: Only set hosts for radicale 1.x
Not used with uwsgi, which is enabled for radicale 2.x.

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-01-26 22:06:21 -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
Joseph Nuthalapati
bacc2bcb21
matrix-synapse: Use '::' as the IPv6 bind address
Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-01-23 13:02:58 -08:00
Joseph Nuthalapati
b2c6112990
matrix-synapse: Fix startup error caused by bind_address setting
- Drop the `bind_address` key during upgrade
- Use the new `bind_addresses` key instead

Fixes #1420

Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-01-23 13:02:55 -08:00
James Valleroy
75d6b667ba
radicale: Create collections folder before starting uwsgi
Workaround for https://bugs.debian.org/919339

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
2019-01-14 20:32:44 -05:00
Sunil Mohan Adapa
3e98930f94
radicale: Don't keep radicale service running
- uwsgi service is sufficient to handle radicale2. Disable radicale service for
  radicale2.

- Use action utils to deal with uwsgi configuration management.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-01-14 19:51:34 -05:00
Sunil Mohan Adapa
bed43564c3
searx: Use action utils for uwsgi configuration management
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-01-14 19:51:30 -05: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
2c51165f99
firewalld: Flush iptables rules before restarting firewall
This is a workaround for the problem that when restarting firewalld with
iptables backend, flushing fails and starting with nftables also fails requiring
a restart to recover the problem.

Fixes #1440.

Reviewed-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
2019-01-11 23:16:15 +05:30
Sunil Mohan Adapa
12ea72eb0a
snapshot: Refactor configuration migration
- Only do the configuration based on version run the remaining setup code
  without considering version.

- Don't force upgrade/setup configuration when doing from version 4 and above.

- Force set cleanup=yes values during migration too.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-01-08 14:01:34 -08:00
Joseph Nuthalapati
4fdd68cb3b
snapshot: Merge the functionality of the migrate command into setup
- Added a command-line argument called --old-version to the setup command based
  on which it can decide whether to do a new setup or a migration.
- Removed the migrate command.

Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-01-08 13:59:56 -08:00
Joseph Nuthalapati
ad049af276
snapshot: Enable TIMELINE_CLEANUP and NUMBER_CLEANUP by default
Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-01-08 13:59:30 -08:00
Joseph Nuthalapati
f68070c758
snapshot: ui: Remove NUMBER_MIN_AGE setting and add FREE_LIMIT
The free space limit value is allowed to a maximum of 60%, since setting the
it to a value higher than possible will effectively disable snapshotting.

Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org
2019-01-08 13:59:15 -08:00
Joseph Nuthalapati
8ba0bda869
snapshot: Fix snapshots filling up the disk
- Snapper's cleanup algorithms don't apply limits unless they are specified in
the form of ranges. Changed all limit values in the configuration to ranges.
- Also, all MIN_AGE values have been set to 0 to avoid the disk space filling up
in case of a large number of snapshots generated in a very short amount of time.
- FREE_LIMIT has been increased to 30% from the default 20% since backup
archives also take up disk space on the root partition.

Fixes #1435

Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-01-08 13:57:46 -08: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
James Valleroy
1b4d42cd53
radicale: Don't modify default file for radicale >= 2.1.10
/etc/default/radicale is not used in radicale 2.1.10-1 and later.

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
2019-01-06 17:57:50 -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
Michael Pimmer
bb95229a91
Backups: unittests for accessing repository with borg directly
- adapt action and write tests for accessing a borg repo directly
  via borg+ssh, without mounting it
- some docstring updates

Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2018-12-13 18:28:51 -05:00
Michael Pimmer
fc9e406bf8
Backups: allow using keyfile as credentials for sshfs mounts
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2018-12-13 18:28:44 -05:00
Michael Pimmer
3724dac9e6
Backups: Cleanup and improved error handling
- fixes issues as supposed by jvalleroy
- new repositories always get a UUID so they can immediately be fully
  used (mounted, queried etc) also before saving them
- remove test connection page -- errors are shown on form submission
- improved error handling when creating remote repositories

Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2018-12-13 18:28:24 -05:00