2704 Commits

Author SHA1 Message Date
Sunil Mohan Adapa
bfa11beb73
*: pylint: Don't inherit from 'object'
- This was required in Python 2 but useless in Python 3.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2022-07-04 19:46:15 -04:00
Sunil Mohan Adapa
3c7bc4a192
*: pylint: Explicitly specify encoding when open a file
This is recommended by PEP-0597: https://peps.python.org/pep-0597/

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2022-07-04 19:45:57 -04:00
Guillermo Lopez Alejos
957ddf5a2d
backups: Unmount repositories before and after backup
[sunil: Make the umount code specific to SSH repositories]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2022-06-30 15:31:16 -07:00
nbenedek
35b50a2c71
users: create home directories for newly created users
Test I made: Created a few users, then appied the changes
and rebooted FreedomBox. After reboot I created another user
whose home directory could now be listed.

Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2022-06-30 09:07:52 -07:00
nbenedek
0d37809eb8
mediawiki: Add regex validator to the domain field
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2022-06-29 13:01:37 -07:00
nbenedek
26f576bb79
mediawiki: Remove wgLogo as it is not needed in Bullseye
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2022-06-29 09:29:37 -07:00
Sunil Mohan Adapa
696a876df4
mumble: tests: Add functional tests for setting the passwords
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2022-06-24 08:41:57 -04:00
Sunil Mohan Adapa
c772534a35
mumble: Don't set the root channel name unless it is changed
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2022-06-24 08:41:50 -04:00
Sunil Mohan Adapa
f8b4aa9d6f
mumble: Backup/restore the configuration file
This allows the root channel name to be preserved as expected.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2022-06-24 08:41:42 -04:00
Sunil Mohan Adapa
7470821dc7
mumble: Use privileged decorator for superuser actions
- Don't use command line argument for sending the join password for security.

- murmurd can switch to mumble-server UID before performing database operations.
Remove code to switch to mumble-server user.

- murmurd seems to return correct response code of 0 upon successfully setting
the password. Simplify code accordingly.

- Use subprocess.run() instead of subprocess.Popen for convenience.

Tests:

- Run functional and unit tests on Debian stable.

- Perform a fresh installation.

- Verify that setting super user password works.

- Verify that setting root channel names works.

- Verify that setting join password works.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2022-06-24 08:41:23 -04:00
Sunil Mohan Adapa
a55e63b7f4
matrixsynapse: Allow new dependency to be installed from backports
Closes: #2230.

- matrix-synapse >= 1.59.1-1 requires python3-unpaddedbase64 >= 2.1.0~

Tests:

- On a stable container, matrixsynapse app is not installable.

- With the changes, start FreedomBox service, setup will run on the upgrades
module and /etc/apt/preferences.d/51freedombox-apps.conf will be changed to
include the two new entries. After this, matrix-synapse app is installable.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2022-06-24 08:18:27 -04:00
Sunil Mohan Adapa
e4f8a7942f
ejabberd: Revert changes to always keep localhost (aa5b1cea126d37)
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
2022-06-20 17:06:03 -07:00
Sunil Mohan Adapa
15038ae24c
transmission: Simplify actions using the privileged decorator
Tests:

- Get and set the storage path.

- Functional tests pass.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2022-06-20 18:17:18 -04:00
nbenedek
3ec086411b
mediawiki: Add option to change the site name
[sunil: Update the form description for styling]
[sunil: Show the default site name when nothing is set]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2022-06-20 14:13:28 -07:00
Sunil Mohan Adapa
aa5b1cea12
ejabberd: Make localhost disabled option in domain selection
Remove the label description that says the localhost option is not shown.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
2022-06-20 12:51:41 -07:00
James Valleroy
1a39212313
ejabberd: Add multi-select form for domains
Choices includes all of the available domain names in the system, as
well as any domains that are in ejabberd configuration.

Tests:

- Disable a domain. It is removed from ejabberd config.

- Enable a domain. It is added to ejabberd config.

- Enable all name services. Run ejabberd functional tests and observe
  that they pass.

Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2022-06-20 11:09:31 -07:00
James Valleroy
7d4c3dbb67
ejabberd: Automatically use coturn
Closes #2183.

Tests:

- Install Ejabberd. "Automatically manage audio/video call setup" is
  enabled.

