Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FireProx fails when system time is out of sync with AWS. Please add a system time check to avoid false 'Unable to load AWS credentials' errors. #54

Open
Lokii-git opened this issue Mar 5, 2025 · 0 comments

Comments

@Lokii-git
Copy link

import datetime
import subprocess

def check_system_time():
try:
local_time = datetime.datetime.utcnow()
aws_time = subprocess.check_output("curl -s --head http://google.com | grep '^date:' | cut -d' ' -f3-6", shell=True).decode().strip()
if aws_time:
aws_time = datetime.datetime.strptime(aws_time, "%d %b %Y %H:%M:%S")
time_diff = abs((aws_time - local_time).total_seconds())
if time_diff > 300: # More than 5 minutes difference
print(f"⚠️ WARNING: System clock is out of sync! (Drift: {int(time_diff)} seconds)")
print("🔥 FireProx may fail due to AWS signature expiration. Run sudo timedatectl set-ntp on to fix.")
except Exception as e:
print(f"⚠️ Could not verify system time: {e}")

check_system_time()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant