111 lines
		
	
	
		
			2.6 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			111 lines
		
	
	
		
			2.6 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| 
 | |
| # ---
 | |
| # - Install scripts
 | |
| # ---
 | |
| 
 | |
| cp /usr/local/src/ipt-gateway/ipt-firewall-gateway /usr/local/sbin/
 | |
| 
 | |
| # - If ipv6 is in use..
 | |
| # -
 | |
| cp /usr/local/src/ipt-gateway/ip6t-firewall-gateway /usr/local/sbin/
 | |
| 
 | |
| 
 | |
| 
 | |
| # ---
 | |
| # - Configuration 
 | |
| # ---
 | |
| 
 | |
| mkdir -p /etc/ipt-firewall
 | |
| cp /usr/local/src/ipt-gateway/conf/default_ports.conf \
 | |
|    /usr/local/src/ipt-gateway/conf/include_functions.conf \
 | |
|    /usr/local/src/ipt-gateway/conf/load_modules_ipv4.conf \
 | |
|    /usr/local/src/ipt-gateway/conf/load_modules_ipv6.conf \
 | |
|    /usr/local/src/ipt-gateway/conf/logging_ipv4.conf \
 | |
|    /usr/local/src/ipt-gateway/conf/logging_ipv6.conf \
 | |
|    /usr/local/src/ipt-gateway/conf/post_decalrations.conf /etc/ipt-firewall/
 | |
| 
 | |
| cp /usr/local/src/ipt-gateway/conf/interfaces_ipv4.conf.sample /etc/ipt-firewall/interfaces_ipv4.conf
 | |
| cp /usr/local/src/ipt-gateway/conf/main_ipv4.conf.sample /etc/ipt-firewall/main_ipv4.conf
 | |
| cp /usr/local/src/ipt-gateway/conf/ban_ipv4.list.sample /etc/ipt-firewall/ban_ipv4.list
 | |
| 
 | |
| # - Adjust files 
 | |
| # -    /etc/ipt-firewall/interfaces_ipv4.conf
 | |
| # -    /etc/ipt-firewall/main_ipv4.conf
 | |
| # -    /etc/ipt-firewall/logging_ipv4.conf
 | |
| # -
 | |
| 
 | |
| # - If ipv6 is in use..
 | |
| # -
 | |
| cp /usr/local/src/ipt-gateway/conf/interfaces_ipv6.conf.sample /etc/ipt-firewall/interfaces_ipv6.conf
 | |
| cp /usr/local/src/ipt-gateway/conf/main_ipv6.conf.sample /etc/ipt-firewall/main_ipv6.conf
 | |
| 
 | |
| # - Adjust files 
 | |
| # -    /etc/ipt-firewall/interfaces_ipv6.conf
 | |
| # -    /etc/ipt-firewall/main_ipv4.conf
 | |
| # -    /etc/ipt-firewall/logging_ipv6.conf
 | |
| # -
 | |
| 
 | |
| 
 | |
| 
 | |
| # ---
 | |
| # - systemd configuration for service "ipt-firewall-gateway" / "ip6t-firewall-gateway"
 | |
| # ---
 | |
| 
 | |
| ## - Create a systemd service
 | |
| ## -
 | |
| 
 | |
| # IPv4
 | |
| #
 | |
| cat <<EOF > /etc/systemd/system/ipt-firewall.service
 | |
| [Unit]
 | |
| Description=IPv4 Firewall with iptables
 | |
| After=network.target
 | |
| 
 | |
| [Service]
 | |
| SyslogIdentifier="ipt-gateway"
 | |
| Type=oneshot
 | |
| RemainAfterExit=yes
 | |
| ExecStart=/usr/local/sbin/ipt-firewall-gateway start
 | |
| ExecStop=/usr/local/sbin/ipt-firewall-gateway stop
 | |
| User=root
 | |
| 
 | |
| [Install]
 | |
| WantedBy=multi-user.target
 | |
| EOF
 | |
| 
 | |
| # IPv6
 | |
| #
 | |
| cat <<EOF > /etc/systemd/system/ip6t-firewall.service
 | |
| [Unit]
 | |
| Description=IPv6 Firewall with ip6tables
 | |
| After=network.target
 | |
| 
 | |
| [Service]
 | |
| SyslogIdentifier="ip6t-gateway"
 | |
| Type=oneshot
 | |
| RemainAfterExit=yes
 | |
| ExecStart=/usr/local/sbin/ip6t-firewall-gateway start
 | |
| ExecStop=/usr/local/sbin/ip6t-firewall-gateway stop
 | |
| User=root
 | |
| 
 | |
| [Install]
 | |
| WantedBy=multi-user.target
 | |
| EOF
 | |
| 
 | |
| 
 | |
| ## - Eanable script (for autostart at boot time)
 | |
| ## -
 | |
| systemctl enable ipt-firewall.service
 | |
| systemctl enable ip6t-firewall.service
 | |
| 
 | |
| ## - Reload systemd configuration
 | |
| ## -
 | |
| systemctl daemon-reload
 | |
| 
 | |
| 
 | |
| ## - Start Services
 | |
| ## -
 | |
| systemctl start ipt-firewall
 | |
| systemctl start ip6t-firewall
 | |
| 
 |