File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -12,15 +12,19 @@ ExecStart=/opt/nasa-sky-explorer/.venv/bin/uvicorn src.server:app --host 0.0.0.0
1212Restart=always
1313RestartSec=10
1414
15+ # Capability to bind to port 80
16+ AmbientCapabilities=CAP_NET_BIND_SERVICE
17+ CapabilityBoundingSet=CAP_NET_BIND_SERVICE
18+
1519# Security hardening
1620NoNewPrivileges=true
1721PrivateTmp=true
1822ProtectHome=true
19- ReadWritePaths=/opt/nasa-sky-explorer/logs
2023
2124# Logging
22- StandardOutput=append:/opt/nasa-sky-explorer/logs/uvicorn.log
23- StandardError=append:/opt/nasa-sky-explorer/logs/uvicorn.log
25+ StandardOutput=journal
26+ StandardError=journal
27+ SyslogIdentifier=nasaspaceapps
2428
2529[Install]
2630WantedBy=multi-user.target
Original file line number Diff line number Diff line change @@ -31,14 +31,8 @@ pip install -r requirements.txt
3131deactivate || true
3232EOSCRIPT
3333
34- # Apply capability to allow binding to port 80 (if port < 1024)
35- if [ " ${UVICORN_PORT} " -lt 1024 ]; then
36- REAL_PYTHON=$( readlink -f " ${APP_DIR} /.venv/bin/python" )
37- if [ -f " ${REAL_PYTHON} " ]; then
38- echo " Applying cap_net_bind_service to ${REAL_PYTHON} ..."
39- setcap ' cap_net_bind_service=+ep' " ${REAL_PYTHON} " || echo " Warning: Failed to set capability"
40- fi
41- fi
34+ # Note: Port 80 binding is handled by systemd AmbientCapabilities
35+ # No need to set capabilities on the Python binary
4236
4337LOG_DIR=" ${APP_DIR} /logs"
4438mkdir -p " ${LOG_DIR} "
You can’t perform that action at this time.
0 commit comments