Project

General

Profile

Tâche #13556

Scénario #15483: Agent RVP : revoir le traitement des threads strongSwan et ajouter un status.error dans un cas précis

Relance du service rvp en cas d'état des process ipsec incohérent

Added by Jean-Marc MELET almost 8 years ago. Updated about 7 years ago.

Status:
Fermé
Priority:
Normal
Start date:
10/12/2015
Due date:
% Done:

100%

Estimated time:
3.00 h
Spent time:
Remaining (hours):
0.0

Description

Nous avons remarqué que parfois le service ipsec et le fonctionnement des tunnels RVP peuvent être dans un état incohérent. De manière inexpliquée, il n'y a plus de fichier de verrou pour rvp ni ipsec alors que le service est toujours lançé et les processus actifs:

root@amon.clg-honnoraty.local:~# ps -aux |grep ipsec
Warning: bad ps syntax, perhaps a bogus '-'? See http://procps.sf.net/faq.html
root     17298  0.0  0.0  18940   620 ?        Ss   Jul13   0:00 /usr/lib/ipsec/starter
root     27266  0.0  0.0   7668  1028 pts/1    S+   20:17   0:00 grep --color ipsec
root     29326  0.0  0.1 637416  6316 ?        Ssl  Oct10   0:14 /usr/lib/ipsec/charon --use-syslog

root@amon.clg-honnoraty.local:~# ll /var/lock/
total 0
-rw-r----- 1 root root  0 2015-09-12 20:29 aptitude
-rw-r--r-- 1 root root  0 2015-10-09 08:14 bastion
drwx------ 2 root root 40 2015-07-13 10:08 lvm
drwxr-xr-x 2 root root 40 2015-10-10 06:09 subsys
-rw-r--r-- 1 root root  0 2015-10-12 17:46 z_stats

root@amon.clg-honnoraty.local:~# ll /var/lock/subsys/
total 0

A ce stade, les tunnels apparaissent toujours montés et l'Amon continue à router le traffic à travers

root@amon.clg-honnoraty.local:~# ipsec status
Security Associations (1 up, 0 connecting):
CLG Emille Honnoraty Annot Amon 2.3-Sphynx 2.3_1[71]: ESTABLISHED 8 minutes ago, 10.104.1.245[C=fr, O=gouv, OU=education, OU=ac-aix-marseille, CN=0040001E-01]...195.83.253.51[C=fr, O=gouv, OU=education, OU=ac-aix-marseille, CN=AGRIATES-AIX-05]
admin-reseau10_3{346}:  INSTALLED, TUNNEL, ESP in UDP SPIs: cf4f090d_i cba1c809_o
admin-reseau10_3{346}:   10.4.1.0/25 === 10.0.13.0/24 
admin-reseau192_2{347}:  INSTALLED, TUNNEL, ESP in UDP SPIs: cec85582_i ce44de39_o
admin-reseau192_2{347}:   10.4.1.0/25 === 192.168.0.0/16 
admin-reseau_eth1_1{348}:  INSTALLED, TUNNEL, ESP in UDP SPIs: c70be372_i c95f58d1_o
admin-reseau_eth1_1{348}:   10.4.1.0/25 === 10.0.13.0/24 
admin-reseau_ader_4{349}:  INSTALLED, TUNNEL, ESP in UDP SPIs: ca101be1_i c1ae52a1_o
admin-reseau_ader_4{349}:   10.4.1.0/25 === 161.48.0.0/19 
admin-reseau172_5{350}:  INSTALLED, TUNNEL, ESP in UDP SPIs: c8182f92_i ca1647bf_o
admin-reseau172_5{350}:   10.4.1.0/25 === 172.16.0.0/12

Mais cela provoque une erreur du test rvp et donc aussi du diagnose:

root@amon.clg-honnoraty.local:~# /usr/share/eole/test-rvp   
Le tunnel n'est pas actif!

Et cet état instable présage souvent d'un panne des tunnels à venir.

Le problème est que l'agent rvp ne détecte pas d'anomalie et devrait relancer le service RVP pour retrouver un état normal, surtout qu'en plus l'agent network détecte bien un problème sur l'interface ipsec0 et elle apparait donc en erreur sur le page de surveillance:

