Ajouter une règle dans le Firewall suse (SLES10.x) :
- Créer la règle
Par exemple rajouter une règle pour autoriser les connections ssh
iptables -I input_ext 2 -p tcp --dport ssh -j ACCEPT
input_ext est un groupe de règle qui permet d'avoir un affichage plus clair de la chaine input.
-I pour insert à la position 2
suse-dev:~ # iptables -L INPUT
Chain INPUT (policy DROP)
target prot opt source destination
ACCEPT all -- anywhere anywhere
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
input_ext all -- anywhere anywhere
LOG all -- anywhere anywhere limit: avg 3/min burst 5 LOG level warning tcp-options ip-options prefix `SFW2-IN-ILL-TARGET '
DROP all -- anywhere anywhere
all -- anywhere anywhere
Modifier les fichiers de config
Les fichiers de config sont dans /etc/sysconfig/script/SuseFire*
Appelé dans le fichier /etc/sysconfig/SuSEfirewall2
Il faut donc éditer le fichier de customisation et ajouter entre le dernier commentaire et avant 'true' dans la fonction fw_custom_before_port_handling() {:
suse-dev:~ # vi /etc/sysconfig/scripts/SuSEfirewall2-custom
.... fw_custom_before_port_handling() {
....
iptables -I input_ext 2 -p tcp --dport ssh -j ACCEPT
true
....
Ensuite decommenter dans /etc/sysconfig/SuSEfirewall2 pour lire le fichier SuSEfirewall2-custom
## Type: string
#
# 25.)
....
#
FW_CUSTOMRULES="/etc/sysconfig/scripts/SuSEfirewall2-custom"
#FW_CUSTOMRULES=""
Redemarrer le FWµ