Premier commit
This commit is contained in:
67
roles/old/firewall-vpn-r/files/ferm.conf
Normal file
67
roles/old/firewall-vpn-r/files/ferm.conf
Normal file
@@ -0,0 +1,67 @@
|
||||
# -*- shell-script -*-
|
||||
#
|
||||
# Configuration file for ferm(1).
|
||||
#
|
||||
|
||||
@def $DEV_ADM = enp0s3;
|
||||
@def $DEV_VPN = enp0s8;
|
||||
@def $DEV_EXT = enp0s9;
|
||||
|
||||
@def $NET_ADM=192.168.99.112/24;
|
||||
@def $NET_VPN=192.168.0.51/24;
|
||||
@def $NET_EXT=192.168.1.2/24;
|
||||
|
||||
table filter {
|
||||
chain INPUT {
|
||||
policy DROP;
|
||||
|
||||
# connection tracking
|
||||
mod state state INVALID DROP;
|
||||
mod state state (ESTABLISHED RELATED) ACCEPT;
|
||||
|
||||
# allow local packet
|
||||
interface lo ACCEPT;
|
||||
|
||||
# allow SSH connections
|
||||
proto tcp dport ssh ACCEPT;
|
||||
|
||||
|
||||
# allow DNS connections
|
||||
proto udp sport domain ACCEPT;
|
||||
proto udp dport domain ACCEPT;
|
||||
|
||||
|
||||
# allow IPsec
|
||||
interface ($DEV_VPN) {
|
||||
proto udp sport 500 ACCEPT;
|
||||
proto udp dport 500 ACCEPT;
|
||||
proto esp ACCEPT;
|
||||
}
|
||||
|
||||
# Autoriser nat-t-ike
|
||||
interface ($DEV_VPN) {
|
||||
proto udp sport 4500 ACCEPT;
|
||||
proto udp dport 5500 ACCEPT;
|
||||
}
|
||||
|
||||
# allow DNS connections
|
||||
#interface ($DEV_INT) {
|
||||
# proto (udp tcp) dport domain ACCEPT;
|
||||
#}
|
||||
|
||||
|
||||
# autoriser NTP
|
||||
proto udp sport 123 ACCEPT;
|
||||
|
||||
}
|
||||
chain OUTPUT {
|
||||
policy ACCEPT;
|
||||
}
|
||||
chain FORWARD {
|
||||
policy ACCEPT;
|
||||
|
||||
# connection tracking
|
||||
mod state state INVALID DROP;
|
||||
mod state state (ESTABLISHED RELATED) ACCEPT;
|
||||
}
|
||||
}
|
58
roles/old/firewall-vpn-r/files/iptables-vpn
Normal file
58
roles/old/firewall-vpn-r/files/iptables-vpn
Normal file
@@ -0,0 +1,58 @@
|
||||
#!/bin/bash
|
||||
|
||||
#renommage des interfaces
|
||||
IFPUB=enp0s8
|
||||
IFINT=enp0s9
|
||||
|
||||
iptables -F
|
||||
#iptables -F -t nat
|
||||
|
||||
#bloquer tout
|
||||
iptables -P INPUT DROP
|
||||
iptables -P OUTPUT DROP
|
||||
iptables -P FORWARD ACCEPT
|
||||
|
||||
iptables -A INPUT -i lo
|
||||
iptables -A OUTPUT -o lo
|
||||
|
||||
#autorise l'acces SSH
|
||||
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
|
||||
iptables -A OUTPUT -p tcp --sport 22 -j ACCEPT
|
||||
|
||||
#Autorise les requete DNS en tant que client
|
||||
iptables -A OUTPUT -p udp --dport 53 -j ACCEPT
|
||||
iptables -A INPUT -p udp --sport 53 -j ACCEPT
|
||||
iptables -A INPUT -p udp --dport 53 -j ACCEPT
|
||||
iptables -A OUTPUT -p udp --sport 53 -j ACCEPT
|
||||
|
||||
#autorise isakmp
|
||||
iptables -A OUTPUT -p udp --dport 500 -j ACCEPT
|
||||
iptables -A INPUT -p udp --sport 500 -j ACCEPT
|
||||
iptables -A INPUT -p udp --dport 500 -j ACCEPT
|
||||
iptables -A OUTPUT -p udp --sport 500 -j ACCEPT
|
||||
|
||||
#autorise nat-t-ike
|
||||
iptables -A OUTPUT -p udp --dport 4500 -j ACCEPT
|
||||
iptables -A INPUT -p udp --sport 4500 -j ACCEPT
|
||||
iptables -A INPUT -p udp --dport 5500 -j ACCEPT
|
||||
iptables -A OUTPUT -p udp --sport 4500 -j ACCEPT
|
||||
|
||||
|
||||
# allow IPsec IKE negotiations
|
||||
#iptables -I INPUT -p udp --sport 500 --dport 500 -j ACCEPT
|
||||
#iptables -I OUTPUT -p udp --sport 500 --dport 500 -j ACCEPT
|
||||
# ESP encryption and authentication
|
||||
iptables -I INPUT -p 50 -j ACCEPT
|
||||
iptables -I OUTPUT -p 50 -j ACCEPT
|
||||
|
||||
#autorise la supervision ( SNMP )
|
||||
iptables -A OUTPUT -p udp --dport 161 -j ACCEPT
|
||||
iptables -A INPUT -p udp --sport 161 -j ACCEPT
|
||||
|
||||
#autorise NTP
|
||||
iptables -A OUTPUT -p udp --dport 123 -j ACCEPT
|
||||
iptables -A INPUT -p udp --sport 123 -j ACCEPT
|
||||
|
||||
#autoriser les ping sauf de l'exterieur
|
||||
iptables -A INPUT -p icmp -m limit --limit 30/minute -j ACCEPT
|
||||
iptables -A OUTPUT -p icmp -j ACCEPT
|
3
roles/old/firewall-vpn-r/handlers/main.yml
Normal file
3
roles/old/firewall-vpn-r/handlers/main.yml
Normal file
@@ -0,0 +1,3 @@
|
||||
---
|
||||
- name: Restart ferm
|
||||
service: name=ferm state=restarted
|
8
roles/old/firewall-vpn-r/tasks/main.yml
Normal file
8
roles/old/firewall-vpn-r/tasks/main.yml
Normal file
@@ -0,0 +1,8 @@
|
||||
---
|
||||
- name : installer ferm
|
||||
apt: name=ferm state=present
|
||||
|
||||
- name: fichier parefeu pour VPN
|
||||
copy: src=ferm.conf dest=/etc/ferm/ferm.conf
|
||||
notify:
|
||||
- Restart ferm
|
Reference in New Issue
Block a user