[Systemd] Problème de création d'un service (Résolu)

Applications, problèmes de configuration réseau
niccoper
Hankyu
Messages : 28
Inscription : jeu. 09 avr. 2015, 17:04

Re: [Systemd] Problème de création d'un service (Résolu)

Message par niccoper »

Effectivement, j'ai un résultat très différent de ce que tu as. J'ai remarqué le statut inactive en postant mon précédent message.

Cela étant, je note que dans mon cas, l'ExecStop est exécuté avant l'ExecStart. Donc, cela ne drvrait pas poser de problème. Le flush interviendrait avant la conf des règles...

Pourrais-tu me dire si le contenu de / est le même sur ton system stp ?

Code : Tout sélectionner

[Unit]
Description=Packet Filtering Framework

[Service]
Type=oneshot
ExecStart=/usr/bin/iptables-restore /etc/iptables/iptables.rules
ExecReload=/usr/bin/iptables-restore /etc/iptables/iptables.rules
ExecStop=/usr/lib/systemd/scripts/iptables-flush
RemainAfterExit=no

[Install]
WantedBy=multi-user.target


Le "RemainAfterExit=no" pourrait expliquer le fait que le service n'a pas un statut "Active", non ?
niccoper
Hankyu
Messages : 28
Inscription : jeu. 09 avr. 2015, 17:04

Re: [Systemd] Problème de création d'un service (Résolu)

Message par niccoper »

Je viens de tester en mettant "yes" à "RemainAfterExit" dans /usr/lib/systemd/system/iptables.service et cela marche.

Code : Tout sélectionner

[root@ncfa ncflm]# iptables -L
Chain INPUT (policy DROP)
target     prot opt source               destination         
ACCEPT     udp  --  anywhere             anywhere             udp spt:domain ctstate RELATED,ESTABLISHED
ACCEPT     tcp  --  anywhere             anywhere             tcp spt:http ctstate RELATED,ESTABLISHED
ACCEPT     tcp  --  anywhere             anywhere             tcp spt:https ctstate RELATED,ESTABLISHED
ACCEPT     tcp  --  anywhere             anywhere             tcp spt:etlservicemgr ctstate RELATED,ESTABLISHED
ACCEPT     tcp  --  anywhere             anywhere             tcp spt:ftp ctstate RELATED,ESTABLISHED
ACCEPT     tcp  --  anywhere             anywhere             tcp spt:iw-mmogame ctstate RELATED,ESTABLISHED
ACCEPT     tcp  --  anywhere             anywhere             tcp spt:nomad ctstate RELATED,ESTABLISHED
ACCEPT     icmp --  192.168.0.0/24       anywhere            
ACCEPT     all  --  localhost.localdomain  localhost.localdomain 

Chain FORWARD (policy DROP)
target     prot opt source               destination         

Chain OUTPUT (policy DROP)
target     prot opt source               destination         
ACCEPT     udp  --  anywhere             anywhere             udp dpt:domain ctstate NEW,RELATED,ESTABLISHED
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:http ctstate NEW,RELATED,ESTABLISHED
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:https ctstate NEW,RELATED,ESTABLISHED
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:etlservicemgr ctstate NEW,RELATED,ESTABLISHED
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:ftp ctstate NEW,RELATED,ESTABLISHED
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:iw-mmogame ctstate NEW,RELATED,ESTABLISHED
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:nomad ctstate NEW,RELATED,ESTABLISHED
ACCEPT     icmp --  anywhere             192.168.0.0/24      
ACCEPT     all  --  localhost.localdomain  localhost.localdomain
Je ne comprends rien. Je n'ai pas le souvenir d'avoir modifié ce fichier... Bon, je te remercie mille fois de ton aide et ta patience et moi je crois que je vais aller me pendre de suite ...
Avatar de l’utilisateur
benjarobin
Maître du Kyudo
Messages : 17580
Inscription : sam. 30 mai 2009, 15:48
Localisation : Lyon

Re: [Systemd] Problème de création d'un service (Résolu)

Message par benjarobin »

Il faut bien RemainAfterExit=yes
Comment cela se fait que ce fichier ait été modifié, tu es le seul à la savoir...
Zsh | KDE | PC fixe : AMD Ryzen 9900X, Radeon RX 7700 XT
Titre d'un sujet : [Thème] Sujet (état) / Règles du forum
Répondre