wyacznie auth na read only endpointach

This commit is contained in:
Mateusz Gruszczyński 2025-03-06 15:31:07 +01:00
parent fa73c9ea6d
commit e3f26f546e
3 changed files with 3 additions and 6 deletions

4
app.py
View File

@ -102,7 +102,7 @@ def update_hosts():
# Endpoint /health zwraca status usługi
@app.route('/health', methods=['GET'])
def health():
require_auth()
#require_auth()
uptime = time.time() - psutil.boot_time()
now = datetime.now(timezone.utc).isoformat()
logger.info(f"/health check from {request.remote_addr}")
@ -111,7 +111,7 @@ def health():
# Endpoint /metrics zwraca metryki
@app.route('/metrics', methods=['GET'])
def metrics_endpoint():
require_auth()
#require_auth()
avg_time = metrics["total_time"] / metrics["total_requests"] if metrics["total_requests"] > 0 else 0.0
ep_data = {}
for ep, data in metrics["endpoints"].items():

View File

@ -1,8 +1,5 @@
Flask
Flask-SSLify
Flask-SQLAlchemy
paramiko
croniter
tzlocal
gunicorn
psutil

View File

@ -1,5 +1,5 @@
sudo mkdir -p /opt/hosts_daemon/ssl
sudo openssl req -x509 -nodes -days 3650-newkey rsa:2048 \
sudo openssl req -x509 -nodes -days 3650 -newkey rsa:2048 \
-keyout /opt/hosts_daemon/ssl/hosts_daemon.key \
-out /opt/hosts_daemon/ssl/hosts_daemon.crt \
-subj "/C=PL/ST=WLKP/L=POZ/O=linuxiarz.pl/OU=hostsDaemon/CN=0.0.0.0"