Author: gs Date: Wed Nov 5 13:03:15 2008 New Revision: 52908 URL: http://svn.opensuse.org/viewcvs/yast?rev=52908&view=rev Log: additionally check auditd status Modified: trunk/audit-laf/src/AuditLaf.ycp Modified: trunk/audit-laf/src/AuditLaf.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/audit-laf/src/AuditLaf.ycp?rev=52908&r1=52907&r2=52908&view=diff ============================================================================== --- trunk/audit-laf/src/AuditLaf.ycp (original) +++ trunk/audit-laf/src/AuditLaf.ycp Wed Nov 5 13:03:15 2008 @@ -306,17 +306,17 @@ */ boolean ReadAuditRules() { - string rules = (string)SCR::Read(.target.string, rules_file ); + string rules = (string)SCR::Read(.target.string, rules_file ); - if ( rules != nil && rules != "" ) - { - RULES = rules; - // additionally save initial settings - INITIAL_RULES = rules; - return true; - } - else - return false; + if ( rules != nil && rules != "" ) + { + RULES = rules; + // additionally save initial settings + INITIAL_RULES = rules; + return true; + } + else + return false; } /** @@ -325,10 +325,6 @@ boolean WriteAuditRules() { boolean success = (boolean)SCR::Write(.target.string, rules_file, RULES ); - if ( !success ) - { - Report::Error( sformat(_("Cannot write rules to %1" ), rules_file) ); - } return success; } @@ -357,6 +353,22 @@ return true; } +global boolean CheckAuditdStatus() +{ + integer auditd_stat = Service::Status( "auditd" ); + + if ( auditd_stat != 0 ) + { + Report::Error( _("Cannot start the audit daemon. +Please check /var/log/messages for auditd errors. +You might use module 'System Log' from group +'Miscellaneous' in YaST2 Control Center.") ); + return false; + } + else + return true; +} + /** * Read all auditd settings * @return true on success @@ -462,6 +474,11 @@ return false; } + else + { + CheckAuditdStatus(); + return true; + } } } @@ -475,8 +492,7 @@ * @return true on success */ boolean WriteAuditdSettings() { - boolean success = true; - map failed = $[]; + boolean ret = true; if ( ! FileUtils::Exists ( config_file ) ) return false; @@ -484,25 +500,19 @@ // write all options to auditd.conf foreach (string key, string value, SETTINGS, { // and write each value - success = (boolean)SCR::Write(add(.auditd, key), value ); + boolean success = (boolean)SCR::Write(add(.auditd, key), value ); if ( !success ) - failed = add( failed, key, value ); + ret = false; }); // This is very important // it flushes the cache, and stores the configuration on the disk SCR::Write(.auditd, nil); - if ( failed != $[] ) - { - Report::Error( _("Cannot write /etc/auditd/auditd.conf.") ); - y2error( "Writing %1 to /etc/auditd/auditd.conf FAILED", failed ); - } - else - { + if ( ret ) y2milestone("%1 has been written: %2", config_file, SETTINGS); - } - return true; + + return ret; } /** @@ -612,6 +622,9 @@ sleep(sl); } + + // Finally check status of auditd (if restart has worked but daemon exited afterwards) + CheckAuditdStatus(); if ( PollAbort() ) return false; -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org