15 Commits

Author SHA1 Message Date
Sunil Mohan Adapa
eada506b23
actions/*: Use SPDX license identifier
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
2020-02-19 14:39:36 +02:00
Sunil Mohan Adapa
92f6f8723c firewall: Use firewalld DBus API for most operations
- 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>
2020-02-18 17:09:50 +02:00
Alice Kile
eb83e00011
fix formatting issues
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-12-07 13:08:35 -05:00
James Valleroy
e5081018a3
firewall: Get service ports details
Add interface to get port types and numbers for a service.

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-04-28 20:59:15 -07: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
Joseph Nuthalapati
3c68a52056
firewalld: Use nftables instead of iptables
restart service after setting the firewall backend

Fixes #1400
Fixes #1430

Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2018-12-03 18:22:11 -05:00
Joseph Nuthalapati
913d71e9bc
firewall: Display information that a service is internal only
Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2018-06-21 18:01:53 +05:30
Sunil Mohan Adapa
8f4811b350
Rename Plinth to FreedomBox in more module doc strings
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2018-02-16 20:10:31 -05: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
Sunil Mohan Adapa
2e55acb465
firewall: Move remaining setup steps to Plinth
There is no need to restart firewalld after the setup steps run.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2017-09-01 20:03:51 -04:00
Johannes Keyser
634afef1c9
actions: Make subparsers mandatory, fixes calls without arguments
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
2017-04-10 11:54:23 +05:30
Sunil Mohan Adapa
d79f346591 Use package framework for installing firewalld 2015-01-05 00:13:19 +05:30
Sunil Mohan Adapa
c9d8bb9d00 Require and use Python3 2014-10-01 11:31:51 +05:30
Sunil Mohan Adapa
3ef1ed83ce Add support for zones in firewall service 2014-04-27 18:16:32 +05:30
Sunil Mohan Adapa
32144e96ef Basic firewall sevice based on FirewallD
- Ports are allowed in default zone as soon as a service is enabled
- Ports are disabled when all services depending on the port are disabled
- Shows current enabled state of services and their each of thier ports
2014-04-18 12:53:27 +05:30