diff --git a/actions/firewall b/actions/firewall index c389353bf..e6f172a96 100755 --- a/actions/firewall +++ b/actions/firewall @@ -42,12 +42,18 @@ def parse_arguments(): '--zone', help='Zone from which the list is to be retrieved', required=True) + # Get interface status + get_interfaces = subparsers.add_parser( + 'get-interfaces', help='Get list of interfaces in a zone') + get_interfaces.add_argument( + '--zone', help='Zone from which the list is to be retrieved', + required=True) + # Add a service add_service = subparsers.add_parser('add-service', help='Add a service') add_service.add_argument('service', help='Name of the service to add') - add_service.add_argument('--zone', - help='Zone to which service is to be added', - required=True) + add_service.add_argument( + '--zone', help='Zone to which service is to be added', required=True) # Remove a service status remove_service = subparsers.add_parser('remove-service', @@ -81,8 +87,14 @@ def subcommand_get_status(_): def subcommand_get_enabled_services(arguments): """Print the status of variours services""" - subprocess.call(['firewall-cmd', '--zone', arguments.zone, - '--list-services']) + subprocess.call( + ['firewall-cmd', '--zone', arguments.zone, '--list-services']) + + +def subcommand_get_interfaces(arguments): + """Print the list of interfaces in a zone.""" + subprocess.call( + ['firewall-cmd', '--zone', arguments.zone, '--list-interfaces']) def subcommand_add_service(arguments): @@ -93,16 +105,21 @@ def subcommand_add_service(arguments): def add_service(zone, service): """Permit a service in the firewall.""" subprocess.call(['firewall-cmd', '--zone', zone, '--add-service', service]) - subprocess.call(['firewall-cmd', '--zone', zone, '--permanent', - '--add-service', service]) + subprocess.call([ + 'firewall-cmd', '--zone', zone, '--permanent', '--add-service', service + ]) def subcommand_remove_service(arguments): """Block a service in the firewall""" - subprocess.call(['firewall-cmd', '--zone', arguments.zone, - '--remove-service', arguments.service]) - subprocess.call(['firewall-cmd', '--zone', arguments.zone, '--permanent', - '--remove-service', arguments.service]) + subprocess.call([ + 'firewall-cmd', '--zone', arguments.zone, '--remove-service', + arguments.service + ]) + subprocess.call([ + 'firewall-cmd', '--zone', arguments.zone, '--permanent', + '--remove-service', arguments.service + ]) def main(): diff --git a/plinth/modules/firewall/__init__.py b/plinth/modules/firewall/__init__.py index 9d0244fb1..d351d4ac5 100644 --- a/plinth/modules/firewall/__init__.py +++ b/plinth/modules/firewall/__init__.py @@ -78,6 +78,12 @@ def get_enabled_services(zone): return output.split() +def get_interfaces(zone): + """Return the list of interfaces in a zone.""" + output = _run(['get-interfaces', '--zone', zone], superuser=True) + return output.split() + + def add_service(port, zone): """Enable a service in firewall""" _run(['add-service', port, '--zone', zone], superuser=True) diff --git a/plinth/modules/tor/__init__.py b/plinth/modules/tor/__init__.py index dd22c8c9d..96fe38515 100644 --- a/plinth/modules/tor/__init__.py +++ b/plinth/modules/tor/__init__.py @@ -74,7 +74,7 @@ def init(): if not needs_setup: global socks_service socks_service = service_module.Service( - 'tor-socks', _('Tor Anonymity Network'), ports=['tor-socks'], + 'tor-socks', _('Tor Socks Proxy'), ports=['tor-socks'], is_external=False, is_enabled=utils.is_enabled, is_running=utils.is_running) diff --git a/plinth/modules/tor/templates/tor.html b/plinth/modules/tor/templates/tor.html index 371f354cc..66f7fc21a 100644 --- a/plinth/modules/tor/templates/tor.html +++ b/plinth/modules/tor/templates/tor.html @@ -80,6 +80,8 @@ {% endif %} + {% include "internal-zone.html" with service=socks_service %} +