bridge nel repo: sorgenti, unit systemd e istruzioni per i tester
- bridge/ con aira_bridge.py, setup_creds.py, aira_probe.py, test offline - percorsi di configurazione via AIRA_CONFIG_DIR (default invariato) - README del bridge in inglese: installazione, servizio, firewall, sicurezza - README principale aggiornato (il bridge non è più 'fuori dal repo')
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Salva le credenziali Aira in $AIRA_CONFIG_DIR/aira.json (permessi 600).
|
||||
|
||||
Va eseguito da te, nel tuo terminale: la password viene digitata senza eco e non
|
||||
compare ne' nei log ne' nella cronologia della shell.
|
||||
|
||||
Uso:
|
||||
cd bridge
|
||||
.venv/bin/python setup_creds.py
|
||||
"""
|
||||
import getpass
|
||||
import json
|
||||
import os
|
||||
import stat
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
BASE = Path(os.environ.get("AIRA_CONFIG_DIR") or (Path.home() / ".hermes" / "profiles" / "carlo"))
|
||||
TARGET = BASE / "aira.json"
|
||||
|
||||
|
||||
def main() -> int:
|
||||
email = input("Email account Aira: ").strip()
|
||||
if not email:
|
||||
print("email vuota, annullo", file=sys.stderr)
|
||||
return 1
|
||||
|
||||
password = getpass.getpass("Password (non verra' mostrata): ")
|
||||
if not password:
|
||||
print("password vuota, annullo", file=sys.stderr)
|
||||
return 1
|
||||
|
||||
TARGET.parent.mkdir(parents=True, exist_ok=True)
|
||||
tmp = TARGET.with_suffix(".tmp")
|
||||
tmp.write_text(json.dumps({"email": email, "password": password}, indent=2))
|
||||
os.chmod(tmp, stat.S_IRUSR | stat.S_IWUSR)
|
||||
tmp.replace(TARGET)
|
||||
|
||||
print(f"\nOK: credenziali salvate in {TARGET} (permessi 600)")
|
||||
print("Ora lancia: .venv/bin/python aira_probe.py")
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
Reference in New Issue
Block a user