When private mode is turned on and off, a setting to allow anonymous editing is
being written. This turns on anonymous editing on the wiki. To fix, drop the
code that adds anonymous editing line and implement migration from older
settings to newer settings.
Closes: #1783.
Tests performed:
- Install mediawiki with current master. Private mode is disabled by default.
Anonymous users can't edit. There is a line for editing set to false in
FreedomBoxSettings.php configuration file. Switch to latest code. The line
should be removed. private mode is still disabled. Anonymous users should not be
able to edit the wiki.
- Install mediawiki with current master. Enable private mode. Anonymous users
can't edit, login is required to view wiki. There is a line for editing set to
false in FreedomBoxSettings.php configuration file. Switch to latest code. The
line should be removed. private mode is still enabled. Anonymous users should
not be able to edit the wiki. Login is required to view the wiki.
- Install mediawiki with current master. Enable private mode and disable it.
Anonymous users can edit the wiki. There is a line for editing set to true in
FreedomBoxSettings.php configuration file. Switch to latest code. The line
should be removed. private mode is still disabled. Anonymous users should not be
able to edit the wiki but they can read the wiki.
- Install mediawiki with the changes in the branch. Line for editing the wiki is
not present in FreedomBoxSettings.php configuration file. Enabling/disabling the
private mode does not introduce the line either. When private mode is enabled,
login is required to read/edit the wiki. When it is disabled, anonymous users
can read the wiki but not edit it.
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
If the app is disabled and configuration is edited, don't start the daemon.
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Nektarios Katakis <iam@nektarioskatakis.xyz>
Commit 50e5608331330b37c0b9cce846e34ccc193d1b0d incorrectly sets the
StateDirectory without setting DynamicUser. Buster's shadowsocks will then
create directory /var/lib/shadowsocks-libev/freedombox/ and refuse to delete it
in later versions when DynamicUser=yes needs it to be a symlink.
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Nektarios Katakis <iam@nektarioskatakis.xyz>
- Reduce password length to encourage users to use the auto-generated one
instead of setting a new one.
- Don't set mode to tcp_and_udp: 1) upstream default to TCP only, leave the
decision to upstream. 2) firewalld service file only allows TCP. Without editing
the firewalld configuration, this change is incorrect.
- Don't set timeout. This values matches with the upstream default.. Leave this
to upstream.
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Nektarios Katakis <iam@nektarioskatakis.xyz>
- Ensure that /var/lib/private/shadowsocks-libev/freedombox always exists. This
fixes not being able to save configuration after setup on fresh Buster installs.
- Merge migration path from version 1 to 2 into setup process in an idempotent
way.
- Always creating an initial configuration file so that daemon starts soon after
install. Set a default random password. Localhost as default server.
Closes: #1792
Signed-off-by: Nektarios Katakis <iam@nektarioskatakis.xyz>
[sunil: Minor indentation, update commit message]
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
- Don't ship the file preferences file as this is a violation of the Debian
policy. Lintian throws a hard error that can't be overridden. Remove the lintian
override. Remove this file using maintainer scripts when upgrading from all
version below 20.5.
- The preferences file is now renamed to 50freedombox4.pref.
- Instead write the file when the app is getting setup (on each new version).
- Don't run the setup code on daily timer, instead run the code when the app
upgrades. This ensures that as soon as freedombox package is upgraded and run,
the new preferences file is created instead of waiting for the daily timer to
run.
- From now on when the preferences change, we will increment the version number
of the upgrades app. Change the setup() for the app so that it does not
re-enable automatic upgrades every time setup() is run.
Closes: #1673.
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
- Change in any of the following is treated as unique: protocol, frontend port,
subdomains.
- Change in any of the following is not treated as unique: backend port.
Issue reported in
https://salsa.debian.org/freedombox-team/plinth/-/merge_requests/1742#note_147960
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
When app is disabled with older code, 'abort_not_configured' is present in the
configuration file. Wipe it when re-enabling with newer code.
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
- Turn some methods in action script to private to improve abstraction.
- Always enable the predefined services when setting the configuration for the
first time.
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
- Simplifies the form submission code.
- When service is disabled, don't add the abort_not_configured configuration
flag. There is not need to change the configuration as disabling the daemon from
running is reliable enough.
- When the configuration is set for the first time, drop the
abort_not_configured flag and don't ever add it back.
- Set default values properly for frontend fields when no value is supplied.
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
- Merge actions is-disabled, get-frontend, get-kite and get-services into
get-config. This improves the initial startup time for FreedomBox service and
also the page load time for pagekite app. This also significantly simplifies the
code.
- Only use the pagekite service enabled status determine if pagekite is enabled.
Don't use the configuration setting.
- For custom services, provide additional data such as display URL from
get-config action. This removes the need for additional processing
prepare_service_for_display() and template tag create_pagekite_service_url.
- Also reduce the number of times configuration is retrieved to 1 when loading
the app view page and during startup of FreedomBox service.
- Ensure that all keys of the configuration always present and use that to
simplify some code.
- Remove ContextMixin from view DeleteServiceView that does not need it. Use
AppView and drop ContextMixin.
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
- Action script:
- must not be root when validating directory
- return only first validation error
- Directory selection form, transmission, deluge:
show the download path as it is in the configuration,
the path is resolved only on form submit.
- Tests: add relative path checks, refactor parametrize code
Signed-off-by: Veiko Aasa <veiko17@disroot.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
Shadowsocks is unable to read its own configuration file because it
doesn't have read permissions to the file.
Signed-off-by: Joseph Nuthalapati <njoseph@riseup.net>
[jvalleroy: Add comment about security concerns]
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
Closes: #1779.
Wait until configuration files are created the deluge services.
- Deluged service on Debian Stable creates the core configuration file after
first exit. The version on Debian Testing creates the configuration file during
first run.
- deluge-web seems to create web.conf on first run.
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
- Significantly reduce the time taken to perform the operations in the following
cases:
- Enable/disable an app
- list services in firewall page
- Load app page when interfaces belonging to internal zone need to shown
- First run setup of FreedomBox
- Install a polkit local authority configuration file to allow FreedomBox
service to perform: information queries and configuration changes.
- Drop unused actions.
- Alter the template for showing firewall port information since port/protocol
pairs are no longer pre-formatted.
- Handle errors when trying to get ports details of an unknown service.
Tests performed:
- Enable/disable an app. Ensure with firewall-cmd that ports are added/removed
properly.
- Temporarily modify code to call add_service() and remove_service() twice in a
row. Perform enable/disable operations and ensure that there are not error
thrown to test that add/remove services operations are idempotent.
- Visit the firewalld page and see the current state is reflected properly.
- Visit an app that shows the list of interfaces in firewall zone. Internal
interfaces should be listed properly.
- Reset the installed version of firewall app and disable all firewall services.
Start FreedomBox and ensure that when setup is re-run, default ports (http,
https, dns and dhcp) are opened properly. Run again but with ports already
enabled to check that the setup operation is idempotent.
- Visit diagnostics of an app that uses firewall components and see that ports
are listed properly in the port diagnostic test result.
- Remove some needed services such as those in /etc/firewalld/services and try
to visit the firewalld page. The page should show blank details against the
affected services.
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
Additional ')' got accidentally inserted into the augeas path to be read during
a commit for routine styling (ed646d84a51ae2c54ed7950ce60cb9e9662ada71).
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
- The Debian package doesn't ship a gzip compressed settings file anymore.
- Tested both the cases - settings.yml.gz and settings.yml
Signed-off-by: Joseph Nuthalapati <njoseph@riseup.net>
[sunil: Create parent directory before simple copy of settings.yml]
[sunil: Use pathlib for simpler code]
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
- 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>
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>
- 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>
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>
- 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>
- 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>
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>
- 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>