KGRKJGETMRETU895U-589TY5MIGM5JGB5SDFESFREWTGR54TY
Server : Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8e-fips-rhel5 DAV/2 PHP/5.2.17
System : Linux localhost 2.6.18-419.el5 #1 SMP Fri Feb 24 22:47:42 UTC 2017 x86_64
User : nobody ( 99)
PHP Version : 5.2.17
Disable Function : NONE
Directory :  /usr/sbin/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //usr/sbin/setroubleshootd
#!/usr/bin/python -E
# -*- mode: Python; -*-
#
# Authors: John Dennis <jdennis@redhat.com>
#
# Copyright (C) 2006,2007,2008 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#

import selinux
import os
import getopt
import sys
from setroubleshoot.config import parse_config_setting, get_config
from setroubleshoot.log import log_init
log_init(sys.argv[0])
from setroubleshoot.log import *

def usage():
    print '''
-f --nofork				no fork
-c --config section.option=value	set a configuration value
-v --verbose                            log INFO level and higher messages to console
-V --debug                              log DEBUG level and higher messages to console
-h --help				display help info
'''

fork = True

try:
    opts, args = getopt.getopt(sys.argv[1:], "fc:vVh", ["nofork","config=","verbose","debug","help"])
except getopt.GetoptError:
    # print help information and exit:
    usage()
    sys.exit(2)

for o, a in opts:
    if o in ("-h", "--help"):
        usage()
        sys.exit()

    if o in ("-f", "--nofork"):
        fork = False

    if o in ("-c", "--config"):
        config_setting = a
        if not parse_config_setting(config_setting):
            log_program.error("could not parse config setting '%s'", config_setting)

    if o in ('-v', '--verbose'):
        enable_log_output('console')
        set_default_category_level('info')
        #dump_log_levels()

    if o in ('-V', '--debug'):
        enable_log_output('console')
        set_default_category_level('debug')
        #dump_log_levels()


if not selinux.is_selinux_enabled():
    log_program.error("SELinux not enabled, setroubleshootd exiting...")
    sys.exit(3)


if fork:
    # do the UNIX double-fork magic, see Stevens' "Advanced 
    # Programming in the UNIX Environment" for details (ISBN 0201563177)
    try: 
        pid = os.fork() 
        if pid > 0:
            # exit first parent
            sys.exit(0) 
    except OSError, e: 
        print >>sys.stderr, "fork #1 failed: %d (%s)" % (e.errno, e.strerror) 
        sys.exit(1)

    # decouple from parent environment
    os.chdir("/") 
    os.setsid() 
    os.umask(os.umask(0077) | 0022)

    # write the pid file
    pid_file = get_config('general','pid_file')
    f=open(pid_file, "w")
    f.write(str(os.getpid()))
    f.close()

# See comments on i18n in sealert for detailed information on i18n
# handling and use of gettext.

import gettext
gettext.install(domain    = get_config('general', 'i18n_text_domain'),
                localedir = get_config('general', 'i18n_locale_dir'),
                unicode   = False,
                codeset   = get_config('general', 'i18n_encoding'))

from setroubleshoot.server import RunFaultServer
RunFaultServer()


Anon7 - 2021