Changeset 1491
- Timestamp:
- 04/09/08 14:36:49 (3 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
honeyclient/branches/exp/kindlund-simpler_agent/etc/honeyclient.xml
r1490 r1491 62 62 <!-- HoneyClient::Agent Options --> 63 63 <Agent> 64 <!-- TODO: Update this. -->65 64 <address description="The IP or hostname that all Agent modules should use, when accepting SOAP requests." default="0.0.0.0"> 66 65 0.0.0.0 … … 68 67 <!-- TODO: Update this. --> 69 68 <!-- Note: This port should be unique and not already in use by other modules, services, or daemons running inside the VM. --> 70 <port description="The TCP port number that the SOAP server for all Agent modules will listen on for requests." default=" 9000">71 900069 <port description="The TCP port number that the SOAP server for all Agent modules will listen on for requests." default="7627"> 70 7627 72 71 </port> 73 72 <allowed_drivers description="List of implemented Drivers that the Agent is allowed to run directly."> … … 80 79 <!-- HoneyClient::Agent::Driver Options --> 81 80 <Driver> 82 <!-- TODO: Update this. -->81 <!-- TODO: Update this. XXX: Command-line option, eventually? --> 83 82 <timeout description="How long the Driver waits during a drive operation, before timing out (in seconds)." default="60"> 84 83 20 … … 179 178 </Crawler> 180 179 <Manager> 181 <!-- TODO: Is this still needed? -->182 <manager_state description="Upon termination, the Manager will attempt to append a complete copy of its state into this file, if specified." default="">183 manager.dump184 </manager_state>185 180 <fingerprint_dump description="When the Manager encounters a suspicious VM, it will attempt to append a complete copy of the fingerprint information to this file, if specified."> 186 181 fingerprint.dump … … 190 185 </address> 191 186 <!-- Note: This port should be unique and not already in use by other modules, services, or daemons running on the host system. --> 192 <port description="The TCP port number that the SOAP server for all Manager modules will listen on for requests." default=" 8089">193 8089187 <port description="The TCP port number that the SOAP server for all Manager modules will listen on for requests." default="7627"> 188 7627 194 189 </port> 195 190 <num_urls_to_process description="If database support is enabled, this value indicates how many URLs the Manager will fetch from the database, process, and report back, before fetching for more URLs." default="10"> … … 221 216 192.168.0.128 222 217 </address> 223 <!-- TODO: Update this . -->218 <!-- TODO: Update this to 7627, eventually. --> 224 219 <port description="Default FW port number" default="8083"> 225 220 8083 … … 311 306 /vm/masters/Agent.Master-37/winXPPro.cfg 312 307 </master_vm_config> 313 <port description="The TCP port number that the SOAP server of the VM daemon will listen on for requests. Note: This port should be unique and not already be used by other modules, services, or daemons running on the host system." default=" 8089">314 8089308 <port description="The TCP port number that the SOAP server of the VM daemon will listen on for requests. Note: This port should be unique and not already be used by other modules, services, or daemons running on the host system." default="7627"> 309 7627 315 310 </port> 316 311 <datastore_path description="The absolute path to the parent directory, where all HoneyClient VM data is stored on the host server. It is assumed that individual VM data is stored in separate subdirectories within this parent directory." default="/vm"> honeyclient/branches/exp/kindlund-simpler_agent/lib/HoneyClient/Manager.pm
r1490 r1491 243 243 use Data::Dumper; 244 244 245 # Make sure Filesys::DfPortable loads246 BEGIN { use_ok('Filesys::DfPortable')247 or diag("Can't load Filesys::DfPortable package. Check to make sure the package library is correctly listed within the path."); }248 require_ok('Filesys::DfPortable');249 use Filesys::DfPortable;250 251 245 =end testing 252 246 … … 288 282 # Include Hash Serialization Utility Libraries 289 283 use Storable qw(nfreeze thaw); 290 291 # Include Disk Utilization Library292 use Filesys::DfPortable;293 284 294 285 # Include Logging Library … … 380 371 ####################################################################### 381 372 382 # Helper function to check if the host system has enough disk383 # space available, in order to run the Manager.384 sub _checkSpaceAvailable {385 386 my $datastore_path = getVar(name => "datastore_path",387 namespace => "HoneyClient::Manager::VM");388 my $snapshot_path = getVar(name => "snapshot_path",389 namespace => "HoneyClient::Manager::VM");390 my $min_space_free = getVar(name => "min_space_free",391 namespace => "HoneyClient::Manager::VM");392 393 # Obtain sizes in GB394 my $datastore_attr = dfportable($datastore_path, 1024 * 1024 * 1024);395 my $snapshot_attr = dfportable($snapshot_path, 1024 * 1024 * 1024);396 397 if ($datastore_attr->{bavail} < $min_space_free) {398 $LOG->warn("Directory (" . $datastore_path . ") has low disk space (" . $datastore_attr->{bavail} . " GB).");399 } elsif ($snapshot_attr->{bavail} < $min_space_free) {400 $LOG->warn("Directory (" . $snapshot_path . ") has low disk space (" . $snapshot_attr->{bavail} . " GB).");401 } else {402 return;403 }404 $LOG->info("Low disk space detected. Shutting down Manager.");405 exit;406 }407 408 373 # Default handler for any faults that are received by a SOAP client. 409 374 # Inputs: Class, SOAP::SOM … … 441 406 exit; 442 407 } 443 444 # TODO: Save manager state? - Still needed?445 # This variable may contain a filename that the Manager446 # would use to dump its entire state information, upon termination.447 # XXX: May want to change this format/usage, eventually.448 # my $STATE_FILE = getVar(name => "manager_state");449 #450 # if (length($STATE_FILE) > 0 &&451 # defined($globalAgentState)) {452 # $LOG->info("Saving state to '" . $STATE_FILE . "'.");453 # my $dump_file = new IO::File($STATE_FILE, "a");454 #455 # # XXX: Delete this block, eventually.456 # $Data::Dumper::Terse = 0;457 # $Data::Dumper::Indent = 2;458 # print $dump_file Dumper(thaw(decode_base64($globalAgentState)));459 # $dump_file->close();460 # }461 408 462 409 END { … … 517 464 # for consistency. 518 465 my ($class, %args) = @_; 519 520 # Sanity check: Check disk space.521 # TODO: This needs to be moved closer to the cloning logic.522 _checkSpaceAvailable();523 466 524 467 # Sanity check: If there's no database support and no work was honeyclient/branches/exp/kindlund-simpler_agent/lib/HoneyClient/Manager/VM/Clone.pm
r1490 r1491 330 330 use IO::File; 331 331 332 # Make sure Filesys::DfPortable loads 333 BEGIN { use_ok('Filesys::DfPortable') 334 or diag("Can't load Filesys::DfPortable package. Check to make sure the package library is correctly listed within the path."); } 335 require_ok('Filesys::DfPortable'); 336 use Filesys::DfPortable; 337 332 338 =end testing 333 339 … … 389 395 # Include IO::File Libraries 390 396 use IO::File; 397 398 # Include Disk Utilization Library 399 use Filesys::DfPortable; 391 400 392 401 =pod … … 541 550 # Ignore errors. 542 551 eval { 552 $self->{'_fw_handle'} = getClientHandle(namespace => "HoneyClient::Manager::FW", 553 fault_handler => \&_handleFWFault); 543 554 $self->_denyNetwork(); 544 555 }; … … 590 601 } 591 602 592 # Handle SOAP faults. 603 # Handle FW SOAP faults. 604 # 605 # During VM Clone object destruction, it's possible that the 606 # firewall will be reset by the Manager's END logic before the chains 607 # have been properly flushed by the DESTROY logic. As such, 608 # we suppress error during chain deletion. 609 sub _handleFWFault { 610 611 # Extract arguments. 612 my ($class, $res) = @_; 613 614 # Construct error message. 615 # Figure out if the error occurred in transport or over 616 # on the other side. 617 my $errMsg = $class->transport->status; # Assume transport error. 618 619 if (ref $res) { 620 $errMsg = $res->faultcode . ": ". $res->faultstring . "\n"; 621 } 622 623 if ($errMsg !~ /Unable to flush entries in chain/) { 624 $LOG->warn("Error occurred during processing. " . $errMsg); 625 Carp::carp __PACKAGE__ . "->_handleFWFault(): Error occurred during processing.\n" . $errMsg; 626 } 627 } 628 629 # Handle Agent SOAP faults. 593 630 # 594 631 # When initially contacting the HoneyClient::Agent daemon running … … 598 635 # and the daemon isn't ready to accept commands from the 599 636 # HoneyClient::Manager yet. 600 sub _handle Fault {637 sub _handleAgentFault { 601 638 602 639 # Extract arguments. … … 615 652 ($errMsg !~ /No route to host/)) { 616 653 $LOG->warn("Error occurred during processing. " . $errMsg); 617 Carp::carp __PACKAGE__ . "->_handle Fault(): Error occurred during processing.\n" . $errMsg;654 Carp::carp __PACKAGE__ . "->_handleAgentFault(): Error occurred during processing.\n" . $errMsg; 618 655 } 619 656 } … … 737 774 $self->{'_agent_handle'} = getClientHandle(namespace => "HoneyClient::Agent", 738 775 address => $self->{'ip_address'}, 739 fault_handler => \&_handle Fault);776 fault_handler => \&_handleAgentFault); 740 777 741 778 eval { … … 1013 1050 } 1014 1051 1052 # Helper function to check if the host system has enough disk 1053 # space available, in order to run the Manager. 1054 sub _checkSpaceAvailable { 1055 1056 my $datastore_path = getVar(name => "datastore_path", 1057 namespace => "HoneyClient::Manager::VM"); 1058 my $snapshot_path = getVar(name => "snapshot_path", 1059 namespace => "HoneyClient::Manager::VM"); 1060 my $min_space_free = getVar(name => "min_space_free", 1061 namespace => "HoneyClient::Manager::VM"); 1062 1063 # Obtain sizes in GB 1064 my $datastore_attr = dfportable($datastore_path, 1024 * 1024 * 1024); 1065 my $snapshot_attr = dfportable($snapshot_path, 1024 * 1024 * 1024); 1066 1067 if ($datastore_attr->{bavail} < $min_space_free) { 1068 $LOG->warn("Directory (" . $datastore_path . ") has low disk space (" . $datastore_attr->{bavail} . " GB)."); 1069 } elsif ($snapshot_attr->{bavail} < $min_space_free) { 1070 $LOG->warn("Directory (" . $snapshot_path . ") has low disk space (" . $snapshot_attr->{bavail} . " GB)."); 1071 } else { 1072 return; 1073 } 1074 $LOG->info("Low disk space detected. Shutting down."); 1075 exit; 1076 } 1077 1015 1078 ####################################################################### 1016 1079 # Public Methods Implemented # … … 1153 1216 # Get the class name. 1154 1217 my $self = shift; 1218 1219 # Sanity check: Make sure there is enough disk space available. 1220 _checkSpaceAvailable(); 1155 1221 1156 1222 # Get the rest of the arguments, as a hashtable.
