Changeset 3390


Ignore:
Timestamp:
08/15/13 15:18:38 (11 years ago)
Author:
sanmai
Message:
  • Use setuid to allow check_clarin_ldap.py to switch to the 'opendj' Unix user, which is required by the OpenDJ command line utilities.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • monitoring/plugins/mpi/generic_tla_monitoring.py

    r3386 r3390  
    11#!/usr/bin/python2
    22
    3 import sys, getopt, httplib, xml.etree.ElementTree, subprocess, os, re, pdb, traceback, datetime, urlparse, urllib
     3import sys, getopt, httplib, xml.etree.ElementTree, subprocess, re, pdb, traceback, datetime, urlparse, urllib
    44import simplejson as json
     5import pwd, os
     6
    57
    68nagios_codes    = {
     
    189191    # Run OpenDJ's "ldapsearch" command line utility
    190192    #pdb.set_trace()
    191    
     193
     194    OpenDJ_uid = pwd.getpwnam('opendj')[2]
     195    Nagios_uid = pwd.getpwnam('nagios')[2]
     196   
     197    try :
     198        os.setuid(OpenDJ_uid)
     199    except error as e :
     200        raise e
     201
    192202    process = subprocess.Popen(command,
    193203                               stdout = subprocess.PIPE,
     
    195205
    196206    stdout, stderr = process.communicate()
     207
     208    try :
     209        os.setuid(Nagios_uid)
     210    except error as e :
     211        raise e
    197212
    198213    #print stdout
Note: See TracChangeset for help on using the changeset viewer.