Changeset 1083

Show
Ignore:
Timestamp:
12/19/07 08:28:41 (8 months ago)
Author:
xkovah
Message:

checking in the changed manager behavior(hopefully suspending the VM after it loses connectivity with the agent) to test with the real manager (as opposed to my local-running-only copy)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • honeyclient/trunk/etc/honeyclient.xml

    r1081 r1083  
    101101                </limit_spidering> 
    102102                <max_relative_links_to_visit description="An integer, representing the maximum number of relative links that the browser should visit, before moving onto another website.  If negative, then the browser will exhaust all possible relative links found, before moving on.  This functionality is best effort; it's possible for the browser to visit new links on previously visited websites. Note that this value can be overridden if limit_spidering is set to 1 above." default="-1"> 
    103                     5 
     103                    -1 
    104104                </max_relative_links_to_visit> 
    105105                <positive_words description="If a link contains any number of these words, then its probability of being visited (its score) will increase."> 
     
    374374            etc/honeyclient_log.conf 
    375375        </conffile> 
     376        <max_agent_error_count description="The maximum number of time the fault handler can be called for an Agent that the Manager has a SOAP connection to, before the VM is suspended and the Manager moves on. This is mostly to address the case where the Manager loses connectivity to the Agent (for instance due to the VM or Agent itself crashing) where if action is not taken, it will loop forever trying to connect to the Agent. This value should never be set to 0 and should always be positive." default="3"> 
     377            3 
     378        </max_agent_error_count> 
    376379        <!-- HoneyClient::Manager::FW Options --> 
    377380        <FW> 
  • honeyclient/trunk/lib/HoneyClient/Manager.pm

    r1060 r1083  
    366366our $globalAgentState   = undef; 
    367367 
     368 
     369#This variable is used to count how many times stubAgent's fault 
     370#handler has been called, so that special actions can be taken if 
     371#it is called too many times (for instance when Manager loses  
     372#connectivity with the Agent it would otherwise loop and get errors 
     373#forever if some action isn't taken) 
     374#NOTE: This will have to be changed to be agent/vm-specific in the 
     375#future when we have multiple Agents interacting with a single  
     376#Manager. 
     377our $globalAgentErrorCount; 
     378 
    368379# Temporary variable, used to indicate to the fault handler whether 
    369380# or not errors/warnings should be suppressed. 
     
    451462# Private Methods Implemented                                         # 
    452463####################################################################### 
     464 
     465sub _agentHandleFault { 
     466 
     467    # Extract arguments. 
     468    my ($class, $res) = @_; 
     469 
     470 
     471    #NOTE: In the future we may want to have this check first to see if 
     472    #the error is specific to a failed connection (by regexing the error 
     473    #message. But for now, we have no evidence that multiple errors will 
     474    #occur in other circumstances. 
     475    $globalAgentErrorCount++; 
     476 
     477 
     478    # Construct error message. 
     479    # Figure out if the error occurred in transport or over 
     480    # on the other side. 
     481    my $errMsg = $class->transport->status; # Assume transport error. 
     482 
     483    if (ref $res) { 
     484        $errMsg = $res->faultcode . ": ".  $res->faultstring . "\n"; 
     485    } 
     486 
     487    if (!$SUPPRESS_ERRORS) { 
     488        $LOG->warn("Error occurred during processing. " . $errMsg); 
     489        Carp::carp __PACKAGE__ . "->_handleFault(): Error occurred during processing.\n" . $errMsg; 
     490    } 
     491} 
    453492 
    454493sub _handleFault { 
     
    10141053        if ($vmCompromised) { 
    10151054            # Reset the FW state table.  
    1016             $vmStateTable = { }; 
     1055            $vmStateTable = ( ); 
     1056            return $args{'agent_state'}; 
     1057        } 
     1058        if ($globalAgentErrorCount >= getVar(name => "max_agent_error_count")) { 
     1059            # Reset the FW state table.  
     1060            $vmStateTable = ( ); 
    10171061            return $args{'agent_state'}; 
    10181062        }