Skip to content

Commit

Permalink
Merge pull request #92 from swaschkut/developer
Browse files Browse the repository at this point in the history
framework appStore | general improvements to bring in appStore on each level/hierarchy and not only at shared level
  • Loading branch information
swaschkut authored Jul 19, 2021
2 parents 5591d09 + 807b0ac commit 42c68e9
Show file tree
Hide file tree
Showing 32 changed files with 519 additions and 220 deletions.
12 changes: 11 additions & 1 deletion CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
CHANGELOG

2.0.7
2.0.8
UTILS:

BUGFIX:

GENERAL:
* SecurityProfile classes rename from XYZStore to XYZ
* class App - introduce methods isApplicationCustom() / isApplicationFilter() / isApplicationGroup()


2.0.7 (20210717)
UTILS:
* pa_securityprofilegroup-edit | new actions=securityProfile-Set and securityProfile-Remove - new filters: * secprof: as-profile.is, as-profile.is.set, av-profile.is, av-profile.is.set, data-profile.is, data-profile.is.set, file-profile.is, file-profile.is.set, url-profile.is, url-profile.is.set, vuln-profile.is, vuln-profile.is.set, wf-profile.is, wf-profile.is.set
* introduce new script pa_application-edit; with different filters
Expand Down
6 changes: 5 additions & 1 deletion lib/container-classes/AppRuleContainer.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,11 @@ public function load_from_domxml($xml)
derr('this container has members with empty name!', $node);
}

$f = $this->parentCentralStore->findOrCreate($lower, $this);

/** @var AppStore $appStore */
$appStore = $this->owner->owner->owner->appStore;
$f = $appStore->findorCreate( $lower, $this);

$this->o[] = $f;
$i++;
}
Expand Down
20 changes: 10 additions & 10 deletions lib/container-classes/UrlCategoryRuleContainer.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

/**
* Class UrlCategoryRuleContainer
* @property customURLProfileStore[]|URLProfileStore[] $o
* @property customURLProfile[]|URLProfile[] $o
* @property Rule|SecurityRule $owner
*
*/
Expand All @@ -43,7 +43,7 @@ public function __construct($owner)


/**
* @param customURLProfileStore|URLProfileStore $Obj
* @param customURLProfile|URLProfile $Obj
* @param bool $rewriteXml
* @return bool
*/
Expand All @@ -61,7 +61,7 @@ public function add($Obj, $rewriteXml = TRUE)
}

/**
* @param customURLProfileStore|URLProfileStore $Obj
* @param customURLProfile|URLProfile $Obj
* @param bool $rewritexml
* @return bool
*/
Expand All @@ -84,7 +84,7 @@ public function isApplicationDefault()


/**
* @param customURLProfileStore|URLProfileStore $Obj
* @param customURLProfile|URLProfile $Obj
* @param bool $rewriteXml
* @param bool $forceAny
*
Expand All @@ -110,7 +110,7 @@ public function remove($Obj, $rewriteXml = TRUE, $forceAny = FALSE)
}

/**
* @param customURLProfileStore|URLProfileStore $Obj
* @param customURLProfile|URLProfile $Obj
* @param bool $rewriteXml
* @param bool $forceAny
* @return bool
Expand Down Expand Up @@ -142,7 +142,7 @@ public function setAny()


/**
* @param customURLProfileStore|URLProfileStore|string $object can be customURLProfileStore|URLProfileStore object or object name (string)
* @param customURLProfile|URLProfile|string $object can be customURLProfileStore|URLProfileStore object or object name (string)
* @return bool
*/
public function has($object, $caseSensitive = TRUE)
Expand All @@ -153,7 +153,7 @@ public function has($object, $caseSensitive = TRUE)

