Modifications de la template FERM et de l'index

This commit is contained in:
Pierre Coimbra
2020-03-03 07:09:54 +01:00
parent 4055e8bb1a
commit 0a968217eb
7 changed files with 228 additions and 43 deletions

View File

@@ -1,11 +1,34 @@
@def $IF_ADMIN = eth3;
@def $IF_FRONT = eth0;
@def $IF_BACK = (eth1 eth2);
@def $OPEN_PORT_FRONT = (22 53);
@def $PROTO_FRONT = (tcp udp);
@def $OPEN_PORT_BACK = (22 53);
@def $PROTO_BACK = (tcp udp);
@def $HAVE_BACK = 1; #0 pour NON 1 pour OUI
# REQUEST : EXT -> INT | ACCESS : INT -> EXT
# Depuis l'extérieur sur l'interface principale
@def $OPEN_PORT_FRONT_REQUEST = (53);
@def $NEED_UDP_FRONT_REQUEST = 1; #0 pour NON 1 pour OUI
@def $UDP_OPEN_PORT_FRONT_REQUEST = (53);
# Depuis l'intérieur sur l'interface principale
@def $OPEN_PORT_FRONT_ACCESS = ();
@def $NEED_UDP_FRONT_ACCESS = 0; #0 pour NON 1 pour OUI
@def $UDP_OPEN_PORT_FRONT_ACCESS = ();
# Depuis l'extérieur sur les interfaces secondaires
@def $HAVE_BACK_REQUEST = 1; #0 pour NON 1 pour OUI
@def $OPEN_PORT_BACK_REQUEST = (53);
@def $NEED_UDP_BACK_REQUEST = 1; #0 pour NON 1 pour OUI
@def $UDP_OPEN_PORT_BACK_REQUEST = (53);
# Depuis l'intérieur sur les interfaces secondaires
@def $HAVE_BACK_ACCESS = 0; #0 pour NON 1 pour OUI
@def $OPEN_PORT_BACK_ACCESS = ();
@def $NEED_UDP_BACK_ACCESS = 0; #0 pour NON 1 pour OUI
@def $UDP_OPEN_PORT_BACK_ACCESS = ();
table filter {
chain INPUT {
@@ -14,16 +37,50 @@ table filter {
mod state state (ESTABLISHED RELATED) ACCEPT;
interface lo ACCEPT;
interface $IF_ADMIN ACCEPT;
interface $IF_FRONT proto $PROTO_FRONT dport $OPEN_PORT_FRONT ACCEPT;
@if $HAVE_BACK {
interface $IF_BACK proto $PROTO_BACK dport $OPEN_PORT_BACK ACCEPT;
interface $IF_FRONT proto tcp dport $OPEN_PORT_FRONT_REQUEST ACCEPT;
@if $NEED_UDP_FRONT_REQUEST {
interface $IF_FRONT proto udp dport $UDP_OPEN_PORT_FRONT_REQUEST ACCEPT;
}
@if $HAVE_BACK_REQUEST {
interface $IF_BACK proto tcp dport $OPEN_PORT_BACK_REQUEST ACCEPT;
}
@if $NEED_UDP_BACK_REQUEST {
interface $IF_BACK proto udp dport $UDP_OPEN_PORT_BACK_REQUEST ACCEPT;
}
proto icmp icmp-type echo-request ACCEPT;
}
chain OUTPUT policy ACCEPT;
chain OUTPUT {
policy DROP;
mod state state INVALID DROP;
mod state state (ESTABLISHED RELATED) ACCEPT;
outerface lo ACCEPT;
outerface $IF_FRONT proto tcp dport $OPEN_PORT_FRONT_ACCESS ACCEPT;
@if $NEED_UDP_FRONT_ACCESS {
outerface $IF_BACK proto udp dport $UDP_OPEN_PORT_FRONT_ACCESS ACCEPT;
}
@if $HAVE_BACK_ACCESS {
outerface $IF_BACK proto tcp dport $OPEN_PORT_BACK_ACCESS ACCEPT;
}
@if $NEED_UDP_BACK_ACCESS {
outerface $IF_BACK proto udp dport $UDP_OPEN_PORT_BACK_ACCESS ACCEPT;
}
proto icmp ACCEPT;
}
chain FORWARD policy DROP;
}

View File

@@ -1,11 +1,34 @@
@def $IF_ADMIN = eth3;
@def $IF_FRONT = eth0;
@def $IF_BACK = (eth1 eth2);
@def $OPEN_PORT_FRONT = (22 80 443);
@def $PROTO_FRONT = (tcp);
@def $OPEN_PORT_BACK = (22 80);
@def $PROTO_BACK = (tcp);
@def $HAVE_BACK = 1; #0 pour NON 1 pour OUI
# REQUEST : EXT -> INT | ACCESS : INT -> EXT
# Depuis l'extérieur sur l'interface principale
@def $OPEN_PORT_FRONT_REQUEST = (80 443);
@def $NEED_UDP_FRONT_REQUEST = 0; #0 pour NON 1 pour OUI
@def $UDP_OPEN_PORT_FRONT_REQUEST = ();
# Depuis l'intérieur sur l'interface principale
@def $OPEN_PORT_FRONT_ACCESS = (80);
@def $NEED_UDP_FRONT_ACCESS = 0; #0 pour NON 1 pour OUI
@def $UDP_OPEN_PORT_FRONT_ACCESS = (53);
# Depuis l'extérieur sur les interfaces secondaires
@def $HAVE_BACK_REQUEST = 1; #0 pour NON 1 pour OUI
@def $OPEN_PORT_BACK_REQUEST = (22);
@def $NEED_UDP_BACK_REQUEST = 0; #0 pour NON 1 pour OUI
@def $UDP_OPEN_PORT_BACK_REQUEST = ();
# Depuis l'intérieur sur les interfaces secondaires
@def $HAVE_BACK_ACCESS = 1; #0 pour NON 1 pour OUI
@def $OPEN_PORT_BACK_ACCESS = (80 53 22);
@def $NEED_UDP_BACK_ACCESS = 1; #0 pour NON 1 pour OUI
@def $UDP_OPEN_PORT_BACK_ACCESS = (53);
table filter {
chain INPUT {
@@ -14,16 +37,50 @@ table filter {
mod state state (ESTABLISHED RELATED) ACCEPT;
interface lo ACCEPT;
interface $IF_ADMIN ACCEPT;
interface $IF_FRONT proto $PROTO_FRONT dport $OPEN_PORT_FRONT ACCEPT;
@if $HAVE_BACK {
interface $IF_BACK proto $PROTO_BACK dport $OPEN_PORT_BACK ACCEPT;
interface $IF_FRONT proto tcp dport $OPEN_PORT_FRONT_REQUEST ACCEPT;
@if $NEED_UDP_FRONT_REQUEST {
interface $IF_FRONT proto udp dport $UDP_OPEN_PORT_FRONT_REQUEST ACCEPT;
}
@if $HAVE_BACK_REQUEST {
interface $IF_BACK proto tcp dport $OPEN_PORT_BACK_REQUEST ACCEPT;
}
@if $NEED_UDP_BACK_REQUEST {
interface $IF_BACK proto udp dport $UDP_OPEN_PORT_BACK_REQUEST ACCEPT;
}
proto icmp icmp-type echo-request ACCEPT;
}
chain OUTPUT policy ACCEPT;
chain OUTPUT {
policy DROP;
mod state state INVALID DROP;
mod state state (ESTABLISHED RELATED) ACCEPT;
outerface lo ACCEPT;
outerface $IF_FRONT proto tcp dport $OPEN_PORT_FRONT_ACCESS ACCEPT;
@if $NEED_UDP_FRONT_ACCESS {
outerface $IF_BACK proto udp dport $UDP_OPEN_PORT_FRONT_ACCESS ACCEPT;
}
@if $HAVE_BACK_ACCESS {
outerface $IF_BACK proto tcp dport $OPEN_PORT_BACK_ACCESS ACCEPT;
}
@if $NEED_UDP_BACK_ACCESS {
outerface $IF_BACK proto udp dport $UDP_OPEN_PORT_BACK_ACCESS ACCEPT;
}
proto icmp ACCEPT;
}
chain FORWARD policy DROP;
}