Skip to content

Instantly share code, notes, and snippets.

@HokieGeek
Last active June 27, 2018 19:41
Show Gist options
  • Save HokieGeek/b0078e2b1227bea6ff7fdfb64b849b90 to your computer and use it in GitHub Desktop.
Save HokieGeek/b0078e2b1227bea6ff7fdfb64b849b90 to your computer and use it in GitHub Desktop.
#!/bin/bash
license=$1
iq_host=${2:-"localhost:8070"}
user_pwd=${3:-"admin:admin123"}
echo "Installing to ${iq_host}"
cookies="cookies"
## Create session
curl --verbose \
--user ${user_pwd} \
--cookie-jar ${cookies} --cookie ${cookies} \
"http://${iq_host}/rest/user/session"
curl --verbose \
--user ${user_pwd} \
--cookie-jar ${cookies} --cookie ${cookies} \
--header "X-CSRF-TOKEN: $(awk '/CLM-CSRF-TOKEN/ { print $NF }' ${cookies})" \
--form "file=@${license}" \
"http://${iq_host}/rest/product/license"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment