12
12
# export PANOS_USER="" #User *MUST* have Commit and Import Permissions in XML API for Admin Role
13
13
# export PANOS_PASS=""
14
14
#
15
+ # OPTIONAL
16
+ # export PANOS_TEMPLATE="" #Template Name of panorama managed devices
17
+ #
15
18
# The script will automatically generate a new API key if
16
19
# no key is found, or if a saved key has expired or is invalid.
17
20
@@ -77,7 +80,10 @@ deployer() {
77
80
content=" $content ${nl} --$delim ${nl} Content-Disposition: form-data; name=\" certificate-name\" \r\n\r\n$_cdomain "
78
81
content=" $content ${nl} --$delim ${nl} Content-Disposition: form-data; name=\" key\" \r\n\r\n$_panos_key "
79
82
content=" $content ${nl} --$delim ${nl} Content-Disposition: form-data; name=\" format\" \r\n\r\npem"
80
- content=" $content ${nl} --$delim ${nl} Content-Disposition: form-data; name=\" file\" ; filename=\" $( basename " $_cfullchain " ) \" ${nl} Content-Type: application/octet-stream${nl}${nl} $( cat " $_cfullchain " ) "
83
+ content=" $content ${nl} --$delim ${nl} Content-Disposition: form-data; name=\" file\" ; filename=\" $( basename " $_cfullchain " ) \" ${nl} Content-Type: application/octet-stream${nl}${nl} $( cat " $_cfullchain " ) "
84
+ if [ " $_panos_template " ]; then
85
+ content=" $content ${nl} --$delim ${nl} Content-Disposition: form-data; name=\" target-tpl\" \r\n\r\n$_panos_template "
86
+ fi
81
87
fi
82
88
if [ " $type " = ' key' ]; then
83
89
panos_url=" ${panos_url} ?type=import"
@@ -87,6 +93,9 @@ deployer() {
87
93
content=" $content ${nl} --$delim ${nl} Content-Disposition: form-data; name=\" format\" \r\n\r\npem"
88
94
content=" $content ${nl} --$delim ${nl} Content-Disposition: form-data; name=\" passphrase\" \r\n\r\n123456"
89
95
content=" $content ${nl} --$delim ${nl} Content-Disposition: form-data; name=\" file\" ; filename=\" $( basename " $_cdomain .key" ) \" ${nl} Content-Type: application/octet-stream${nl}${nl} $( cat " $_ckey " ) "
96
+ if [ " $_panos_template " ]; then
97
+ content=" $content ${nl} --$delim ${nl} Content-Disposition: form-data; name=\" target-tpl\" \r\n\r\n$_panos_template "
98
+ fi
90
99
fi
91
100
# Close multipart
92
101
content=" $content ${nl} --$delim --${nl}${nl} "
@@ -173,10 +182,20 @@ panos_deploy() {
173
182
unset _panos_key
174
183
fi
175
184
185
+ # PANOS_TEMPLATE
186
+ if [ " $PANOS_TEMPLATE " ]; then
187
+ _debug " Detected ENV variable PANOS_TEMPLATE. Saving to file."
188
+ _savedeployconf PANOS_TEMPLATE " $PANOS_TEMPLATE " 1
189
+ else
190
+ _debug " Attempting to load variable PANOS_TEMPLATE from file."
191
+ _getdeployconf PANOS_TEMPLATE
192
+ fi
193
+
176
194
# Store variables
177
195
_panos_host=$PANOS_HOST
178
196
_panos_user=$PANOS_USER
179
197
_panos_pass=$PANOS_PASS
198
+ _panos_template=$PANOS_TEMPLATE
180
199
181
200
# Test API Key if found. If the key is invalid, the variable _panos_key will be unset.
182
201
if [ " $_panos_host " ] && [ " $_panos_key " ]; then
0 commit comments