Skip to content

Instantly share code, notes, and snippets.

@plehr
Created February 27, 2019 12:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save plehr/944c840f1ec91f30960eda173df5e213 to your computer and use it in GitHub Desktop.
Save plehr/944c840f1ec91f30960eda173df5e213 to your computer and use it in GitHub Desktop.
If you would like to use Okta with a dynamic IP-Addr you need to update the IP manually or use this tiny script to do this by cronjob.
#!/bin/bash
api_token=<INSERT YOUR API KEY>
curl --silent -X PUT \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: SSWS ${api_token}" \
-d '{
"type": "IP",
"id": "<ZONE-ID>",
"name": "<INSERT NAME>",
"status": "ACTIVE",
"created": "2017-01-24T19:53:28.000Z",
"lastUpdated": "2017-01-24T19:53:28.000Z",
"system": false,
"gateways": [
{
"type": "CIDR",
"value": "'"$(curl --silent ipecho.net/plain)"'/24"
}
],
"proxies": [],
"_links": {
"self": {
"href": "https://<OKTA-ORG>.okta.com/api/v1/zones/<ZONE-ID>",
"hints": {
"allow": [
"GET",
"PUT",
"DELETE"
]
}
},
"deactivate": {
"href": "https://<OKTA-ORG>.okta.com/api/v1/zones/<ZONE-ID>/lifecycle/deactivate",
"hints": {
"allow": [
"POST"
]
}
}
}
}' "https://<OKTA-ORG>.okta.com/api/v1/zones/<ZONE-ID>" > /dev/null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment