783 Commits

Author SHA1 Message Date
James Valleroy
abdcbd3f65
security: Drop PrivateUsers=yes from all service files
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2020-02-09 18:48:22 -08:00
Veiko Aasa
9d653d87ec
storage: Make external disk mounts accessible by other users
- samba app doesn't need anymore to change mount permissions

Fixes #1692 (in a different way)

Signed-off-by: Veiko Aasa <veiko17@disroot.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2020-01-26 07:32:04 -05:00
Veiko Aasa
420e3846a0
deluge: Fix installation failure on slow machine
Deluge setup now waits longer after first startup to make sure services
are fully started.

Fixes #1764

Signed-off-by: Veiko Aasa <veiko17@disroot.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2020-01-25 18:33:05 -05:00
Veiko Aasa
8e698987de
deluge: Allow to set a download directory
- add directory selection form to the app configuration page
- add debian-deluged user to the freedombox-share group
- storage: new validator parameter check-creatable
  (because deluged is able to create subdirectories)

Signed-off-by: Veiko Aasa <veiko17@disroot.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2020-01-25 18:27:11 -05:00
James Valleroy
21ba450484
repro: Remove app
The repro app has been disabled for a long time. Its package has been
removed from Debian, and there is no sign of it returning soon.

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
2020-01-18 20:00:43 -05:00
Sunil Mohan Adapa
6e1b0a3642
wireguard: Handle client connections through network manager
- Any changes done directly using 'wg' command need to be redone after a reboot
  and disable/enable sequence. Let that duty be handled by network manager.

- Handle (none) values for keys and 0 values for latest handshake from 'wg'
  dump command output.

- Don't store public/private keys for wireguard in /var/lib. Let Network Manager
  deal with the storage of secrets.

- Create client connections in the 'external' zone.

- Show allowed IPs for each client in the main page.

- Show server connection public key only for clients. We use different key pairs
  when connecting to each of the servers.

- Separate out configuration information and status information in the show
  page.

- Allocate IP addresses to each of the clients.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2020-01-18 13:53:35 -05:00
Sunil Mohan Adapa
71c7ab4a9d
wireguard: Only use network manager for connections to servers
- Don't create network link. This don't persist across reboots and it is the job
  of Network Manager.

- Move NM settings code to regular plinth process instead of superuser.
  Permission for managing NM connections from the service daemon is granted by
  PolKit.

- Use interface name to identify the connection as it seems to be simply to do
  so than the public key. Public key is not easy to retrieve from NM connection.

- Merge code for adding and editing the connection to avoid repetition.

- Add icon to the edit button.

- Throw 404 error when incorrect client is specified.

- Fix issue with storing preshared key.

- Show formatting date in case of last connected time.

- Show formatted sizes for data transmitted.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2020-01-18 13:53:31 -05:00
Sunil Mohan Adapa
9242a9404f
wireguard: Add ability to set private key in client addition
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2020-01-18 13:53:24 -05:00
Sunil Mohan Adapa
ad53848983
wireguard: Don't error out when wg0 server is not setup
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2020-01-18 13:53:21 -05:00
Sunil Mohan Adapa
fe182a0faa
wireguard: Cosmetic fixes by yapf and isort
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2020-01-18 13:53:19 -05:00
James Valleroy
0bef87579f
wireguard: Replace nmcli use with libnm
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2020-01-18 13:53:15 -05:00
James Valleroy
b0855dad91
wireguard: Use network API to handle connections
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
[sunil: Use the new method for creating network manager client instance]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2020-01-18 13:53:10 -05:00
James Valleroy
a0ea33d9b6
wireguard: Make setup idempotent
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2020-01-18 13:53:05 -05:00
James Valleroy
aa66a9135c
wireguard: Add views for editing and deleting clients and servers
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2020-01-18 13:53:03 -05:00
James Valleroy
9eb546df26
wireguard: Refactor actions file
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2020-01-18 13:53:00 -05:00
James Valleroy
64165c5fbd
wireguard: Create network manager connection
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2020-01-18 13:52:56 -05:00
James Valleroy
87a58f1491
wireguard: Generate key pair
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2020-01-18 13:52:52 -05:00
James Valleroy
966b179756
wireguard: Add server information view
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2020-01-18 13:52:50 -05:00
James Valleroy
36fdedb9a7
wireguard: List peers in client section
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2020-01-18 13:52:48 -05:00
James Valleroy
901f89f393
wireguard: Form to add server
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2020-01-18 13:52:46 -05:00
James Valleroy
5d287ce579
wireguard: Add client info view
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2020-01-18 13:52:44 -05:00
James Valleroy
415e1eb4ba
wireguard: Allow deleting a client
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2020-01-18 13:52:42 -05:00
James Valleroy
e00c28f36e
wireguard: Show list of added clients
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2020-01-18 13:52:40 -05:00
James Valleroy
aa02f4d710
wireguard: Implement adding client
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2020-01-18 13:52:38 -05:00
Veiko Aasa
721e09fee9
deluge: Fix set default daemon
Signed-off-by: Veiko Aasa <veiko17@disroot.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2020-01-12 15:55:52 -05:00
Veiko Aasa
ff27f1d21b
deluge: Manage starting/stoping deluged
- run deluged daemon with default configuration location
- deluge-web: autoconnect to the deluged daemon
- functional tests: assert deluge-web is connected to the deluged daemon

Signed-off-by: Veiko Aasa <veiko17@disroot.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2020-01-12 15:55:49 -05:00
Veiko Aasa
66b57d48cf
samba: Improve actions script startup time
Speedup actions script startup time from 3.6s to 0.45s on
A20-OLinuXino-LIME2 hardware, improve top three slowest imports:
- don't import constant from manifest (saves 2.7s)
- defer importing actions_utils and augeas (saves 0.3s + 0.15s)

Signed-off-by: Veiko Aasa <veiko17@disroot.org>
Reviewed-by: Joseph Nuthalapati <njoseph@riseup.net>
2020-01-10 10:42:56 +05:30
Sunil Mohan Adapa
394588538e
openvpn: Enable IPv6 for server and client outside the tunnel
This enables clients to connect to servers on IPv6 networks. After the
connection, the tunnel works just like before.

- Make sure that after upgrading the server configuration, if the server is
  running (which means it was enabled), restart the server to reflect the new
  configuration.

- Don't increment the app version number as it has already been incremented in
  this release cycle.

Tests:

- Check that the listen address before the change is 0.0.0.0:1194 and after
  upgrade (temporarily increment app version number again) the listen address
  automatically changes to *:1194.

- Download the new client profile and use it connect to the server on IPv4
  network and observe that there is error during connection.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2020-01-04 14:02:44 -05:00
Sunil Mohan Adapa
57c8bea9a5
storage: Make partition resizing work with parted 3.3
On Raspberry Pi 3B+ image, it was observed that resizing partition fails during
initial setup. Due to this, Apache, SSH and Plinth become unavailable. This is
due newer version of parted 3.3 (Debian testing/unstable) which does not work
with ---pretend-input-tty option as previously expected of parted 3.2 (Debian
buster).

Fix the problem by sending answers to promoted questions via stdin instead of
via command line. This solution works on both versions of parted, i.e., 3.2 and
3.3.

Tests:

- On a freshly built Raspberry Pi 3B+ unstable image the problem is
  reproducible. Running expand partition fails repeatedly.

- Downgrade version of parted to 3.2 observe that the expanding operation runs
  fine. Upgrade to version parted 3.3 again.

- Apply the patch on the action script. Re-run expanding partition and observe
  that the problem is resolved. The version of parted is 3.3.

- Downgrade the version of parted to 3.2. Downsize the partition, re-run
  expanding partition.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2020-01-04 09:08:51 -05:00
Joseph Nuthalapati
cfe014a3f4
mediawiki: Allow admin to set default skin
Fixes #1731

Signed-off-by: Joseph Nuthalapati <njoseph@riseup.net>
[sunil: Refactor getting skins and form field for simplicity]
[sunil: Remove incorrect change to showing success form message]
[sunil: Minor simplification to editing the configuration]
[sunil: Read configuration value enclosed in single as well as double quote]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2020-01-03 16:31:28 -08:00
Nektarios Katakis
018767aaae
openvpn: Enable support for communication among all clients
Closes: #1694

Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2020-01-02 16:54:29 -08:00
Sunil Mohan Adapa
8a4fd1def4
mediawiki: Fix problem with session cache failing logins
Set the session cache to use database. This will also have the added benefit of
sessions persisting across reboots (and PHP session cleanups). See bug report on
why this is needed. https://salsa.debian.org/freedombox-team/plinth/issues/1736

We are unfortunately modifying the MediaWiki settings that file that we are
shipping when preferences are modified in the FreedomBox UI. This means that if
a newer version of this settings file is shipped, then FreedomBox package will
show configuration file prompts. To solve this, introduce a new static settings
file that will have lower priority than the file modified by FreedomBox UI.

Closes: #1736.