- Set a domain name and install Coturn. Ejabberd config is updated.

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2022-06-20 11:09:18 -07:00
Sunil Mohan Adapa
2a0239b6ba
users: Fix deleting user LDAP entry with Django 4.0
Helps: #2228.

In Django 4.0, form_valid() method should be overridden instead of delete()
method. This is because DeleteView inherits from FormMixin. To make the code
work for Django 2.2 and up, implement both methods but make delete() method
available only after base __init__() so that Django does not show a warning with
Django 4.0.

Tests:

- Run unit tests on stable, testing and unstable containers.

- Create a temporary user and delete the user. User deletion success message
must be show. Create another user with the same username as the deleted user (to
ensure that deletion actually happened). Perform the test on stable, testing and
unstable containers.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2022-06-20 10:23:17 -04:00
nbenedek
16ab0e4fc9
janus: improve description about coturn
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
[james: Remove space]
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
2022-06-18 10:40:26 -04:00
schiriki
7028e3d022
Add char field to set a password that is required to join the server
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
[james: Apply yapf formatting]
[james: Minor adjustment to help text]
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
2022-06-18 10:26:51 -04:00
Sunil Mohan Adapa
086b805c2b
email: Make app available for all users (even without advanced flag)
- Discussed during progress call.

- More testing has happened on the app since making it available.

- Will document difficulties with setting up domain name and ISP outgoing
traffic on port 25.

Tests:

- App is available without the advance flag.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2022-06-06 20:55:06 -04:00
Sunil Mohan Adapa
8e5d126b67
email: Add description about ISP and domain limitations
As discussed during progress calls, this is a pre-condition for making the app
generally available (without advanced flag).

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2022-06-06 20:54:57 -04:00
James Valleroy
b7a1d4bf8f
janus: Add new app for lightweight WebRTC server
- Add basic video room based on demo.

- Set port range to use for RTP.

