mirror of
https://github.com/billz/raspap-webgui.git
synced 2023-10-10 13:37:24 +02:00
Persist IP forwarding + iptables, update raspapd
This commit is contained in:
parent
a943942bdd
commit
26a28a0123
@ -8,7 +8,7 @@ raspap_dir="/etc/raspap"
|
|||||||
raspap_user="www-data"
|
raspap_user="www-data"
|
||||||
raspap_sudoers="/etc/sudoers.d/090_raspap"
|
raspap_sudoers="/etc/sudoers.d/090_raspap"
|
||||||
raspap_dnsmasq="/etc/dnsmasq.d/090_raspap.conf"
|
raspap_dnsmasq="/etc/dnsmasq.d/090_raspap.conf"
|
||||||
raspap_iptables="/etc/raspap.iptables.rules"
|
raspap_sysctl="/etc/sysctl.d/90_raspap.conf"
|
||||||
webroot_dir="/var/www/html"
|
webroot_dir="/var/www/html"
|
||||||
git_source_url="https://github.com/$repo" # $repo from install.raspap.com
|
git_source_url="https://github.com/$repo" # $repo from install.raspap.com
|
||||||
|
|
||||||
@ -291,14 +291,15 @@ function enable_raspap_daemon() {
|
|||||||
function configure_networking() {
|
function configure_networking() {
|
||||||
install_log "Configuring networking"
|
install_log "Configuring networking"
|
||||||
echo "Enabling IP forwarding"
|
echo "Enabling IP forwarding"
|
||||||
sudo sed -i 's/#net.ipv4.ip_forward=1/net.ipv4.ip_forward=1/' /etc/sysctl.conf || install_error "Unable to set IP forwarding"
|
echo "net.ipv4.ip_forward=1" | sudo tee $raspap_sysctl || install_error "Unable to set IP forwarding"
|
||||||
sudo sysctl -p /etc/sysctl.conf || install_error "Unable to execute sysctl"
|
sudo sysctl -p $raspap_sysctl || install_error "Unable to execute sysctl"
|
||||||
|
sudo /etc/init.d/procps restart || install_error "Unable to execute procps"
|
||||||
|
|
||||||
echo "Creating IP tables rules"
|
echo "Creating IP tables rules"
|
||||||
sudo iptables -t nat -A POSTROUTING -j MASQUERADE || install_error "Unable to execute iptables"
|
sudo iptables -t nat -A POSTROUTING -j MASQUERADE || install_error "Unable to execute iptables"
|
||||||
sudo iptables -t nat -A POSTROUTING -s 192.168.50.0/24 ! -d 192.168.50.0/24 -j MASQUERADE || install_error "Unable to execute iptables"
|
sudo iptables -t nat -A POSTROUTING -s 192.168.50.0/24 ! -d 192.168.50.0/24 -j MASQUERADE || install_error "Unable to execute iptables"
|
||||||
echo "Persisting IP tables rules"
|
echo "Persisting IP tables rules"
|
||||||
sudo iptables-save | sudo tee $raspap_iptables
|
sudo iptables-save | sudo tee /etc/iptables/rules.v4
|
||||||
|
|
||||||
# Prompt to install RaspAP daemon
|
# Prompt to install RaspAP daemon
|
||||||
echo -n "Enable RaspAP control service (Recommended)? [Y/n]: "
|
echo -n "Enable RaspAP control service (Recommended)? [Y/n]: "
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
### BEGIN INIT INFO
|
### BEGIN INIT INFO
|
||||||
# Provides: /etc/raspap/hostapd/servicestart
|
# Provides: raspapd
|
||||||
# Required-Start: $remote_fs $syslog
|
# Required-Start: $remote_fs $syslog
|
||||||
# Required-Stop: $remote_fs $syslog
|
# Required-Stop: $remote_fs $syslog
|
||||||
# Default-Start: 2 3 4 5
|
# Default-Start: 2 3 4 5
|
||||||
@ -11,8 +11,7 @@
|
|||||||
[Unit]
|
[Unit]
|
||||||
Description=RaspAP Service Daemon
|
Description=RaspAP Service Daemon
|
||||||
DefaultDependencies=no
|
DefaultDependencies=no
|
||||||
After=systemd-sysctl.service
|
After=network.target
|
||||||
Before=sysinit.target
|
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=oneshot
|
Type=oneshot
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
# up network services in a specific order and timing to avoid race conditions.
|
# up network services in a specific order and timing to avoid race conditions.
|
||||||
|
|
||||||
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
|
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
|
||||||
NAME=raspap
|
NAME=raspapd
|
||||||
DESC="Service control for RaspAP"
|
DESC="Service control for RaspAP"
|
||||||
CONFIGFILE="/etc/raspap/hostapd.ini"
|
CONFIGFILE="/etc/raspap/hostapd.ini"
|
||||||
DAEMONPATH="/lib/systemd/system/raspap.service"
|
DAEMONPATH="/lib/systemd/system/raspap.service"
|
||||||
@ -36,7 +36,6 @@ set -- "${positional[@]}"
|
|||||||
|
|
||||||
echo "Stopping network services..."
|
echo "Stopping network services..."
|
||||||
systemctl stop openvpn-client@client
|
systemctl stop openvpn-client@client
|
||||||
systemctl stop systemd-networkd
|
|
||||||
systemctl stop hostapd.service
|
systemctl stop hostapd.service
|
||||||
systemctl stop dnsmasq.service
|
systemctl stop dnsmasq.service
|
||||||
systemctl stop dhcpcd.service
|
systemctl stop dhcpcd.service
|
||||||
@ -65,15 +64,8 @@ if [ -r "$CONFIGFILE" ]; then
|
|||||||
|
|
||||||
echo "Removing uap0 interface..."
|
echo "Removing uap0 interface..."
|
||||||
iw dev uap0 del
|
iw dev uap0 del
|
||||||
|
|
||||||
echo "Enabling systemd-networkd"
|
|
||||||
systemctl start systemd-networkd
|
|
||||||
systemctl enable systemd-networkd
|
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "Disabling systemd-networkd"
|
|
||||||
systemctl disable systemd-networkd
|
|
||||||
|
|
||||||
echo "Removing br0 interface..."
|
echo "Removing br0 interface..."
|
||||||
ip link set down br0
|
ip link set down br0
|
||||||
ip link del dev br0
|
ip link del dev br0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user