/**
* return an array with all objects
* @return customURLProfileStore[]|URLProfileStore[]
* @return customURLProfile[]|URLProfile[]
*/
public function members()
{
Expand All @@ -162,7 +162,7 @@ public function members()

/**
* return an array with all objects
* @return customURLProfileStore[]|URLProfileStore[]
* @return customURLProfile[]|URLProfile[]
*/
public function all()
{
Expand Down Expand Up @@ -364,7 +364,7 @@ public function isAny()


/**
* @param customURLProfileStore|URLProfileStore
* @param customURLProfile|URLProfile
* @param bool $anyIsAcceptable
* @return bool
*/
Expand Down Expand Up @@ -468,7 +468,7 @@ public function includesStoreExpanded(UrlCategoryRuleContainer $other, $anyIsAcc
}

/**
* @return customURLProfileStore[]|URLProfileStore[]
* @return customURLProfile[]|URLProfile[]
*/
public function &membersExpanded($keepGroupsInList = FALSE)
{
Expand Down
29 changes: 17 additions & 12 deletions lib/device-and-system-classes/Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,13 @@ public function __construct($owner)
$this->tagStore = new TagStore($this);
$this->tagStore->name = 'tags';

//Todo: swaschkut 20210718 each Container should also have its own zoneStore???
$this->zoneStore = $owner->zoneStore;
$this->appStore = $owner->appStore;
#$this->zoneStore = new ZoneStore($this);
#$this->zoneStore->setName('zoneStore');

$this->appStore = new AppStore($this);
$this->appStore->name = 'customApplication';

$this->serviceStore = new ServiceStore($this);
$this->serviceStore->name = 'services';
Expand All @@ -183,28 +188,28 @@ public function __construct($owner)
$this->addressStore->name = 'address';


$this->customURLProfileStore = new SecurityProfileStore($this, "customURLProfileStore");
$this->customURLProfileStore = new SecurityProfileStore($this, "customURLProfile");
$this->customURLProfileStore->name = 'CustomURL';

$this->URLProfileStore = new SecurityProfileStore($this, "URLProfileStore");
$this->URLProfileStore = new SecurityProfileStore($this, "URLProfile");
$this->URLProfileStore->name = 'URL';

#$this->AntiVirusProfileStore = new SecurityProfileStore($this, "AntiVirusProfileStore");
#$this->AntiVirusProfileStore = new SecurityProfileStore($this, "AntiVirusProfile");
#$this->AntiVirusProfileStore->name = 'AntiVirus';

$this->VirusAndWildfireProfileStore = new SecurityProfileStore($this, "VirusAndWildfireProfileStore");
$this->VirusAndWildfireProfileStore = new SecurityProfileStore($this, "VirusAndWildfireProfile");
$this->VirusAndWildfireProfileStore->name = 'VirusAndWildfire';

$this->DNSSecurityProfileStore = new SecurityProfileStore($this, "DNSSecurityProfileStore");
$this->DNSSecurityProfileStore = new SecurityProfileStore($this, "DNSSecurityProfile");
$this->DNSSecurityProfileStore->name = 'DNSSecurity';

$this->VulnerabilityProfileStore = new SecurityProfileStore($this, "VulnerabilityProfileStore");
$this->VulnerabilityProfileStore = new SecurityProfileStore($this, "VulnerabilityProfile");
$this->VulnerabilityProfileStore->name = 'Vulnerability';

$this->AntiSpywareProfileStore = new SecurityProfileStore($this, "AntiSpywareProfileStore");
$this->AntiSpywareProfileStore = new SecurityProfileStore($this, "AntiSpywareProfile");
$this->AntiSpywareProfileStore->name = 'AntiSpyware';

$this->FileBlockingProfileStore = new SecurityProfileStore($this, "FileBlockingProfileStore");
$this->FileBlockingProfileStore = new SecurityProfileStore($this, "FileBlockingProfile");
$this->FileBlockingProfileStore->name = 'FileBlocking';

#$this->WildfireProfileStore = new SecurityProfileStore($this, "SecurityProfileWildFire");
Expand All @@ -215,13 +220,13 @@ public function __construct($owner)
$this->securityProfileGroupStore->name = 'SecurityProfileGroups';


$this->DecryptionProfileStore = new SecurityProfileStore($this, "DecryptionProfileStore");
$this->DecryptionProfileStore = new SecurityProfileStore($this, "DecryptionProfile");
$this->DecryptionProfileStore->name = 'Decryption';

$this->HipObjectsProfileStore = new SecurityProfileStore($this, "HipObjectsProfileStore");
$this->HipObjectsProfileStore = new SecurityProfileStore($this, "HipObjectsProfile");
$this->HipObjectsProfileStore->name = 'HipObjects';

$this->HipProfilesProfileStore = new SecurityProfileStore($this, "HipProfilesProfileStore");
$this->HipProfilesProfileStore = new SecurityProfileStore($this, "HipProfilesProfile");
$this->HipProfilesProfileStore->name = 'HipProfiles';

$this->scheduleStore = new ScheduleStore($this);
Expand Down
29 changes: 17 additions & 12 deletions lib/device-and-system-classes/DeviceCloud.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,9 @@ public function __construct(FawkesConf $owner, Container $applicableDG = null)
#$this->importedInterfaces = new InterfaceContainer($this, $owner->network);
#$this->importedVirtualRouter = new VirtualRouterContainer($this, $owner->network);

$this->appStore = $owner->appStore;
#$this->appStore = $owner->appStore;
$this->appStore = new AppStore($this);
$this->appStore->name = 'customApplication';

$this->zoneStore = new ZoneStore($this);
$this->zoneStore->setName('zoneStore');
Expand All @@ -182,28 +184,28 @@ public function __construct(FawkesConf $owner, Container $applicableDG = null)
$this->addressStore->name = 'addresses';


$this->customURLProfileStore = new SecurityProfileStore($this, "customURLProfileStore");
$this->customURLProfileStore = new SecurityProfileStore($this, "customURLProfile");
$this->customURLProfileStore->name = 'CustomURL';

$this->URLProfileStore = new SecurityProfileStore($this, "URLProfileStore");
$this->URLProfileStore = new SecurityProfileStore($this, "URLProfile");
$this->URLProfileStore->name = 'URL';

#$this->AntiVirusProfileStore = new SecurityProfileStore($this, "AntiVirusProfileStore");
#$this->AntiVirusProfileStore = new SecurityProfileStore($this, "AntiVirusProfile");
#$this->AntiVirusProfileStore->name = 'AntiVirus';

$this->VirusAndWildfireProfileStore = new SecurityProfileStore($this, "VirusAndWildfireProfileStore");
$this->VirusAndWildfireProfileStore = new SecurityProfileStore($this, "VirusAndWildfireProfile");
$this->VirusAndWildfireProfileStore->name = 'VirusAndWildfire';

$this->DNSSecurityProfileStore = new SecurityProfileStore($this, "DNSSecurityProfileStore");
$this->DNSSecurityProfileStore = new SecurityProfileStore($this, "DNSSecurityProfile");
$this->DNSSecurityProfileStore->name = 'DNSSecurity';

$this->VulnerabilityProfileStore = new SecurityProfileStore($this, "VulnerabilityProfileStore");
$this->VulnerabilityProfileStore = new SecurityProfileStore($this, "VulnerabilityProfile");
$this->VulnerabilityProfileStore->name = 'Vulnerability';

$this->AntiSpywareProfileStore = new SecurityProfileStore($this, "AntiSpywareProfileStore");
$this->AntiSpywareProfileStore = new SecurityProfileStore($this, "AntiSpywareProfile");
$this->AntiSpywareProfileStore->name = 'AntiSpyware';

$this->FileBlockingProfileStore = new SecurityProfileStore($this, "FileBlockingProfileStore");
$this->FileBlockingProfileStore = new SecurityProfileStore($this, "FileBlockingProfile");
$this->FileBlockingProfileStore->name = 'FileBlocking';

#$this->WildfireProfileStore = new SecurityProfileStore($this, "SecurityProfileWildFire");
Expand All @@ -214,13 +216,13 @@ public function __construct(FawkesConf $owner, Container $applicableDG = null)
$this->securityProfileGroupStore->name = 'SecurityProfileGroups';


$this->DecryptionProfileStore = new SecurityProfileStore($this, "DecryptionProfileStore");
$this->DecryptionProfileStore = new SecurityProfileStore($this, "DecryptionProfile");
$this->DecryptionProfileStore->name = 'Decryption';

$this->HipObjectsProfileStore = new SecurityProfileStore($this, "HipObjectsProfileStore");
$this->HipObjectsProfileStore = new SecurityProfileStore($this, "HipObjectsProfile");
$this->HipObjectsProfileStore->name = 'HipObjects';

$this->HipProfilesProfileStore = new SecurityProfileStore($this, "HipProfilesProfileStore");
$this->HipProfilesProfileStore = new SecurityProfileStore($this, "HipProfilesProfile");
$this->HipProfilesProfileStore->name = 'HipProfiles';


Expand Down Expand Up @@ -303,6 +305,9 @@ public function load_from_domxml($xml)
$this->addressStore->parentCentralStore = $parentContainer->addressStore;
$this->serviceStore->parentCentralStore = $parentContainer->serviceStore;
$this->tagStore->parentCentralStore = $parentContainer->tagStore;
$this->scheduleStore->parentCentralStore = $parentContainer->scheduleStore;
$this->appStore->parentCentralStore = $parentContainer->appStore;
$this->securityProfileGroupStore->parentCentralStore = $parentContainer->securityProfileGroupStore;
//Todo: swaschkut 20210505 - check if other Stores must be added
//- appStore;scheduleStore/securityProfileGroupStore/all kind of SecurityProfile
}
Expand Down
29 changes: 17 additions & 12 deletions lib/device-and-system-classes/DeviceGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,11 @@ public function __construct($owner)
$this->tagStore->name = 'tags';

$this->zoneStore = $owner->zoneStore;
$this->appStore = $owner->appStore;

//this is not working correctly - each DG has its own appstore
#$this->appStore = $owner->appStore;
$this->appStore = new AppStore($this);
$this->appStore->name = 'customApplication';

$this->serviceStore = new ServiceStore($this);
$this->serviceStore->name = 'services';
Expand All @@ -164,43 +168,43 @@ public function __construct($owner)
$this->addressStore->name = 'address';


$this->customURLProfileStore = new SecurityProfileStore($this, "customURLProfileStore");
$this->customURLProfileStore = new SecurityProfileStore($this, "customURLProfile");
$this->customURLProfileStore->name = 'CustomURL';

$this->URLProfileStore = new SecurityProfileStore($this, "URLProfileStore");
$this->URLProfileStore = new SecurityProfileStore($this, "URLProfile");
$this->URLProfileStore->name = 'URL';

$this->AntiVirusProfileStore = new SecurityProfileStore($this, "AntiVirusProfileStore");
$this->AntiVirusProfileStore = new SecurityProfileStore($this, "AntiVirusProfile");
$this->AntiVirusProfileStore->name = 'AntiVirus';


$this->VulnerabilityProfileStore = new SecurityProfileStore($this, "VulnerabilityProfileStore");
$this->VulnerabilityProfileStore = new SecurityProfileStore($this, "VulnerabilityProfile");
$this->VulnerabilityProfileStore->name = 'Vulnerability';

$this->AntiSpywareProfileStore = new SecurityProfileStore($this, "AntiSpywareProfileStore");
$this->AntiSpywareProfileStore = new SecurityProfileStore($this, "AntiSpywareProfile");
$this->AntiSpywareProfileStore->name = 'AntiSpyware';

$this->FileBlockingProfileStore = new SecurityProfileStore($this, "FileBlockingProfileStore");
$this->FileBlockingProfileStore = new SecurityProfileStore($this, "FileBlockingProfile");
$this->FileBlockingProfileStore->name = 'FileBlocking';

$this->DataFilteringProfileStore = new SecurityProfileStore($this, "DataFilteringProfileStore");
$this->DataFilteringProfileStore = new SecurityProfileStore($this, "DataFilteringProfile");
$this->DataFilteringProfileStore->name = 'DataFiltering';

$this->WildfireProfileStore = new SecurityProfileStore($this, "WildfireProfileStore");
$this->WildfireProfileStore = new SecurityProfileStore($this, "WildfireProfile");
$this->WildfireProfileStore->name = 'WildFire';


$this->securityProfileGroupStore = new SecurityProfileGroupStore($this);
$this->securityProfileGroupStore->name = 'SecurityProfileGroups';


$this->DecryptionProfileStore = new SecurityProfileStore($this, "DecryptionProfileStore");
$this->DecryptionProfileStore = new SecurityProfileStore($this, "DecryptionProfile");
$this->DecryptionProfileStore->name = 'Decryption';

$this->HipObjectsProfileStore = new SecurityProfileStore($this, "HipObjectsProfileStore");
$this->HipObjectsProfileStore = new SecurityProfileStore($this, "HipObjectsProfile");
$this->HipObjectsProfileStore->name = 'HipObjects';

$this->HipProfilesProfileStore = new SecurityProfileStore($this, "HipProfilesProfileStore");
$this->HipProfilesProfileStore = new SecurityProfileStore($this, "HipProfilesProfile");
$this->HipProfilesProfileStore->name = 'HipProfiles';

$this->scheduleStore = new ScheduleStore($this);
Expand Down Expand Up @@ -710,6 +714,7 @@ public function load_from_domxml($xml)
$this->serviceStore->nestedPointOfView();
$this->tagStore->nestedPointOfView();
$this->scheduleStore->nestedPointOfView();
$this->appStore->nestedPointOfView();

}

Expand Down
8 changes: 7 additions & 1 deletion lib/device-and-system-classes/FawkesConf.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public function __construct()
$this->zoneStore->setName('zoneStore');


$this->appStore = AppStore::getPredefinedStore();
$this->appStore = AppStore::getPredefinedStore( $this );

$this->urlStore = SecurityProfileStore::getPredefinedStore();

Expand Down Expand Up @@ -331,6 +331,8 @@ public function load_from_domxml($xml)
$ldv->serviceStore->parentCentralStore = $parentContainer->serviceStore;
$ldv->tagStore->parentCentralStore = $parentContainer->tagStore;
$ldv->scheduleStore->parentCentralStore = $parentContainer->scheduleStore;
$ldv->appStore->parentCentralStore = $parentContainer->appStore;
$ldv->securityProfileGroupStore->parentCentralStore = $parentContainer->securityProfileGroupStore;
//Todo: swaschkut 20210505 - check if other Stores must be added
//- appStore;scheduleStore/securityProfileGroupStore/all kind of SecurityProfile
}
Expand Down Expand Up @@ -840,6 +842,8 @@ public function createContainer($name, $parentContainerName)
$newDG->serviceStore->parentCentralStore = $parentContainer->serviceStore;
$newDG->tagStore->parentCentralStore = $parentContainer->tagStore;
$newDG->scheduleStore->parentCentralStore = $parentContainer->scheduleStore;
$newDG->appStore->parentCentralStore = $parentContainer->appStore;
$newDG->securityProfileGroupStore->parentCentralStore = $parentContainer->securityProfileGroupStore;
//Todo: swaschkut 20210505 - check if other Stores must be added
//- appStore;scheduleStore/securityProfileGroupStore/all kind of SecurityProfile
}
Expand Down Expand Up @@ -913,6 +917,8 @@ public function createDeviceCloud($name, $parentContainer_txt )
$newDG->serviceStore->parentCentralStore = $parentContainer->serviceStore;
$newDG->tagStore->parentCentralStore = $parentContainer->tagStore;
$newDG->scheduleStore->parentCentralStore = $parentContainer->scheduleStore;
$newDG->appStore->parentCentralStore = $parentContainer->appStore;
$newDG->securityProfileGroupStore->parentCentralStore = $parentContainer->securityProfileGroupStore;
//Todo: swaschkut 20210505 - check if other Stores must be added
//- appStore;scheduleStore/securityProfileGroupStore/all kind of SecurityProfile
}
Expand Down
Loading

0 comments on commit 42c68e9

Please sign in to comment.