- coturn: Add component for time-limited TURN configuration.

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
[sunil: Don't error out when coturn is not installed/configured]
[sunil: Prepend data- to custom attribute in HTML]
[sunil: Convert SVG with embedded bitmap to vector graphics]
[sunil: Hide Javascript license information in footer]
[sunil: Minor changes to comments for styling]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2022-06-06 17:42:41 -07:00
Sunil Mohan Adapa
4e5835f92a
wordpress: tests: Fix writing title for new post in newer versions
Newer versions of wordpress after Bullseye seem to have a different HTML
structure for the title element. Make the functional tests work for the new
structure as well as the old one.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
2022-06-06 12:17:25 -07:00
James Valleroy
90cef6e95c
wordpress: tests: Continue past language selection screen
Tests: Functional tests for wordpress pass on stable container.

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
[sunil: Make language selection presence optional]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2022-06-06 11:16:47 -07:00
Kolja Gorter
561ba00f18
Add function to change root chanel name of mumble server
Show the current name of the root channel

Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
[james: Use augeas for config file operations]
[james: Pass channel name on command line]
[james: Add functional test for change root channel name]
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
2022-06-03 10:03:51 -04:00
Sunil Mohan Adapa
411f42edb2
wordpress: Allow installing/updating plugins and themes
Based on work by Benedek Nagy at:
https://salsa.debian.org/freedombox-team/freedombox/-/merge_requests/2198

Tests:

- Install WordPress without this patch. Then switch to code with this patch.
Restart FreedomBox. WordPress setup should get executed and the setup version
should get incremented to 2. The configuration file should contain the include
line for freedombox-static.php. freedombox-static.php should be installed and
should contain the line for setting FS_METHOD to 'direct'.

- Uninstall WordPress and wipe everything. Install WordPress freshly using this
patch. The line to include freedombox-static.php should be present in the
default configuration file. freedombox-static.php should be installed and should
contain the line for setting FS_METHOD to 'direct'.

- Installing a new theme using a URL and setting the default theme to the new
theme should work.

- Installing a plugin and enabling it should work.

- Installing an older version of a plugin and then updating it should work.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2022-06-01 10:26:56 -04:00
Benedek Nagy
b6d3e21608
transmission: Add redirects to avoid 409 conflict
Tests:

- Inside container, run 'curl http://localhost/transmission/' and 'curl
http://localhost/transmission/web'. Notice that '409 Conflict' errors are
thrown.

- Apply the patch, run ./setup.py install and restart apache. Run the curl
commands again and this time, they lead to 302 redirects instead.

[sunil]: Update comment and make the redirect temporary.
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
Tested-by: Sunil Mohan Adapa <sunil@medhas.org>
2022-05-25 15:46:55 -07:00
Sunil Mohan Adapa
52d55efe35
tor: Show port forwarding information in consistent way
Closes: #2187

Tests:

- Visit the Tor app page after installing. Port forwarding information is
shown like in all other apps. Protocol column lists 'TCP'.

- Information about SOCKS port is shown in the description.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2022-05-23 19:47:15 -04:00
Sunil Mohan Adapa
ca13b7bd93
firewall: Show service name in port forwarding info table
- Also add CSS class for the table to aide functional tests.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2022-05-23 19:47:11 -04:00
Sunil Mohan Adapa
74a6042ed8
*: Show Learn More... links in frontpage with description
Closes: #1797.

Tests:

- For each affected app, install the app, visit frontpage. Select the shortcut.
Notice that Learn More... link is shown and clicking on the link takes us to the
manual page of the app.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2022-05-22 05:44:22 -04:00
Sunil Mohan Adapa
48457dd0d0
mediawiki: Fix URL diagnostics with redirects involved
Upon access of MediaWiki URL, it redirects to the main page with the URL
configured. This new URL could only be accessed on IPv4 or IPv6 only. When curl
is invoked with the IP address version of a different kind, this fails. Tell the
diagnostics methods not the restrict to a particular address type.

Tests:

- All MediaWiki diagnostic tests pass. URL tests show that they haven't been
performed on particular address type but rather generically.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2022-05-21 19:55:18 -04:00
Sunil Mohan Adapa
436060fecb
apache: Allow URL diagnostics to work with redirects
Upon access of an app URL, it may redirect to another URL that is configured in
app settings. This new URL could only be accessed on IPv4 or IPv6 only. When
curl is invoked with the IP address version of a different kind, the access
fails. In such cases, tell the diagnostics methods not the restrict to a
particular address type.

Tests:

- Unit tests pass.

- All of transmission's diagnostics tests pass. The URL tests show that they
have been performed on a particular IP address type.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2022-05-21 19:55:05 -04:00
Benedek Nagy
5da1ebf00c
ssh, bind: Show 'Learn More...' links
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2022-05-11 10:11:58 -07:00
Benedek Nagy
10fb0cae74
tt-rss: Fix description about user access
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2022-05-10 14:02:51 -07:00
Benedek Nagy
1dcfa06dd8
mediawiki: Serve hidden service over http for .onion domains
[sunil: rename the form field variable]
[sunil: rename the parater to get/set_server_url functions]
[sunil: remove unused PrependWidget, can be added back later]
[sunil: update functional tests]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2022-05-10 12:43:43 -07:00
Benedek Nagy
b3d5d68448
mediawiki: Add stricter sandbox rules for jobrunner service
Tests:

- Run ./setup.py install and check that 'systemctl daemon-reload; systemctl show
mediawiki-jobrunner.service' shows the required sandbox changes.

- Tested a few MediaWiki jobs. See:
https://salsa.debian.org/freedombox-team/freedombox/-/issues/299#note_306788

[sunil: Relax the restrictions on read/write paths and networking]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
Tested-by: Sunil Mohan Adapa <sunil@medhas.org>
2022-05-10 11:07:08 -07:00
Sunil Mohan Adapa
bf02dfb38c
matrixsynapse: Allow new dependencies to be installed from backports
Closes: #2215.

- matrix-synapse >= 1.55.0-2 requires python3-jinja2 >= 3.0~

- python3-jinja2 >= 3.0~ requires python3-markupsafe >= 2.0

Tests:

- On a stable container, matrixsynapse app is not installable.

- With the changes, start FreedomBox service, setup will run on the upgrades
module and /etc/apt/preferences.d/51freedombox-apps.conf will be changed to
include the two new entries. After this, matrix-synapse app is installable.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2022-05-09 21:49:26 -04:00
Sunil Mohan Adapa
8b7ca439ff
mediawiki: Handle password rejection from MediaWiki
Closes: #2063.

When admin password is being set in MediaWiki, if the password is found in the common
list of passwords, MediaWiki will fail instead of setting the password. Detect
this case and show an error instead of a hard server.

Tests:

- Setting the admin password to 'passwordpassword' fails due to check in common
passwords list. A message is shown that strong password is needed instead of a
500 error page.

- Set the password to 'passwordpassword' and update other settings. Settings are
updated with success message but password update fails with error message.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2022-05-09 21:44:37 -04:00
Benedek Nagy
8875bc32ae
mediawiki: Check if admin password is at least 10 characters long
Sunil: Current passwords policies as of MediaWiki 1.35.6 do not require capital
letter and numeral. Add comment that the password can't be common one.

Tests:

- Set the admin password to 'testingtesting'. Update should be successful.

[sunil: Fix typos]
[sunil: Drop checking for capital letter and numeral in password]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2022-05-09 21:44:32 -04:00
Sunil Mohan Adapa
7e761c91ea
email: Fix userdb lookups with LDAP
Without the base attribute set, LDAP search returns no results and because of
the lookup failure LMTP will not be able to deliver message even though postfix
has successfully received the messages.

Tests:

- On a fresh container, send a message to a local user using roundcube. The user
should receive the message successfully.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2022-05-09 21:06:56 -04:00
Benedek Nagy
3267a05963
transmission: Improve description
Closes: #952.

Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2022-04-29 09:38:12 -07:00
Veiko Aasa
78a2b26132
samba: Fix functional tests when user is not logged in at start
Signed-off-by: Veiko Aasa <veiko17@disroot.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2022-04-26 11:19:29 -07:00
Sunil Mohan Adapa
59d7721682
sharing: Allow double quotes in path strings
Unix paths can contain double quotes. Allow entering paths with double quotes by
escaping them in c-style[1] and retrieve them back properly.

1) https://httpd.apache.org/docs/2.4/expr.html