root@amon.clg-honnoraty.local:~# grep dst /usr/share/zephir/monitor/stats/19/rvp/agent.xml 
          'dst',
          'dst':'195.83.253.51[C=fr, O=gouv, OU=education, OU=ac-aix-marseille, CN=AGRIATES-AIX-05]',
          'dst':'10.0.13.0/24 -- 10.0.13.151 joignable -- 10.0.13.245 joignable',
          'dst':'192.168.0.0/16 -- 192.168.224.17 joignable',
          'dst':'10.0.13.0/24 -- 10.0.13.151 joignable -- 10.0.13.245 joignable',
          'dst':'161.48.0.0/19',
          'dst':'172.16.0.0/12 -- 172.30.16.23 joignable',

root@amon.clg-honnoraty.local:~# grep ipsec /usr/share/zephir/monitor/stats/19/network/agent.xml   
          'interf':'ipsec',
    'ipsec':'Off',

Les logs de zéphir monitor confirment qu'il n'y a aucune action de l'agent RVP:

root@amon.clg-honnoraty.local:~# tail -f /var/log/rsyslog/local/zephiragents/zephiragents.info.log   
Oct 12 06:16:12 amon zephiragents: [-] Main loop terminated.
Oct 12 06:16:12 amon zephiragents: [-] Server Shut Down.
Oct 12 06:16:35 amon zephiragents: [-] debsums : pas de dernière mesure disponible.
Oct 12 13:28:37 amon zephiragents: [-] Using default period : 600 seconds
Oct 12 17:46:23 amon zephiragents: [-] Received SIGTERM, shutting down.
Oct 12 17:46:23 amon zephiragents: [-] (Port 8090 Closed)
Oct 12 17:46:23 amon zephiragents: [-] Stopping factory <twisted.web.server.Site instance at 0x31c5098>
Oct 12 17:46:23 amon zephiragents: [-] Main loop terminated.
Oct 12 17:46:23 amon zephiragents: [-] Server Shut Down.
Oct 12 17:46:42 amon zephiragents: [-] debsums : pas de dernière mesure disponible.

Peut-on améliorer le comportement en corrigeant cela?

N.B: l'agent network rapporte ipsec0 en erreur via la commande "ipsec statusall" car elle renvoie un code d'erreur 3 malgre que le retour du status semble OK:

root@amon.clg-honnoraty.local:~# ipsec statusall
Status of IKE charon daemon (strongSwan 5.0.1, Linux 2.6.32-73-eole, x86_64):
  uptime: 2 days, since Oct 10 06:10:20 2015
  malloc: sbrk 675840, mmap 0, used 531472, free 144368
  worker threads: 24 of 32 idle, 7/1/0/0 working, job queue: 0/0/0/0, scheduled: 5
  loaded plugins: charon test-vectors curl ldap sqlite pkcs11 aes des sha1 sha2 md5 random nonce x509 constraints pubkey pkcs1 pkcs8 pgp dnskey pem openssl fips-prf gmp agent xcbc cmac hmac ctr ccm gcm attr kernel-netlink resolve socket-default stroke sql updown eap-identity eap-aka eap-md5 eap-gtc eap-mschapv2 eap-radius eap-tls eap-ttls eap-tnc xauth-generic xauth-eap tnc-tnccs led addrblock
Listening IP addresses:
  10.104.1.245
  10.4.1.125
  172.16.7.245
  10.104.1.125
  10.104.1.55
