Created
February 27, 2019 12:35
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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