Era24 » Historique » Version 24
Gwenael Remond, 29/01/2013 11:14
| 1 | 1 | Gwenael Remond | h1. Era24 |
|---|---|---|---|
| 2 | 1 | Gwenael Remond | |
| 3 | 1 | Gwenael Remond | h2. Décoreller le backend du frontend |
| 4 | 1 | Gwenael Remond | |
| 5 | 22 | Gwenael Remond | * types de règles générés par Era |
| 6 | 22 | Gwenael Remond | |
| 7 | 23 | Gwenael Remond | * règles générées par des directives -> OK |
| 8 | 24 | Gwenael Remond | * règles générées par le compilateur lui-même (politique par défaut, netbios, icmp, inclusions statiques...) -> TODO |
| 9 | 4 | Gwenael Remond | |
| 10 | 17 | Gwenael Remond | * rappel : les types de directives : |
| 11 | 17 | Gwenael Remond | |
| 12 | 17 | Gwenael Remond | <pre> |
| 13 | 17 | Gwenael Remond | if directive.action in (1, 2): # ACTION_DENY, ACTION_ALLOW |
| 14 | 17 | Gwenael Remond | return BasicDirectiveProcessor(directive, default_policy=default_policy) |
| 15 | 17 | Gwenael Remond | if directive.action == 4: # ACTION_REDIRECT |
| 16 | 17 | Gwenael Remond | return RedirectDirectiveProcessor(directive) |
| 17 | 17 | Gwenael Remond | if directive.action == 8: # ACTION_DNAT |
| 18 | 17 | Gwenael Remond | return DNATDirectiveProcessor(directive, is_container) |
| 19 | 17 | Gwenael Remond | if directive.action == 16: # ACTION_MASK |
| 20 | 17 | Gwenael Remond | return SNATDirectiveProcessor(directive) |
| 21 | 17 | Gwenael Remond | if directive.action == 32: # ACTION_FORWARD |
| 22 | 17 | Gwenael Remond | return ForwardDirectiveProcessor(directive) |
| 23 | 17 | Gwenael Remond | </pre> |
| 24 | 17 | Gwenael Remond | |
| 25 | 4 | Gwenael Remond | h2. bilan des règles iptables générées par Era |
| 26 | 1 | Gwenael Remond | |
| 27 | 12 | Gwenael Remond | h3. règles sandards |
| 28 | 12 | Gwenael Remond | |
| 29 | 12 | Gwenael Remond | * <code>BasicDirectiveProcessor</code> |
| 30 | 12 | Gwenael Remond | |
| 31 | 15 | Gwenael Remond | * ACCEPT |
| 32 | 1 | Gwenael Remond | |
| 33 | 15 | Gwenael Remond | <pre> |
| 34 | 15 | Gwenael Remond | /sbin/iptables -t filter -A ext-bas -m state --state NEW -p tcp --dport 8500 --tcp-flags SYN,RST,ACK SYN -s 0/0 -d 0.0.0.0 -j ACCEPT |
| 35 | 15 | Gwenael Remond | </pre> |
| 36 | 1 | Gwenael Remond | |
| 37 | 15 | Gwenael Remond | * DROP |
| 38 | 1 | Gwenael Remond | |
| 39 | 15 | Gwenael Remond | <pre> |
| 40 | 15 | Gwenael Remond | /sbin/iptables -t filter -A bas-ext -m state --state NEW -p tcp --dport 8500 --tcp-flags SYN,RST,ACK SYN -s 0.0.0.0 -d 0/0 -j DROP |
| 41 | 15 | Gwenael Remond | </pre> |
| 42 | 15 | Gwenael Remond | |
| 43 | 21 | Gwenael Remond | h3. directive non basiques : |
| 44 | 18 | Gwenael Remond | |
| 45 | 16 | Gwenael Remond | * SNAT |
| 46 | 13 | Gwenael Remond | |
| 47 | 19 | Gwenael Remond | <pre> |
| 48 | 19 | Gwenael Remond | /sbin/iptables -t nat -A POSTROUTING -p tcp --dport 8500 --tcp-flags SYN,RST,ACK SYN -s 0/0 -d 0.0.0.0 -j ACCEPT |
| 49 | 19 | Gwenael Remond | /sbin/iptables -t filter -A ext-bas -p tcp --dport 8500 --tcp-flags SYN,RST,ACK SYN -s 0/0 -d 0.0.0.0 -j ACCEPT |
| 50 | 19 | Gwenael Remond | </pre> |
| 51 | 13 | Gwenael Remond | |
| 52 | 13 | Gwenael Remond | * DNAT |
| 53 | 18 | Gwenael Remond | |
| 54 | 18 | Gwenael Remond | <pre> |
| 55 | 18 | Gwenael Remond | /sbin/iptables -t nat -A PREROUTING -p tcp --dport 8500 --tcp-flags SYN,RST,ACK SYN -s 0/0 -d 0.0.0.0 -j ACCEPT |
| 56 | 18 | Gwenael Remond | </pre> |
| 57 | 13 | Gwenael Remond | |
| 58 | 1 | Gwenael Remond | * REDIRECT |
| 59 | 1 | Gwenael Remond | |
| 60 | 13 | Gwenael Remond | <pre> |
| 61 | 13 | Gwenael Remond | /sbin/iptables -t filter -A ext-bas -p tcp --dport 56 -j ACCEPT |
| 62 | 13 | Gwenael Remond | /sbin/iptables -t nat -A PREROUTING -p tcp --dport 8500 --tcp-flags SYN,RST,ACK SYN -s 0/0 -d 0.0.0.0 -j REDIRECT --to-ports 56 |
| 63 | 13 | Gwenael Remond | </pre> |
| 64 | 13 | Gwenael Remond | |
| 65 | 13 | Gwenael Remond | * FORWARD |
| 66 | 13 | Gwenael Remond | |
| 67 | 13 | Gwenael Remond | <pre> |
| 68 | 17 | Gwenael Remond | /sbin/iptables -t filter -I FORWARD -p tcp --dport 8500 --tcp-flags SYN,RST,ACK SYN -s 0/0 -d 0.0.0.0 -j ACCEPT |
| 69 | 17 | Gwenael Remond | /sbin/iptables -t filter -I FORWARD -p tcp --dport 8500 --tcp-flags SYN,RST,ACK SYN -s 0/0 -d 0.0.0.0 -m state --state RELATED,ESTABLISHED -j ACCEPT |
| 70 | 13 | Gwenael Remond | </pre> |
| 71 | 12 | Gwenael Remond | |
| 72 | 12 | Gwenael Remond | h2. règles spécifiques |
| 73 | 12 | Gwenael Remond | |
| 74 | 6 | Gwenael Remond | * directive avec log |
| 75 | 1 | Gwenael Remond | * directive avec time |
| 76 | 8 | Gwenael Remond | |
| 77 | 8 | Gwenael Remond | * possibilités d'inversions : |
| 78 | 8 | Gwenael Remond | |
| 79 | 8 | Gwenael Remond | * inversion d'une source (pour une source unique) |
| 80 | 1 | Gwenael Remond | * inversion d'une destination (pour une destination unique) |
| 81 | 9 | Gwenael Remond | * inversion d'un service (pas d'un groupe de services) |
| 82 | 6 | Gwenael Remond | |
| 83 | 6 | Gwenael Remond | types de piles |
| 84 | 6 | Gwenael Remond | |
| 85 | 6 | Gwenael Remond | * pile principale <code>rules</code> |
| 86 | 6 | Gwenael Remond | * pile secondaire (à la fin), pour les règles implicites <code>implicit_rules</code> |
| 87 | 6 | Gwenael Remond | |
| 88 | 11 | Gwenael Remond | création d'une règle dans <code>processor.py</code> : |
| 89 | 6 | Gwenael Remond | |
| 90 | 6 | Gwenael Remond | <pre> |
| 91 | 6 | Gwenael Remond | def create_rule(self, target, chain_name, table, match_params, service_param, param_list): |
| 92 | 6 | Gwenael Remond | # On crée la règle avec la bonne chaine |
| 93 | 6 | Gwenael Remond | rule = TargettedRule(target, chain_name, table) |
| 94 | 6 | Gwenael Remond | # On ajoute tous les paramètres à la règle |
| 95 | 6 | Gwenael Remond | rule.add_parameter(service_param) |
| 96 | 6 | Gwenael Remond | for param in param_list: |
| 97 | 6 | Gwenael Remond | rule.add_parameter(param) |
| 98 | 6 | Gwenael Remond | # on process les paramètre du module time |
| 99 | 6 | Gwenael Remond | self.process_time(rule) |
| 100 | 6 | Gwenael Remond | return rule |
| 101 | 1 | Gwenael Remond | </pre> |
| 102 | 11 | Gwenael Remond | |
| 103 | 11 | Gwenael Remond | <code>iptrules.ParameterFactory</code> permet de générer des bouts de règles en une seule fois |
| 104 | 6 | Gwenael Remond | |
| 105 | 6 | Gwenael Remond | |
| 106 | 1 | Gwenael Remond | * règle de log |
| 107 | 1 | Gwenael Remond | |
| 108 | 1 | Gwenael Remond | exemple DROP : |
| 109 | 1 | Gwenael Remond | |
| 110 | 1 | Gwenael Remond | <pre> |
| 111 | 1 | Gwenael Remond | /sbin/iptables -t filter -A dmz-ext -m state --state NEW -p tcp --dport 8500 --tcp-flags SYN,RST,ACK SYN -i eth3 -o %%interface_gw -s 0/0 -d 0/0 -j LOG --log-prefix "iptables: era dmz-ext" |
| 112 | 1 | Gwenael Remond | /sbin/iptables -t filter -A dmz-ext -m state --state NEW -p tcp --dport 8500 --tcp-flags SYN,RST,ACK SYN -i eth3 -o %%interface_gw -s 0/0 -d 0/0 -j DROP |
| 113 | 1 | Gwenael Remond | </pre> |
| 114 | 1 | Gwenael Remond | |
| 115 | 2 | Gwenael Remond | exemple ACCEPT avec une règle de log qui a une plage horaire |
| 116 | 3 | Gwenael Remond | |
| 117 | 3 | Gwenael Remond | <pre> |
| 118 | 2 | Gwenael Remond | /sbin/iptables -t filter -A dmz-ext -m state --state NEW -p tcp --dport 8500 --tcp-flags SYN,RST,ACK SYN -i eth3 -o %%interface_gw -s 0/0 -d 0/0 -m time --timestart 10:00 --timestop 12:00 --weekdays Mon,Tue -j LOG --log-prefix "iptables: era dmz-ext" |
| 119 | 2 | Gwenael Remond | /sbin/iptables -t filter -A dmz-ext -m state --state NEW -p tcp --dport 8500 --tcp-flags SYN,RST,ACK SYN -i eth3 -o %%interface_gw -s 0/0 -d 0/0 -m time --timestart 10:00 --timestop 12:00 --weekdays Mon,Tue -j DROP |
| 120 | 2 | Gwenael Remond | /sbin/iptables -t filter -A dmz-ext -i eth3 -o %%interface_gw -s 19.168.234.15/255.255.255.255 -d 0/0 -j ACCEPT |
| 121 | 3 | Gwenael Remond | </pre> |
| 122 | 2 | Gwenael Remond | |
| 123 | 1 | Gwenael Remond | exemple SNAT : |
| 124 | 1 | Gwenael Remond | |
| 125 | 1 | Gwenael Remond | <pre> |
| 126 | 1 | Gwenael Remond | /sbin/iptables -t nat -A POSTROUTING -o %%interface_gw -s 19.168.234.15/255.255.255.255 -d 0/0 -j SNAT --to-source %%adresse_ip_eth0 |
| 127 | 1 | Gwenael Remond | /sbin/iptables -t filter -A dmz-ext -i eth3 -o %%interface_gw -s 19.168.234.15/255.255.255.255 -d 0/0 -j LOG --log-prefix "iptables: era dmz-ext" |
| 128 | 1 | Gwenael Remond | /sbin/iptables -t filter -A dmz-ext -i eth3 -o %%interface_gw -s 19.168.234.15/255.255.255.255 -d 0/0 -j ACCEPT |
| 129 | 1 | Gwenael Remond | </pre> |
| 130 | 12 | Gwenael Remond | |
| 131 | 14 | Gwenael Remond | |
| 132 | 14 | Gwenael Remond | * marquage (MARK) |
| 133 | 14 | Gwenael Remond | |
| 134 | 14 | Gwenael Remond | TODO |
| 135 | 12 | Gwenael Remond | |
| 136 | 20 | Gwenael Remond | * ipsec |
| 137 | 20 | Gwenael Remond | |
| 138 | 20 | Gwenael Remond | TODO |
| 139 | 20 | Gwenael Remond | |
| 140 | 12 | Gwenael Remond | * règle spécifique container |
| 141 | 12 | Gwenael Remond | |
| 142 | 12 | Gwenael Remond | <code>build_container_rule()</code> |
| 143 | 12 | Gwenael Remond | |
| 144 | 12 | Gwenael Remond | TODO |
| 145 | 12 | Gwenael Remond | |
| 146 | 1 | Gwenael Remond | |
| 147 | 1 | Gwenael Remond | h2. bilan des règles ipsets générées par Era |
| 148 | 9 | Gwenael Remond | |
| 149 | 9 | Gwenael Remond | TODO |
| 150 | 9 | Gwenael Remond | |
| 151 | 9 | Gwenael Remond | h2. bilan des règles d'authentification (nufw) générée par Era |
| 152 | 5 | Gwenael Remond | |
| 153 | 5 | Gwenael Remond | TODO |