Salut la liste,
J'ai un souci pour lancer un script sous Nagios (non non ça n'est pas HS, 
Nagios fonctionne bien).
Je m'explique : Je souhaite en cas de pépin sur un service, pouvoir le 
redémarrer.
Je me doute qu'il faut les droits de root pour lancer une telle commande 
(Ex: /etc/init.d/apache2 restart). J'ai donc modifié mes règles sudoers :

# Host alias specification
Host_Alias SERVEUR      = localhost
# User alias specification
User_Alias NAGIOS       = %nagios,moi_pour_faire_les_tests
# Cmnd alias specification
Cmnd_Alias SERVICES     
= /usr/lib/nagios/plugins/eventhandlers/restart-apache,/etc/init.d/apache
# User privilege specification
root    ALL=(ALL) ALL
NAGIOS SERVEUR = NOPASSWD: SERVICES

Quand je teste :
[EMAIL PROTECTED]:~$ /etc/init.d/apache2 restart
Forcing reload of web server: Apache2grep: /etc/apache2/ssl/apache.pem: 
Permission non accordée
grep: /etc/apache2/ssl/fa1f44e6.0: Permission non accordée
grep: /etc/apache2/ssl/115406b0.0: Permission non accordée
/etc/init.d/apache2: line 97: kill: (16929) - Opération non permise

[EMAIL PROTECTED]:~$ sudo /etc/init.d/apache2 restart
Forcing reload of web server: Apache2.

[EMAIL PROTECTED]:~$ /usr/lib/nagios/plugins/eventhandlers/restart-apache 
CRITICAL 
SOFT 3
Redemarrage démon Apache (3ème état critique SOFT)...Forcing reload of web 
server: Apache2grep: /etc/apache2/ssl/apache.pem: Permission non accordée
grep: /etc/apache2/ssl/fa1f44e6.0: Permission non accordée
grep: /etc/apache2/ssl/115406b0.0: Permission non accordée
/etc/init.d/apache2: line 97: kill: (341) - Opération non permise

[EMAIL PROTECTED]:~$ sudo /usr/lib/nagios/plugins/eventhandlers/restart-apache 
CRITICAL SOFT 3
Redemarrage démon Apache (3ème état critique SOFT)...Forcing reload of web 
server: Apache2.

ça marche comme prévu, par contre si je teste sur Nagios rien ne marche.
La grosse différence entre nagios et moi c'est le Shell :
moi             /bin/bash
nagios  /bin/false
Ce paramètre de Shell m'empêche de me connecter pour tester les scripts.

Est-il possible de faire exécuter des scripts sudo à un user /bin/false ?

Merci d'avance.
@+
Sil

Répondre à