36 Commits

Author SHA1 Message Date
Matthias Dellweg
cb3e050722
diagnose: Move negating diagnose result inside try bock
A caught Exception should always be considered a failed test.

Signed-off-by: Matthias Dellweg <2500@gmx.de>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-09-23 18:48:49 -07:00
Sunil Mohan Adapa
1de2b96bc4
action_utils: Workaround problem with setting debconf answers
Closes: #1303.

Test:

Reproduce the problem with debconf-set-selections. Install tt-rss. run
debconf-set

apt install tt-rss
echo 'tt-rss tt-rss/database-type string pgsql' | debconf-set-selections
apt purge tt-rss
echo 'tt-rss tt-rss/database-type string pgsql' | debconf-set-selections
error: Cannot find a question for tt-rss/database-type

Then run try to install ttrss without patch and observe that it fails. Apply
the patch and see that ttrss is installed properly. Observe that database
configured in /etc/ttrss/database.php is 'pgsql'.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-08-31 08:25:07 -04:00
Sunil Mohan Adapa
ca8ea9427c
action_utils: Introduce utility for setting debconf answers
Tests:

mldonkey
 - Installs
 - /etc/default/mldonkey-server has LAUNCH_AT_STARTUP=true
 - systemctl status mldonkey-server shows daemon running

ejabberd
 - Installs
 - /etc/ejabberd/ejabberd.yml has domainname properly configured

privoxy
 - Installs
 - /etc/privoxy/config has listen-address set to '[::]:8118'

roundcube
 - Installs and works
 - /etc/roundcube/debian-db.php contains dbtype sqlite3

ttrss
 - Installs and works
 - /etc/ttrss/database.php has dbtype 'pgsql'.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-08-31 08:24:59 -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
9d44b09fd4
action_utils: Fix checking for URL availability
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-02-09 19:35:57 -05:00
Sunil Mohan Adapa
c0de223ae4
action_utils: Expose URL checking utility for generic use
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-02-05 14:58:52 -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
2c59bbe0f3
action_utils: Implement utilities for managing uwsgi configurations
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-01-14 19:51:25 -05:00
Sunil Mohan Adapa
7b326870da
apache: Only regenerate snake oil cert when needed
Closes #1230.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2018-03-24 20:12:51 -04:00
Sunil Mohan Adapa
dea4af17fb
Rename Plinth to FreedomBox in license headers
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2018-02-16 20:10:09 -05:00
Joseph Nuthalapati
ff9d061e98
Add file-sharing application Coquelicot to FreedomBox
- Add settings in Service View
- Fixes for maximum file setting
- Don't allow negative values for max. file size in UI
- Minor text changes to django messages
- Minor correction to maximum file size calculation
- Rename apache conf file to coquelicot-freedombox.conf
- Remove all hacks to adjust file size.
- Fix permissions issues for settings file
- Show status block in UI
- try-restart on settings change instead of restart

Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2018-02-14 07:11:25 -05:00
Sunil Mohan Adapa
527aa66494
tor: Ensure that is-enabled status is show properly
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
2018-01-30 17:00:47 +05:30
Joseph Nuthalpati
37138ee83b
mediawiki: Add wiki application
Installs and configures MediaWiki. SSO integration is not included yet.

Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2018-01-01 13:20:37 -05:00
Joseph Nuthalapati
890da32aa1
transmission: fix sso not being enabled
- Transmission version wasn't updated, so the new configuration didn't take
  effect.
- The new configuration disabled Transmission's own auth and an apache reload is
  required for SSO auth to be enabled for Transmission. This was not happening
  because webserver_enable command finds that webserver is already enabled for
  Transmission. It cannot detect upgrades. Hence disabled that check for
  reloads. We're still avoiding restarts if there's no config change, just like
  before.

Fixes #1139

Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2017-12-02 19:35:35 -05:00
Rahul De
a22a01a76f Generic framework for user group per application
- Closes #928
- Adds shell and python APIs adding/removing LDAP groups

