|
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 : /proc/21585/root/usr/lib64/python2.4/site-packages/sepolgen/ |
Upload File : |
mò
d&KRc @ sî d k Z d k Z d k Z d „ Z d „ Z d f d „ ƒ YZ d e f d „ ƒ YZ d e f d „ ƒ YZ d e f d
„ ƒ YZ d e f d „ ƒ YZ d
e f d „ ƒ YZ
d e f d „ ƒ YZ d f d „ ƒ YZ d f d „ ƒ YZ
d S( Nc C s8 d k } | i d d d g d | i ƒi ƒ d } | S( s
Obtain all of the avc and policy load messages from the audit
log. This function uses ausearch and requires that the current
process have sufficient rights to run ausearch.
Returns:
string contain all of the audit messages returned by ausearch.
Ns /sbin/ausearchs -ms) AVC,USER_AVC,MAC_POLICY_LOAD,DAEMON_STARTt stdouti ( t
subprocesst Popent PIPEt communicatet output( R R ( ( t4 /usr/lib64/python2.4/site-packages/sepolgen/audit.pyt get_audit_msgs s
c C s2 d k } | i d g d | i ƒi ƒ d } | S( s• Obtain all of the avc and policy load messages from /bin/dmesg.
Returns:
string contain all of the audit messages returned by dmesg.
Ns
/bin/dmesgR i ( R R R R R ( R R ( ( R t get_dmesg_msgs' s
t AuditMessagec B s t Z d Z d „ Z d „ Z RS( sã Base class for all objects representing audit messages.
AuditMessage is a base class for all audit messages and only
provides storage for the raw message (as a string) and a
parsing function that does nothing.
c C s | | _ d | _ d S( Nt ( t messaget selft header( R R ( ( R t __init__; s c C s† x | D]w } | i d ƒ } t | ƒ d j o) | d d j o | | _ d SqX q n | d d j o | d | _ d Sq q Wd S( sà Parse a string that has been split into records by space into
an audit message.
This method should be overridden by subclasses. Error reporting
should be done by raise ValueError exceptions.
t =i i s audit(Ni t msgi ( t recsR t splitt fieldst lenR R
( R R R R ( ( R t from_split_string? s
( t __name__t
__module__t __doc__R R ( ( ( R R 4 s t InvalidMessagec B s t Z d Z d „ Z RS( sþ Class representing invalid audit messages. This is used to differentiate
between audit messages that aren't recognized (that should return None from
the audit message parser) and a message that is recognized but is malformed
in some way.
c C s t i | | ƒ d S( N( R R R R ( R R ( ( R R Z s ( R R R R ( ( ( R R T s t PathMessagec B s t Z d Z d „ Z d „ Z RS( s! Class representing a path messagec C s t i | | ƒ d | _ d S( NR
( R R R R t path( R R ( ( R R _ s c C s{ t i | | ƒ xd | D]\ } | i d ƒ } t | ƒ d j o q n | d d j o | d d d !| _ d Sq q Wd S( NR i i R i iÿÿÿÿ( R R R R R R R R R ( R R R R ( ( R R c s ( R R R R R ( ( ( R R ] s t
AVCMessagec B s) t Z d Z d „ Z d „ Z d „ Z RS( sk AVC message representing an access denial or granted message.
This is a very basic class and does not represent all possible fields
in an avc message. Currently the fields are:
scontext - context for the source (process) that generated the message
tcontext - context for the target
tclass - object class for the target (only one)
comm - the process name
exe - the on-disc binary
path - the path of the target
access - list of accesses that were allowed or denied
denial - boolean indicating whether this was a denial (True) or granted
(False) message.
An example audit message generated from the audit daemon looks like (line breaks
added):
'type=AVC msg=audit(1155568085.407:10877): avc: denied { search } for
pid=677 comm="python" name="modules" dev=dm-0 ino=13716388
scontext=user_u:system_r:setroubleshootd_t:s0
tcontext=system_u:object_r:modules_object_t:s0 tclass=dir'
An example audit message stored in syslog (not processed by the audit daemon - line
breaks added):
'Sep 12 08:26:43 dhcp83-5 kernel: audit(1158064002.046:4): avc: denied { read }
for pid=2 496 comm="bluez-pin" name=".gdm1K3IFT" dev=dm-0 ino=3601333
scontext=user_u:system_r:bluetooth_helper_t:s0-s0:c0
tcontext=system_u:object_r:xdm_tmp_t:s0 tclass=file
c C sh t i | | ƒ t i ƒ | _ t i ƒ | _ d | _ d | _ d | _
d | _ g | _ t
| _ d S( NR
( R R R R t refpolicyt SecurityContextt scontextt tcontextt tclasst commt exeR t accessest Truet denial( R R ( ( R R ‹ s c C sµ t } | } | t | ƒ d j o t d | i ƒ ‚ n xR | t | ƒ j o>