akamai / cli

Manage and configure Akamai from the Command Line.
https://techdocs.akamai.com/developer/docs/about-clis
Apache License 2.0
213 stars 85 forks source link

Verify local clock is in sync with the server #72

Open javiergarza opened 5 years ago

javiergarza commented 5 years ago

If the system clock drifts more than 30 seconds apart from the OPEN API Edgegrid server, the user will get an authentication error. This error not caught in almost any CLI package (most return very ugly errors) so instead of having to patch all CLI modules it would be great if the main CLI could verify this.

You can easily test if your clock is in sync by using Akamai's Time reference server time.akamai.com. See https://developer.akamai.com/legacy/learn/Akamai_Time_Reference/AkamaiTimeReference.html

For example in MacOS or linux you could run this command to verify how far apart your local clock is: AA=curl -q http://time.akamai.com/;BB=date +%s;echo "Your time drift is: $(($AA-$BB)) seconds"

frankthelen commented 3 years ago

Cool. Thanks for sharing. Did you mean curl -sS? From man pages:

-q (skip .curlrc)
-s --silent
-S --show-error

On Mac, this is working fine:

AA=$(curl -sS http://time.akamai.com);BB=$(date +%s);echo "Your time drift is: $(($AA-$BB)) seconds"