Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
Acme.Sh
Commits
cc5c722e
Unverified
Commit
cc5c722e
authored
Mar 31, 2024
by
neil
Committed by
GitHub
Mar 31, 2024
Browse files
Merge pull request #5072 from aSauerwein/master
feature: add template option for panos deploy hook
parents
2d4b900e
4fcddd18
Changes
1
Hide whitespace changes
Inline
Side-by-side
deploy/panos.sh
View file @
cc5c722e
...
...
@@ -12,6 +12,9 @@
# export PANOS_USER="" #User *MUST* have Commit and Import Permissions in XML API for Admin Role
# export PANOS_PASS=""
#
# OPTIONAL
# export PANOS_TEMPLATE="" #Template Name of panorama managed devices
#
# The script will automatically generate a new API key if
# no key is found, or if a saved key has expired or is invalid.
...
...
@@ -77,7 +80,10 @@ deployer() {
content
=
"
$content
${
nl
}
--
$delim
${
nl
}
Content-Disposition: form-data; name=
\"
certificate-name
\"\r\n\r\n
$_cdomain
"
content
=
"
$content
${
nl
}
--
$delim
${
nl
}
Content-Disposition: form-data; name=
\"
key
\"\r\n\r\n
$_panos_key
"
content
=
"
$content
${
nl
}
--
$delim
${
nl
}
Content-Disposition: form-data; name=
\"
format
\"\r\n\r\n
pem"
content
=
"
$content
${
nl
}
--
$delim
${
nl
}
Content-Disposition: form-data; name=
\"
file
\"
; filename=
\"
$(
basename
"
$_cfullchain
"
)
\"
${
nl
}
Content-Type: application/octet-stream
${
nl
}${
nl
}
$(
cat
"
$_cfullchain
"
)
"
content
=
"
$content
${
nl
}
--
$delim
${
nl
}
Content-Disposition: form-data; name=
\"
file
\"
; filename=
\"
$(
basename
"
$_cfullchain
"
)
\"
${
nl
}
Content-Type: application/octet-stream
${
nl
}${
nl
}
$(
cat
"
$_cfullchain
"
)
"
if
[
"
$_panos_template
"
]
;
then
content
=
"
$content
${
nl
}
--
$delim
${
nl
}
Content-Disposition: form-data; name=
\"
target-tpl
\"\r\n\r\n
$_panos_template
"
fi
fi
if
[
"
$type
"
=
'key'
]
;
then
panos_url
=
"
${
panos_url
}
?type=import"
...
...
@@ -87,6 +93,9 @@ deployer() {
content
=
"
$content
${
nl
}
--
$delim
${
nl
}
Content-Disposition: form-data; name=
\"
format
\"\r\n\r\n
pem"
content
=
"
$content
${
nl
}
--
$delim
${
nl
}
Content-Disposition: form-data; name=
\"
passphrase
\"\r\n\r\n
123456"
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
"
)
"
if
[
"
$_panos_template
"
]
;
then
content
=
"
$content
${
nl
}
--
$delim
${
nl
}
Content-Disposition: form-data; name=
\"
target-tpl
\"\r\n\r\n
$_panos_template
"
fi
fi
#Close multipart
content
=
"
$content
${
nl
}
--
$delim
--
${
nl
}${
nl
}
"
...
...
@@ -173,10 +182,20 @@ panos_deploy() {
unset
_panos_key
fi
# PANOS_TEMPLATE
if
[
"
$PANOS_TEMPLATE
"
]
;
then
_debug
"Detected ENV variable PANOS_TEMPLATE. Saving to file."
_savedeployconf PANOS_TEMPLATE
"
$PANOS_TEMPLATE
"
1
else
_debug
"Attempting to load variable PANOS_TEMPLATE from file."
_getdeployconf PANOS_TEMPLATE
fi
#Store variables
_panos_host
=
$PANOS_HOST
_panos_user
=
$PANOS_USER
_panos_pass
=
$PANOS_PASS
_panos_template
=
$PANOS_TEMPLATE
#Test API Key if found. If the key is invalid, the variable _panos_key will be unset.
if
[
"
$_panos_host
"
]
&&
[
"
$_panos_key
"
]
;
then
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment