diff --git a/.env.example b/.env.example index d87fa74..9e97462 100644 --- a/.env.example +++ b/.env.example @@ -40,5 +40,9 @@ LOG_TO_STDOUT=True RATELIMIT_ENABLED=True RATELIMIT_STORAGE_URL=redis://localhost:6379/1 -# Testing -TESTING=False +# SSH CA +# Path to CA private key file (alternative to SSH_CA_PRIVATE_KEY env var) +SSH_CA_KEY_PATH=/path/to/ca-users +# Or set the key content directly (takes priority over SSH_CA_KEY_PATH): +# SSH_CA_PRIVATE_KEY= + diff --git a/client/gatehouse-cli.py b/client/gatehouse-cli.py index b45ce1a..e4f223a 100755 --- a/client/gatehouse-cli.py +++ b/client/gatehouse-cli.py @@ -1,6 +1,5 @@ #!/usr/bin/python3 import base64 -from datetime import datetime import os import sys import webbrowser @@ -17,7 +16,6 @@ from sshkey_tools.cert import SSHCertificate import logging import coloredlogs import subprocess -import base64 # Load environment variables from the .env file load_dotenv() @@ -36,11 +34,18 @@ CHALLENGE_SIG_FILE_PATH = "/tmp/challenge.txt.sig" logger = logging.getLogger(__name__) coloredlogs.install(level='DEBUG', logger=logger, fmt='%(asctime)s - %(name)s - %(levelname)s - %(message)s') +token = "" + +def auth_headers(content_type="application/json"): + """Return auth headers using the current cached token.""" + return {"Authorization": f"Bearer {token}", "Content-Type": content_type} + class MyServer(BaseHTTPRequestHandler): def do_GET(self): """Handle GET requests and process token reception.""" global server_done, token + self.send_response(200) self.send_header("Content-type", "text/html") self.end_headers() @@ -49,12 +54,13 @@ class MyServer(BaseHTTPRequestHandler): self.wfile.write(bytes("
Window closing in 5 seconds...
", "utf-8")) self.wfile.write(bytes("", "utf-8")) self.wfile.write(bytes("