/
vv.php
85 lines (70 loc) · 4.06 KB
/
vv.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<?php
//=============================================================================
//
// File: /var/vli/vv.php
//
// Language: PHP
//
// Contents: Executable script
//
// Author: Joe Honton © 2010
//
// Initial date: December 15, 2010
//
//=============================================================================
require_once( dirname(__FILE__) . '/include/commandline.inc' );
require_once( dirname(__FILE__) . '/include/rulebook-options.inc' );
require_once( dirname(__FILE__) . '/include/managed-object.inc' );
require_once( dirname(__FILE__) . '/include/namespace-objects.inc' );
require_once( dirname(__FILE__) . '/include/composite-objects.inc' );
require_once( dirname(__FILE__) . '/include/resource-objects.inc' );
require_once( dirname(__FILE__) . '/include/substitution-objects.inc' );
require_once( dirname(__FILE__) . '/include/load-modules.inc' );
require_once( dirname(__FILE__) . '/include/output.inc' );
require_once( dirname(__FILE__) . '/include/verbose.inc' );
require_once( dirname(__FILE__) . '/include/evaluate-resources.inc' );
require_once( dirname(__FILE__) . '/include/validate-rules.inc' );
require_once( dirname(__FILE__) . '/include/assertion.inc' );
$fstderr = false; // log file
$commandline = null; // an array of arrays keyed on: 'commands', 'options', 'flags', 'arguments'.
$reserved_keywords = array( 'namespace', 'object' ); // Do not allow these in namespace configuration files
$config = new vmtVermontRulebookOptions();// the in-memory representation of the rulebook options file '/var/vli/etc/rulebook-options'
$plugin_module_files = array(); // A list of fully qualified module filenames accessible via classname
// e.g. $plugin_module_files['vmtVirtualhost'] = '/var/vli/modules/virtualhost.inc'
$plugin_module_classes = array(); // A list of module class names accessible via 'type'
// e.g. $plugin_module_classes['virtualhost'] = 'vmtVirtualhost';
$logfile_module_files = array(); // A list of fully qualified logfile parse filenames accessible via classname
// e.g. $logfile_module_files['vmtLogfileIptables'] = '/var/vli/modules/logfile-modules/iptables.inc'
$logfile_module_classes = array(); // A list of logfile class names accessible via 'logformat'
// e.g. $logfile_module_classes['iptables'] = 'vmtLogfileIptables';
$resource_module_files = array(); // A list of fully qualified resource module filenames accessible via classname
// e.g. $resource_module_files['vmtResourceMemory'] = '/var/vli/modules/resource-modules/memory.inc'
$resource_module_classes = array(); // A list of resource module class names accessible via 'subtype'
// e.g. $resource_module_classes['memory'] = 'vmtResourceMemory';
$namespace_stage = array(); // array of vmtManagedObjects parsed from the object/namespace files
$composite_stage = array(); // array of vmtManagedObjects where "namespace" attributes and "object" attributes are merged
$substitution_stage = array(); // array of vmtManagedObjects where static substitution variables have been replaced
$resource_stage = array(); // array of vmtManagedObjects where vmtResource dynamic substitution variables have been replaced
// Parse command line arguments which will override any default values specified
// in the rulebook options file.
ParseCommandline();
ReadRulebookOptions();
LogCommandline();
// Discover and load into memory all code modules, by reading them from disk.
DiscoverAndLoadModules();
// Read the namespace-object files from disk instantiating the namespaces object and base objects,
// then merge the namespace and base objects together
ReadNamespaces();
MergeIntoCompositeObjects();
// Copy all composite-stage object to the resource-stage collection,
// and evaluate all vmtResource-derived objects in dependency order.
CopyToResourceStage();
EvaluateResourceObjects();
// Substitute variables with their values
ApplyStaticSubstitutions();
// Loop through all non-vmtResource objects, in dependency order, and validate
// using the keyword-specified rules.
ValidateRuleObjects();
stdlog( "End" );
exit;
?>