Tests:

Run tests on with various paths:

- /var/a b

- /var/c"d

- /var/ef"

Run the following tests.

- Create a directory with the test path and create a sample file inside it.

- Add a share with the test path.

- Ensure that the share is accessible and the file can be downloaded.

- Ensure that the list of the shares shows the path correctly.

- Ensure that the share can be edited.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
2022-04-25 15:21:55 -07:00
Benedek Nagy
0b2125aad6
sharing: put file path between quotation marks
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2022-04-25 15:21:45 -07:00
Aurélien Couderc
37d066e285
Fix description of the validation rule for calibre library names so it actually matches the pattern 2022-04-10 14:05:21 -07:00
James Valleroy
d21e33268d
upgrades: Use python3-typing-extensions from bullseye-backports
Fixes #2207.

Tests:

- /etc/apt/preferences.d/51freedombox-apps.pref has expected content.

- Matrix Synapse can be installed, functional tests pass.

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2022-04-10 14:02:40 -07:00
Sunil Mohan Adapa
2752cf55d3
package: Update package expression API and fix regressions
- Make terminology more consistent managed vs. possible, resolve vs. actual.

- Fix regression in security report caused by comparing package expressions with
package names.

- Fix regression in package upgrades caused by comparing package expressions
with package names.

- Update API method names to improve readability and prevent accidental
mismatching of package names and package expressions. Update variable names for
same reason during usage.

Tests:

- minetest install successfully in testing.

- Security report shows non-zero value in the current vulnerabilities column.

- When an unavailable package is added to list of packages in an app, the app
can't be installed.

- When PackageOr expressions is added to an essential package, running
  --list-dependencies shows an expressions with '|' in it.

- Unit tests succeed.

- Find a package with conffile prompt and add that to list of a packages in an
app like bepasty and implement a stub force_upgrade() method in the app. Run
'apt update' and that triggers and analysis of packages with conf file prompts.
This should call force_upgrade() method in bepasty and with proper argument for
list of packages.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2022-04-10 09:51:13 -04:00
James Valleroy
93156fe8e7
minetest: Allow alternate name for 3d armor mod
In Bookworm, the minetest-mod-player-3d-armor package is renamed to
minetest-mod-3d-armor. Allow either package name to fulfill the
requirement, so that the app is installable in both Bullseye and
Bookworm.

Fixes #2164.

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
2022-04-10 08:29:34 -04:00
Jim Gregory
66e19ff56e
network: Fix showing wifi connection
Viewing a wifi connection will cause a 500 error.  To reproduce this
issue, go to plinth/sys/networks/.  If no wifi connections exist,
add one use the "Add Connection" button.  Then, click on the name of
the wifi connection to view it.  A 500 error is returned.

This commit fixes this error so the normal "show connection" is
returned.  It also fixes a bytestring conversion error
for the SSID and a blank value for "mode" on the page.

Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2022-03-28 15:19:48 -07:00