Skip to content

Commit

Permalink
Merge pull request #538 from swaschkut/main
Browse files Browse the repository at this point in the history
UTIL API - move from develop into production
  • Loading branch information
swaschkut authored Apr 4, 2022
2 parents ee91eed + be31588 commit a28f594
Show file tree
Hide file tree
Showing 18 changed files with 341 additions and 19 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ UTILS:
* UTIL type=service | introduce actions=split-large-service-groups:MAXnumber
* UTIL type=[ALLMERGER] - duplicate code reduction - output improvements
* UTIL type=device | introduce new actions=DefaultSecurityRule-SecurityProfile-SetAlert/ DefaultSecurityRule-SecurityProfileGroup-Set:SECPROFGROUP
* UTIL API - move from develop into production

BUGFIX:
* class DeviceGroup / Template - remove $xmlroot as already defined in trait XmlConvertible
Expand Down
18 changes: 12 additions & 6 deletions READMEdocker.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,13 @@ Windows Docker WSL installation check
["<a href='https://docs.microsoft.com/en-gb/windows/wsl/install-manual#step-5---set-wsl-2-as-your-default-version' target='_blank' rel='noopener noreferrer'>Step 5 - Set WSL 2 as your default version</a>"]


Update your Docker PAN-OS-PHP container
============
```bash
docker pull swaschkut/pan-os-php:latest
```


#Additional Information

Docker build
Expand Down Expand Up @@ -80,7 +87,6 @@ For a quick start please use [WIKI docker](https://github.com/PaloAltoNetworks/p




Docker PAN-OS-PHP API and UI
============
final production Container:
Expand All @@ -102,12 +108,12 @@ To get it working on your own PAN-OS Firewall / Panorama config files,
please upload your config files via PAN-OS-PHP UI (URL above)

It is also now possible to start using it with the previous uploaded file via PAN-OS-PHP API:
http://localhost:8082/utils/develop/api/v1/tool.php/address?in=YOUR_CONFIG_FILE.xml
http://localhost:8082/utils/api/v1/tool.php/address?in=YOUR_CONFIG_FILE.xml


The PAN-OS-PHP API is right now under development, but please feel free to try it out:
```bash
http://localhost:8082/utils/develop/api/v1/tool.php
http://localhost:8082/utils/api/v1/tool.php
```

The following "RESTAPI" routes are available:
Expand Down Expand Up @@ -156,16 +162,16 @@ The following "RESTAPI" routes are available:

PAN-OS-PHP API is also working with PAN-OS XML API, therefor you need to prepare you Docker installation:
```bash
API: http://localhost:8082/utils/develop/api/v1/tool.php/key-manager?&add=MGMTIP&user=USERNAME&pw=PASSWORD
API: http://localhost:8082/utils/api/v1/tool.php/key-manager?&add=MGMTIP&user=USERNAME&pw=PASSWORD
```


Exmamples to run PAN-OS-PHP against PAN-OS FW and Panorama offline configuration files, and manipulate in the same way as on PAN-OS-PHP ClI:
```bash
ClI: pan-os-php type=address help
API: http://localhost:8082/utils/develop/api/v1/tool.php/address?help
API: http://localhost:8082/utils/api/v1/tool.php/address?help
```
```bash
CLI: pan-os-php type=address listactions
API: http://localhost:8082/utils/develop/api/v1/tool.php/address?listactions
API: http://localhost:8082/utils/api/v1/tool.php/address?listactions
```
2 changes: 1 addition & 1 deletion docker/Dockerfile-API
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ COPY utils /var/www/html/utils
COPY tests /var/www/html/tests
COPY log /var/www/html/log

RUN chmod -R 777 /var/www/html/utils/develop/api/v1/project
RUN chmod -R 777 /var/www/html/utils/api/v1/project
RUN chmod -R 777 /var/www/html/log

# PHP library of pan-os-php
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile-API74
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ COPY utils /var/www/html/utils
COPY tests /var/www/html/tests
COPY log /var/www/html/log

RUN chmod -R 777 /var/www/html/utils/develop/api/v1/project
RUN chmod -R 777 /var/www/html/utils/api/v1/project
RUN chmod -R 777 /var/www/html/log

# PHP library of pan-os-php
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile-API80
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ COPY utils /var/www/html/utils
COPY tests /var/www/html/tests
COPY log /var/www/html/log

RUN chmod -R 777 /var/www/html/utils/develop/api/v1/project
RUN chmod -R 777 /var/www/html/utils/api/v1/project
RUN chmod -R 777 /var/www/html/log

# PHP library of pan-os-php
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile-API81
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ COPY utils /var/www/html/utils
COPY tests /var/www/html/tests
COPY log /var/www/html/log

RUN chmod -R 777 /var/www/html/utils/develop/api/v1/project
RUN chmod -R 777 /var/www/html/utils/api/v1/project
RUN chmod -R 777 /var/www/html/log

# PHP library of pan-os-php
Expand Down
2 changes: 2 additions & 0 deletions lib/misc-classes/PH.php
Original file line number Diff line number Diff line change
Expand Up @@ -1077,6 +1077,8 @@ public static function callPANOSPHP( $type, $argv, $argc, $PHP_FILE )
)
$util = new UTIL($type, $argv, $argc,$PHP_FILE." type=".$type);

$util->endOfScript();

return $util;
}
}
1 change: 1 addition & 0 deletions lib/misc-classes/PanAPIConnector.php
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,7 @@ public function testConnectivity( $checkHost = "" )
PH::print_stdout( " - PAN-OS version: ".$this->info_PANOS_version );
PH::$JSON_TMP[$checkHost]['panos']['version'] = $this->info_PANOS_version;
PH::$JSON_TMP[$checkHost]['panos']['type'] = $this->info_deviceType;
PH::$JSON_TMP[$checkHost]['status'] = "success";
}


Expand Down
Loading

0 comments on commit a28f594

Please sign in to comment.