Changeset 38

Show
Ignore:
Timestamp:
11/29/06 05:28:05 (2 years ago)
Author:
kindlund
Message:

experimental support to move integrity baselining into the Agent::init() function, rather than have it be called multiple times in the Agent::run() threads

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • honeyclient/branches/bug/42/lib/HoneyClient/Agent.pm

    r37 r38  
    237237    getVar(name => "perform_integrity_checks"); 
    238238 
     239# A globally shared, serialized hashtable, containing the 
     240# initialized integrity state of the VM -- ready to be checked 
     241# against, at any time. 
     242our $integrityState : shared = undef; 
     243 
    239244# A globally shared, serialized hashtable, containing data per 
    240245# registered driver.  Specifically, for each @DRIVER <entry>, 
     
    359364        $driverUpdateQueues{$driverName} = new Thread::Queue; 
    360365    } 
     366 
     367    # Perform initial integrity baseline check. 
     368    my $integrity = undef; 
     369    if ($PERFORM_INTEGRITY_CHECKS) { 
     370        print "Initializing Integrity Check...\n"; 
     371        # TODO: Initialize Integrity Checks 
     372        $integrity = HoneyClient::Agent::Integrity->new(); 
     373        $integrity->initAll(); 
     374    } 
     375    $integrityState = nfreeze($integrity); 
    361376 
    362377    # Release data lock. 
     
    688703            eval { 
    689704 
    690                 my $integrity = undef; 
    691                 if ($PERFORM_INTEGRITY_CHECKS) { 
    692                     print "Initializing Integrity Check...\n"; 
    693                     # TODO: Initialize Integrity Checks 
    694                     $integrity = HoneyClient::Agent::Integrity->new(); 
    695                     $integrity->initAll(); 
    696                 } 
    697   
    698705                ################################### 
    699706                ### Driver Initialization Phase ### 
    700707                ################################### 
     708 
     709                # Initially set local integrity object to undef. 
     710                my $integrity = undef; 
    701711                 
    702712                # Initially set all driver objects to undef.  
     
    705715                # Acquire lock on stored driver state. 
    706716                $data = _lock(); 
     717 
     718                if ($PERFORM_INTEGRITY_CHECKS) { 
     719                    # XXX: WARNING - The $integrityState object data is NOT thread-safe 
     720                    # (since it relies on external data stored on the file system). 
     721                    # As such, do NOT try to call integrity checks on multiple, simultaneous 
     722                    # asynchronous threaded drivers. 
     723                    $integrity = thaw($integrityState); 
     724                } 
    707725 
    708726                # Now, initialize each driver object.