Signed-off-by: Rahul De <rahul080327@gmail.com>
Reviewed-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
2017-10-05 10:43:50 +05:30
nsaikiran
a8a5da996e
[#759] Add fail2ban to Plinth UI
Run sudo-required action via actions.superuser_run

Actions related to services those require `sudo` permissions need to
be executed via actions.superuser_run.

NOTE:
If plinth service is started via `sudo ./run --debug` (in dev mode)
all actions will be executed silently. But plinth in user machines
won't be executed with sudo permissions.
2017-07-29 09:42:31 -04:00
Joseph Nuthalpati
d269a0a645
diaspora: Completed debconf configuration for Diaspora. 2017-05-06 07:25:34 -04:00
Sunil Mohan Adapa
8059e6d12c
Allow '405 method not allowed' in URL diagnostics
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
2017-04-05 12:58:29 +05:30
Sunil Mohan Adapa
65aadef546
actions: Hush some unneeded output of systemd 2016-09-04 14:47:28 -04:00
Sunil Mohan Adapa
ddc7e07ea1
Use shutil instead of distuils for which()
It is unusual to use distuils outside of setup scripts.
2016-08-26 21:51:55 -04:00
Sunil Mohan Adapa
9ba327f0dd
users: Fix issue with removing temp file 2016-07-31 15:06:20 +05:30
Sunil Mohan Adapa
8e28afe160
users: Move dpkg reconfigure to action utils
In the hope that it will be useful to other actions.  Also delete the
named temporary file after configuration.
2016-07-31 10:58:07 +05:30
nikhilrayaprolu
eca8b8d42e
checking for apache2 installation
- checking whether apache2 is configured or not before checking
  whether it is enabled

- changed python2 syntax to python3

- returning False
2016-07-24 10:41:02 -04:00
Sunil Mohan Adapa
3d5661dc60
action_utils: PEP8 fixes and minor changes 2016-06-03 16:22:06 -04:00
Sunil Mohan Adapa
d3f386733f
diagnostics: Use curl instead of wget for URLs
wget does not seem to support interface scoping for IPv6 addresses.  For
example, http_proxy=http://[fe80::babe:ff:ffff:babe%eth0]:8118/ . Curl
supports this.

This fixes most of the failures for IPv6 related addresses.  Hide the
last failure as there does not seem to be a proper fix from OS level:
when using link local addresses, if a hostname is resolved to IPv6 link
local address, it is not scoped to that interface.  It can't properly be
used by any tool then.
2016-06-03 16:22:02 -04:00
Sunil Mohan Adapa
97b77e3719
diagnostics: Implement scoping for IPv6 addresses 2016-06-03 16:21:59 -04:00
Sunil Mohan Adapa
8d9480901b
action_utils: Limited fallback to sysvinit
In case of start/stop/restart/reload and to check whether service is
running, fallback to sysvinit scripts when systemd is not running.  This
happens inside a chroot environment when setup of essential components
is happening.
2016-05-21 16:06:29 -04:00
Sunil Mohan Adapa
5234bffb3b Don't restart webserver unnecessary
Some of the important modules such as php5, cgi and authnz_ldap are
enabled by default in freedombox-setup.  However, when installing
ikiwiki we still restart the apache2 web server.  This patch fixes that
by restart or reloading only when the corresponding module/config/site
is not already in the state required.
2015-12-03 17:55:22 -05:00
Sunil Mohan Adapa
3df1a88824 Switch to Django i18n for code strings
Django i18n layer is on top of gettext and provide may crucial features
such as per-request locales, lazy translations etc.
2015-11-13 22:08:43 +05:30
James Valleroy
e7b68f7e28 diagnostics: Remove extra 'error' displayed results.
Just show 'error' for missing command.
2015-08-29 09:37:35 -04:00
James Valleroy
9a25e6b21d tor: Add torsocks as required package, needed for diagnostics.
Display error for diagnostic if command is missing.
2015-08-29 07:48:06 -04:00
Sunil Mohan Adapa
49c4c1dce6 diagnostics: Action helpers for modules
- Helper for checking whether a port is being listened on.

- Helper for checking whether a URL is accessible.

- Helper for checking whether a URL is accessible with all possible IPs
  and machine names.

- Helper for checking whether it is possible to connect to a port.
2015-08-29 06:22:01 -04:00
Sunil Mohan Adapa
ac19238e91 Add utilites for Apache configuration management 2015-07-19 19:54:13 -04:00
Sunil Mohan Adapa
07e2c0ce14 Don't use actions to check if service is running
- To check whether a service is running does not require root
  privileges.  This can directly be done from a module without any
  action.

- Since actions are allowed to be run using sudo, introducing
  unnecessary sub-commands increases attack surface.

- Simple functions calls are unnecessarily being converted to command
  line invocations and involve parsing response.

- There is a lot of repeated code because of this that can be
  eliminated.

- To generalize this, we need to make all non-root system operations
  directly from module instead of delegating to action commands.
2015-07-19 19:54:13 -04:00
Sunil Mohan Adapa
3b6af2f29c Use only action utilities for service management
- When disabling a service, ignore if unable to stop the service.
2015-07-19 19:54:13 -04:00
Sunil Mohan Adapa
517c364559 pagekite: Move to using python3-augeas
- Merge actions/pagekite_util.py into plinth/modules/pagekite/util.py.

- Rename plinth/modules/pagekite/util.py to utils.py.

- Add python-augeus as dependency.

- Move actions/util.py to plinth/action_utils.py and update services
  that use it.

- Rename _run() method to run() as it is being used publicly.

- Import the utils in a more conventional manner.

- Move all python2 bits to python3.
2015-07-19 15:37:43 -04:00