Skip to content

Commit

Permalink
Merge pull request #766 from swaschkut/main
Browse files Browse the repository at this point in the history
version 2.1.12
  • Loading branch information
swaschkut authored Jul 31, 2023
2 parents faf0f3e + 028fd97 commit 5ac0b13
Show file tree
Hide file tree
Showing 29 changed files with 136 additions and 59 deletions.
13 changes: 12 additions & 1 deletion CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
CHANGELOG

2.1.11
2.1.12
UTIL:
* type=bpa-generator | extend response output if not valid JSON
* type=gcp | extend for mqsql usage and bring in mysql pw in type=key-manager

BUGFIX:
* type=XYZ | in=api://{MGMT-IP} actions=name-rename - bugfix for API usage

GENERAL:


2.1.11 (20230721)
UTIL:
* type=rule | introduce new 'filter=(timestamp-rule-creation <>=! -30 days)' | timestamp-rule-modification
* type=address | introduce 'filter=(value ip4.included-in RFC1918)'
Expand Down
2 changes: 1 addition & 1 deletion lib/misc-classes/PH.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ function __construct($argv, $argc)

private static $library_version_major = 2;
private static $library_version_sub = 1;
private static $library_version_bugfix = 11;
private static $library_version_bugfix = 12;

//BASIC AUTH PAN-OS 7.1
public static $softwareupdate_key = "658d787f293e631196dac9fb29490f1cc1bb3827";
Expand Down
6 changes: 3 additions & 3 deletions lib/misc-classes/PanAPIConnector.php
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ static public function findOrCreateConnectorFromHost($host, $apiKey = null, $pro
{
PH::$useExceptions = $exceptionUse;

if( $host != "bpa-apikey" && $host != "license-apikey" && $host != "ldap-password" && $host != "maxmind-licensekey" )
if( $host != "bpa-apikey" && $host != "license-apikey" && $host != "ldap-password" && $host != "maxmind-licensekey" && $host != "gcp-mysql-password" )
{
$wrongLogin = TRUE;

Expand Down Expand Up @@ -475,7 +475,7 @@ static public function findOrCreateConnectorFromHost($host, $apiKey = null, $pro
}


if( strlen($apiKey) < 19 && !( $host == "bpa-apikey" || $host == "license-apikey" || $host == "ldap-password" || $host == "maxmind-licensekey" ) )
if( strlen($apiKey) < 19 && !( $host == "bpa-apikey" || $host == "license-apikey" || $host == "ldap-password" || $host == "maxmind-licensekey" || $host == "gcp-mysql-password" ) )
{
$user = $apiKey;

Expand Down Expand Up @@ -523,7 +523,7 @@ static public function findOrCreateConnectorFromHost($host, $apiKey = null, $pro
$connector = new PanAPIConnector($host, $apiKey, 'panos', null, $port);
}

if( $host == "bpa-apikey" || $host == "license-apikey" || $host == "ldap-password" || $host == "maxmind-licensekey" || strpos($host, "tsg_id") !== FALSE )
if( $host == "bpa-apikey" || $host == "license-apikey" || $host == "ldap-password" || $host == "maxmind-licensekey" || strpos($host, "tsg_id" || $host == "gcp-mysql-password") !== FALSE )
{
$checkConnectivity = false;
self::$savedConnectors[] = $connector;
Expand Down
6 changes: 3 additions & 3 deletions lib/object-classes/Address.php
Original file line number Diff line number Diff line change
Expand Up @@ -345,12 +345,12 @@ public function API_setName($newName)
return;
}

if( !$this->setName($newName) )
return FALSE;

$c = findConnectorOrDie($this);
$xpath = $this->getXPath();

if( !$this->setName($newName) )
return FALSE;

if( $c->isAPI() )
$c->sendRenameRequest($xpath, $newName);
elseif( $c->isSaseAPI() )
Expand Down
4 changes: 2 additions & 2 deletions lib/object-classes/AddressGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -690,11 +690,11 @@ public function members()
*/
public function API_setName($newName)
{
$this->setName($newName);

$c = findConnectorOrDie($this);
$xpath = $this->getXPath();

$this->setName($newName);

if( $c->isAPI() )
$c->sendRenameRequest($xpath, $newName);
}
Expand Down
4 changes: 2 additions & 2 deletions lib/object-classes/AntiSpywareProfile.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ public function setName($newName)
*/
public function API_setName($newName)
{
$this->setName($newName);

$c = findConnectorOrDie($this);
$xpath = $this->getXPath();

$this->setName($newName);

if( $c->isAPI() )
$c->sendRenameRequest($xpath, $newName);
}
Expand Down
4 changes: 2 additions & 2 deletions lib/object-classes/AntiVirusProfile.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,11 @@ public function setName($newName)
*/
public function API_setName($newName)
{
$this->setName($newName);

$c = findConnectorOrDie($this);
$xpath = $this->getXPath();

$this->setName($newName);

if( $c->isAPI() )
$c->sendRenameRequest($xpath, $newName);
}
Expand Down
5 changes: 3 additions & 2 deletions lib/object-classes/DNSSecurityProfile.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,11 @@ public function setName($newName)
*/
public function API_setName($newName)
{
$this->setName($newName);

$c = findConnectorOrDie($this);
$xpath = $this->getXPath();

$this->setName($newName);

if( $c->isAPI() )
$c->sendRenameRequest($xpath, $newName);
}
Expand Down
4 changes: 2 additions & 2 deletions lib/object-classes/DataFilteringProfile.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ public function setName($newName)
*/
public function API_setName($newName)
{
$this->setName($newName);

$c = findConnectorOrDie($this);
$xpath = $this->getXPath();

$this->setName($newName);

if( $c->isAPI() )
$c->sendRenameRequest($xpath, $newName);
}
Expand Down
4 changes: 2 additions & 2 deletions lib/object-classes/DecryptionProfile.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,11 @@ public function setName($newName)
*/
public function API_setName($newName)
{
$this->setName($newName);

$c = findConnectorOrDie($this);
$xpath = $this->getXPath();

$this->setName($newName);

if( $c->isAPI() )
$c->sendRenameRequest($xpath, $newName);
}
Expand Down
4 changes: 2 additions & 2 deletions lib/object-classes/FileBlockingProfile.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ public function setName($newName)
*/
public function API_setName($newName)
{
$this->setName($newName);

$c = findConnectorOrDie($this);
$xpath = $this->getXPath();

$this->setName($newName);

if( $c->isAPI() )
$c->sendRenameRequest($xpath, $newName);
}
Expand Down
4 changes: 2 additions & 2 deletions lib/object-classes/Profile.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,11 @@ public function setName($newName)
*/
public function API_setName($newName)
{
$this->setName($newName);

$c = findConnectorOrDie($this);
$xpath = $this->getXPath();

$this->setName($newName);

if( $c->isAPI() )
$c->sendRenameRequest($xpath, $newName);
}
Expand Down
3 changes: 2 additions & 1 deletion lib/object-classes/Region.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,12 @@ public function API_setName($newName)
mwarning('renaming of TMP object in API is not possible, it was ignored');
return;
}
$this->setName($newName);

$c = findConnectorOrDie($this);
$xpath = $this->getXPath();

$this->setName($newName);

if( $c->isAPI() )
$c->sendRenameRequest($xpath, $newName);
}
Expand Down
4 changes: 2 additions & 2 deletions lib/object-classes/SaasSecurityProfile.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@ public function setName($newName)
*/
public function API_setName($newName)
{
$this->setName($newName);

$c = findConnectorOrDie($this);
$xpath = $this->getXPath();

$this->setName($newName);

if( $c->isAPI() )
$c->sendRenameRequest($xpath, $newName);
}
Expand Down
4 changes: 2 additions & 2 deletions lib/object-classes/Schedule.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,11 @@ public function setName($newName)
*/
public function API_setName($newName)
{
$this->setName($newName);

$c = findConnectorOrDie($this);
$xpath = $this->getXPath();

$this->setName($newName);

if( $c->isAPI() )
$c->sendRenameRequest($xpath, $newName);
}
Expand Down
4 changes: 2 additions & 2 deletions lib/object-classes/SecurityProfileGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,11 @@ public function setName($newName)
*/
public function API_setName($newName)
{
$this->setName($newName);

$c = findConnectorOrDie($this);
$xpath = $this->getXPath();

$this->setName($newName);

if( $c->isAPI() )
$c->sendRenameRequest($xpath, $newName);
}
Expand Down
4 changes: 2 additions & 2 deletions lib/object-classes/Service.php
Original file line number Diff line number Diff line change
Expand Up @@ -570,11 +570,11 @@ public function setName($newName)
*/
public function API_setName($newName)
{
$this->setName($newName);

$c = findConnectorOrDie($this);
$xpath = $this->getXPath();

$this->setName($newName);

if( $c->isAPI())
$c->sendRenameRequest($xpath, $newName);
}
Expand Down
4 changes: 2 additions & 2 deletions lib/object-classes/ServiceGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,11 +185,11 @@ public function setName($newName)
*/
public function API_setName($newName)
{
$this->setName($newName);

$c = findConnectorOrDie($this);
$xpath = $this->getXPath();

$this->setName($newName);

if( $c->isAPI())
$c->sendRenameRequest($xpath, $newName);
}
Expand Down
4 changes: 2 additions & 2 deletions lib/object-classes/URLProfile.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,11 @@ public function setName($newName)
*/
public function API_setName($newName)
{
$this->setName($newName);

$c = findConnectorOrDie($this);
$xpath = $this->getXPath();

$this->setName($newName);

if( $c->isAPI())
$c->sendRenameRequest($xpath, $newName);
}
Expand Down
4 changes: 2 additions & 2 deletions lib/object-classes/VirusAndWildfireProfile.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ public function setName($newName)
*/
public function API_setName($newName)
{
$this->setName($newName);

$c = findConnectorOrDie($this);
$xpath = $this->getXPath();

$this->setName($newName);

if( $c->isAPI())
$c->sendRenameRequest($xpath, $newName);
}
Expand Down
4 changes: 2 additions & 2 deletions lib/object-classes/VulnerabilityProfile.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@ public function setName($newName)
*/
public function API_setName($newName)
{
$this->setName($newName);

$c = findConnectorOrDie($this);
$xpath = $this->getXPath();

$this->setName($newName);

if( $c->isAPI())
$c->sendRenameRequest($xpath, $newName);
}
Expand Down
4 changes: 2 additions & 2 deletions lib/object-classes/WildfireProfile.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ public function setName($newName)
*/
public function API_setName($newName)
{
$this->setName($newName);

$c = findConnectorOrDie($this);
$xpath = $this->getXPath();

$this->setName($newName);

if( $c->isAPI())
$c->sendRenameRequest($xpath, $newName);
}
Expand Down
4 changes: 2 additions & 2 deletions lib/object-classes/customURLProfile.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,11 @@ public function setName($newName)
*/
public function API_setName($newName)
{
$this->setName($newName);

$c = findConnectorOrDie($this);
$xpath = $this->getXPath();

$this->setName($newName);

if( $c->isAPI())
$c->sendRenameRequest($xpath, $newName);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/rule-classes/DefaultSecurityRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ public function securityProfileType()
public function securityProfileGroup()
{
if( $this->secproftype != 'group' )
derr('Cannot be called on a rule that is of security type =' . $this->secproftype);
derr('Cannot be called on a rule that is of security profile type = "' . $this->secproftype.'"');

return $this->secprofgroup;
}
Expand Down
4 changes: 2 additions & 2 deletions lib/rule-classes/Rule.php
Original file line number Diff line number Diff line change
Expand Up @@ -701,9 +701,9 @@ public function API_setName($newname)
$con = findConnectorOrDie($this);
$xpath = $this->getXPath();

$con->sendRenameRequest($xpath, $newname);

$this->setName($newname);

$con->sendRenameRequest($xpath, $newname);
}

public function API_clearPolicyAppUsageDATA()
Expand Down
2 changes: 2 additions & 0 deletions utils/common/actions-service.php
Original file line number Diff line number Diff line change
Expand Up @@ -1052,6 +1052,8 @@
return;
}

$newName = str_replace(",", "_", $newName);

$string = "new name will be '{$newName}'";
PH::ACTIONlog( $context, $string );

Expand Down
7 changes: 4 additions & 3 deletions utils/lib/BPAGENERATOR.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,12 +170,13 @@ function send_bpa_api($url, $type = "GET", $config = null, $system_info = null,
{
$reply = json_decode($response, TRUE);
if( $reply === null )
{
PH::print_stdout( "RESPONSE: ".$response);
derr( "invalid JSON file provided", null, FALSE );
}

if( isset( $reply['task_id'] ) )
{
#print_r( $reply );
$response = $reply['task_id'];
}
else
{
print_r( $reply );
Expand Down
Loading

0 comments on commit 5ac0b13

Please sign in to comment.