Connections:
CLG Emille Honnoraty Annot Amon 2.3-Sphynx 2.3_1:  10.104.1.245...195.83.253.51  IKEv2, dpddelay=120s
CLG Emille Honnoraty Annot Amon 2.3-Sphynx 2.3_1:   local:  [C=fr, O=gouv, OU=education, OU=ac-aix-marseille, CN=0040001E-01] uses public key authentication
CLG Emille Honnoraty Annot Amon 2.3-Sphynx 2.3_1:   remote: [C=fr, O=gouv, OU=education, OU=ac-aix-marseille, CN=AGRIATES-AIX-05] uses any authentication
admin-reseau_eth1_1:   child:  10.4.1.0/25 === 10.0.13.0/24 TUNNEL, dpdaction=restart
admin-reseau192_2:   child:  10.4.1.0/25 === 192.168.0.0/16 TUNNEL, dpdaction=restart
admin-reseau10_3:   child:  10.4.1.0/25 === 10.0.13.0/24 TUNNEL, dpdaction=restart
admin-reseau_ader_4:   child:  10.4.1.0/25 === 161.48.0.0/19 TUNNEL, dpdaction=restart
admin-reseau172_5:   child:  10.4.1.0/25 === 172.16.0.0/12 TUNNEL, dpdaction=restart
Security Associations (1 up, 0 connecting):
CLG Emille Honnoraty Annot Amon 2.3-Sphynx 2.3_1[71]: ESTABLISHED 27 minutes ago, 10.104.1.245[C=fr, O=gouv, OU=education, OU=ac-aix-marseille, CN=0040001E-01]...195.83.253.51[C=fr, O=gouv, OU=education, OU=ac-aix-marseille, CN=AGRIATES-AIX-05]
CLG Emille Honnoraty Annot Amon 2.3-Sphynx 2.3_1[71]: IKEv2 SPIs: 30c886261590ca18_i* 1db4fb3db9c2610f_r, public key reauthentication in 25 minutes
CLG Emille Honnoraty Annot Amon 2.3-Sphynx 2.3_1[71]: IKE proposal: AES_CBC_128/HMAC_SHA2_256_128/PRF_HMAC_SHA2_256/MODP_2048
admin-reseau_ader_4{349}:  INSTALLED, TUNNEL, ESP in UDP SPIs: c735840e_i caeb3e5c_o
admin-reseau_ader_4{349}:  AES_GCM_16_128, 0 bytes_i, 0 bytes_o, rekeying in 2 minutes
admin-reseau_ader_4{349}:   10.4.1.0/25 === 161.48.0.0/19 
admin-reseau172_5{350}:  INSTALLED, TUNNEL, ESP in UDP SPIs: c28dfc53_i c5bb9f4e_o
admin-reseau172_5{350}:  AES_GCM_16_128, 888 bytes_i (29s ago), 888 bytes_o (29s ago), rekeying in 3 minutes
admin-reseau172_5{350}:   10.4.1.0/25 === 172.16.0.0/12 
admin-reseau10_3{346}:  INSTALLED, TUNNEL, ESP in UDP SPIs: c794a670_i c819442e_o
admin-reseau10_3{346}:  AES_GCM_16_128, 0 bytes_i, 0 bytes_o, rekeying in 4 minutes
admin-reseau10_3{346}:   10.4.1.0/25 === 10.0.13.0/24 
admin-reseau192_2{347}:  INSTALLED, TUNNEL, ESP in UDP SPIs: cadcd9ec_i cf3139ee_o
admin-reseau192_2{347}:  AES_GCM_16_128, 29064 bytes_i (3s ago), 525874 bytes_o (1s ago), rekeying in 3 minutes
admin-reseau192_2{347}:   10.4.1.0/25 === 192.168.0.0/16 
admin-reseau_eth1_1{348}:  INSTALLED, TUNNEL, ESP in UDP SPIs: ce6eaba4_i c4127b38_o
admin-reseau_eth1_1{348}:  AES_GCM_16_128, 3318 bytes_i (29s ago), 5766 bytes_o (29s ago), rekeying in 4 minutes
admin-reseau_eth1_1{348}:   10.4.1.0/25 === 10.0.13.0/24 

root@amon.clg-honnoraty.local:~# echo $?        
3

Associated revisions

Revision eb375385 (diff)
Added by Fabrice Barconnière about 7 years ago

Traitement du code retour de ipsec statusall dans l'agent rvp

ref #13556 @1h

History

#1 Updated by Fabrice Barconnière almost 8 years ago

  • Tracker changed from Anomalie to Tâche
  • Project changed from Amon to zephir-client

Étudier l'adaptation de la proposition.

#2 Updated by Fabrice Barconnière almost 8 years ago

  • Parent task set to #12068

#3 Updated by Fabrice Barconnière over 7 years ago

  • Parent task changed from #12068 to #15483

#4 Updated by Fabrice Barconnière about 7 years ago

  • Estimated time set to 3.00 h
  • Remaining (hours) set to 3.0

#5 Updated by Fabrice Barconnière about 7 years ago

  • Status changed from Nouveau to En cours

#6 Updated by Fabrice Barconnière about 7 years ago

  • Status changed from En cours to Nouveau
  • % Done changed from 0 to 100
  • Remaining (hours) changed from 3.0 to 0.1

Pour tester, arrêter le service strongswan sur Sphynx et arrêter rvp sur Amon (rvp stop) et relancer le service z_stats pour vérifier que l'agent passe en erreur.

#7 Updated by Fabrice Barconnière about 7 years ago

  • Status changed from Nouveau to En cours

#8 Updated by Fabrice Barconnière about 7 years ago

  • Description updated (diff)
  • Assigned To set to Fabrice Barconnière

#9 Updated by Scrum Master about 7 years ago

  • Status changed from En cours to Résolu

#10 Updated by Laurent Flori about 7 years ago

  • Status changed from Résolu to Fermé
  • Remaining (hours) changed from 0.1 to 0.0

Also available in: Atom PDF