Tests:

- Test that running FreedomBox daemon with changes runs the MediaWiki app's
  setup and introduces the new line into LocalSettings.php

- That LocalSettings.php will be populated with lines to include
  FreedomBoxStaticSettings.php and FreedomBoxSettings.php in that order when
  'actions/mediawiki setup' is run. This should work when no lines are present,
  one of the lines is already present and both the lines are already present.

- Test that running './setup.py install' installs FreedomBoxStaticSettings.php.

- Test that MediaWiki runs without FreedomBoxStaticSettings.php

- Test that private wiki and public registrations settings work with the new
  changes.

- Run functional tests for MediaWiki app with the changes.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-12-30 20:38:30 -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
Kunal Mehta
592060e057
mediawiki: Pass --quick when running update.php
By default update.php will pause for 5 seconds before doing anything
to remind the user to make a backup before the script runs. Since we're
running it in a separate process where the user won't get that opportunity
anyways, skip the 5 second delay by passing `--quick`.

Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-12-29 18:09:20 -08:00
James Valleroy
1498a9ae83
infinoted: Use systemd sandboxing features
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-12-29 17:49:07 -08:00
James Valleroy
b4e00d2574
deluge: Use systemd sandboxing features
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
[sunil: Remove directive for unused logs directory]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-12-29 17:48:31 -08:00
Veiko Aasa
aa2aa56c46
users: Add tests for the Samba user database
Fix: after renaming a user delete old username from the Samba password database

Signed-off-by: Veiko Aasa <veiko17@disroot.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-12-29 16:59:04 -05:00
Veiko Aasa
83cb305026
samba: private shares
- new share types - group and home shares
- users: when creating, deleting or changing user password, update also Samba
  tdbsam backend database
- users: new managed packages - samba-common-bin, tdb-tools
- module page: show current samba users who are in freedombox-share group
- module page: show users who should re-enter their password in the password change page
- fix: use os.path.ismount() from Python standard library to validate a mount point
- fix: samba share permissions, fixes #1729
- fix: delete a share - do not raise an exception if the share doesn't exist
- storage: show samba share type in the directory selection form

Closes #1727

Signed-off-by: Veiko Aasa <veiko17@disroot.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-12-20 21:01:12 -05:00
Veiko Aasa
ea48f9a74b
storage: Directory selection form and validator
Directory selection allows to:
- select from default directory
- select from available Samba shares
- specify subdirectory
- insert custom directory

- directory validator checks: path exists, is directory, is readable, is writable
- samba: action script: include share path in share list
- create freedombox-share group inside users module  instead of samba module

Closes #1703

Signed-off-by: Veiko Aasa <veiko17@disroot.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-12-15 19:08:10 -05:00
Nektarios Katakis
4ff037a6cc
mumble: Add option to set SuperUser password
Closes: #1680

Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-12-10 21:13:53 -05:00
James Valleroy
f19a5b746f
minidlna: Use single action to set media dir and restart
Style config path as constant.

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
2019-12-08 14:50:22 -05:00
Nektarios Katakis
b5fb23e448
run sysctl after installation
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-12-08 14:50:16 -05:00
Nektarios Katakis
3614a977f8
fix: minidlna.conf file permissions after editing
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-12-08 14:50:07 -05:00
Nektarios Katakis
ef5f5a21de
feature: minidlna app
Closes #1679

Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-12-08 14:49:21 -05:00
Veiko Aasa
e1f9dfacaa
samba: recursively set open share directory permissions
Signed-off-by: Veiko Aasa <veiko17@disroot.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-12-08 10:45:39 -05:00
Alice Kile
eb83e00011
fix formatting issues
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-12-07 13:08:35 -05:00
Veiko Aasa
d6961426ab
samba: fixes and improvements
Signed-off-by: Veiko Aasa <veiko17@disroot.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-12-01 11:30:43 -05:00
Veiko Aasa
dbdd482e61
samba: fixes and improvements
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-12-01 11:30:35 -05:00
Veiko Aasa
598bcb6fbb
samba: user can select devices for sharing
- show share also if a device is not available
 - use folder Freedombox/shares/open_share for sharing on every disk
 - backup and restore share definitions
 - fix: do not hide status block
 - fix: add nmbd to the managed services

Signed-off-by: Veiko Aasa <veiko17@disroot.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-12-01 11:30:31 -05:00
Veiko Aasa
eaaa764387
samba: Users can enable a guest share
Related to  #1681

Signed-off-by: Veiko Aasa <veiko17@disroot.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-12-01 11:30:25 -05:00