Skip to content

Commit

Permalink
Merge pull request #439 from swaschkut/developer
Browse files Browse the repository at this point in the history
UTIL type=securityprofilegroup | actions=securityProfile-Set - extend…
  • Loading branch information
swaschkut authored Feb 4, 2022
2 parents 4439ac8 + bdea789 commit 3169479
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 14 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ UTILS:
* UTIL type=tag-merger | introduce help info for dupalgorithm=SameName
* UTIL all types | argument "outputformatset" status BETA - return all "set/delete commands" done by a PAN-OS-PHP UTIL script
* class UTIL | improve error handling for file not found if shadow-json is used
* UTIL type=securityprofilegroup | actions=securityProfile-Set - extend output if Profile is not found and skipped

BUGFIX:
* UTIL type=device | actions=securityprofile-create-alert-only - bugfix for PAN-OS 8.1 - including fix for ironskillet download
Expand Down
63 changes: 49 additions & 14 deletions utils/common/actions-securityprofilegroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,20 +70,49 @@

$ret = TRUE;

//Todo: check if $profName is available
if( $type == 'virus' )
$ret = $secprofgroup->setSecProf_AV($profName);
{
$found = $secprofgroup->owner->owner->AntiVirusProfileStore->find( $profName, null, true );
if( $found )
$ret = $secprofgroup->setSecProf_AV($profName);
}
elseif( $type == 'vulnerability' )
$ret = $secprofgroup->setSecProf_Vuln($profName);
{
$found = $secprofgroup->owner->owner->VulnerabilityProfileStore->find( $profName, null, true );
if( $found )
$ret = $secprofgroup->setSecProf_Vuln($profName);
}
elseif( $type == 'url-filtering' )
$ret = $secprofgroup->setSecProf_URL($profName);
{
$found = $secprofgroup->owner->owner->URLProfileStore->find( $profName, null, true );
if( $found )
$ret = $secprofgroup->setSecProf_URL($profName);
}
elseif( $type == 'data-filtering' )
$ret = $secprofgroup->setSecProf_DataFilt($profName);
{
$found = $secprofgroup->owner->owner->DataFilteringProfileStore->find( $profName, null, true );
if( $found )
$ret = $secprofgroup->setSecProf_DataFilt($profName);
}
elseif( $type == 'file-blocking' )
$ret = $secprofgroup->setSecProf_FileBlock($profName);
{
$found = $secprofgroup->owner->owner->FileBlockingProfileStore->find( $profName, null, true );
if( $found )
$ret = $secprofgroup->setSecProf_FileBlock($profName);
}
elseif( $type == 'spyware' )
$ret = $secprofgroup->setSecProf_Spyware($profName);
{
$found = $secprofgroup->owner->owner->AntiSpywareProfileStore->find( $profName, null, true );
if( $found )
$ret = $secprofgroup->setSecProf_Spyware($profName);
}
elseif( $type == 'wildfire' )
$ret = $secprofgroup->setSecProf_Wildfire($profName);
{
$found = $secprofgroup->owner->owner->WildfireProfileStore->find( $profName, null, true );
if( $found )
$ret = $secprofgroup->setSecProf_Wildfire($profName);
}
else
derr("unsupported profile type '{$type}'");

Expand All @@ -95,16 +124,22 @@
}


if( $context->isAPI )
if( $found !== null )
{
$xpath = $secprofgroup->getXPath();
$con = findConnectorOrDie($secprofgroup);
$con->sendEditRequest($xpath, DH::dom_to_xml($secprofgroup->xmlroot, -1, FALSE));
if( $context->isAPI )
{
$xpath = $secprofgroup->getXPath();
$con = findConnectorOrDie($secprofgroup);
$con->sendEditRequest($xpath, DH::dom_to_xml($secprofgroup->xmlroot, -1, FALSE));
}
else
$secprofgroup->rewriteXML();
}
else
#$secprofgroup->rewriteSecProfXML();
$secprofgroup->rewriteXML();

{
$string = "Securityprofile: '".$profName."' NOT found - can not be added to this SecurityProfile Group: '".$secprofgroup->name()."'";
PH::ACTIONstatus( $context, "SKIPPED", $string );
}
},
'args' => array('type' => array('type' => 'string', 'default' => '*nodefault*',
'choices' => array('virus', 'vulnerability', 'url-filtering', 'data-filtering', 'file-blocking', 'spyware', 'wildfire')),
Expand Down

0 comments on commit 3169479

Please sign in to comment.