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>
This commit is contained in:
Sunil Mohan Adapa authored and James Valleroy committed 2017-09-01 20:03:51 -04:00
1 parent f5a5ee1f04
commit 2e55acb465
3 files changed
+25 -74

No files matched your search

@@ -1,69 +0,0 @@
#!/bin/sh
#
# This file is part of Plinth.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Exit with an error code on any failure
set -e
# Enable tracing to see the commands in
# /var/log/freedombox-first-run.log
set -x
# Set the default firewall zone. When network connections are
# configured outside of FreedomBox/Plinth, they will not be able to
# serve the Plinth web interface. This is because all such interfaces
# will fall in the default firewall zone and that is, by default,
# 'public'. On 'public' zone we don't allow Plinth web interface as
# this zone is not managed.
#
# Configuration of network connections happen outside for
# FreedomBox/Plinth for various reasons:
#
# - Existing network connections before installation of
# freedombox-setup
#
# - Connections configured in /etc/network/interfaces
#
# - Connections manually configured using nmtui
#
# - Connections created using GUI environments such as GNOME
#
# Rather then clearing out /etc/network/interfaces during setup and
# expecting the connections not to be created outside of Plinth,
# setting the default firewall zone is a better approach. This
# default zone selection fits with the main purpose of FreedomBox to
# be a router which is also reflected by the fact that only 'external'
# and 'internal' zones are managed.
firewall-cmd --set-default-zone=external
# Setup firewall rules for all the services enabled by default. Ideally all
# essential services are enabled from Plinth which automatically takes care of
# enabling appropirate firewall ports.
# HTTP
firewall-cmd --zone=external --permanent --add-service=http
firewall-cmd --zone=internal --permanent --add-service=http
# HTTPS
firewall-cmd --zone=external --permanent --add-service=https
firewall-cmd --zone=internal --permanent --add-service=https
# DNS
firewall-cmd --zone=internal --permanent --add-service=dns
# DHCP
firewall-cmd --zone=internal --permanent --add-service=dhcp