Compare commits

...

2 Commits

Author SHA1 Message Date
cbceac786d log denied forwardedIp
All checks were successful
Docker Build / build-and-push-image (push) Successful in 1m31s
2025-08-27 19:53:38 +02:00
ae3eed3ff8 temporary fix: hardcode allowed ip instead of using traefik middleware 2025-08-07 15:33:38 +02:00
2 changed files with 20 additions and 20 deletions

View File

@@ -5,6 +5,6 @@ metadata:
namespace: {{ .Release.Namespace }} namespace: {{ .Release.Namespace }}
data: data:
OAUTH_ALLOWED_HOST: webapp.arcodange.duckdns.org OAUTH_ALLOWED_HOST: webapp.arcodange.duckdns.org
OAUTH_DEVICE_CODE_ALLOWED_IPS: 90.16.102.250, OAUTH_DEVICE_CODE_ALLOWED_IPS: 86.247.157.144,
DATABASE_URL: postgres://pgbouncer_auth:pgbouncer_auth@pgbouncer.tools/postgres?sslmode=disable DATABASE_URL: postgres://pgbouncer_auth:pgbouncer_auth@pgbouncer.tools/postgres?sslmode=disable
# DATABASE_URL: postgres://username:password@localhost/dbname?sslmode=disable # DATABASE_URL: postgres://username:password@localhost/dbname?sslmode=disable

View File

@@ -287,7 +287,8 @@ func retrieveHandler(w http.ResponseWriter, r *http.Request) {
if err != nil || if err != nil ||
!slices.Contains(oauthDeviceCodeAllowedIPs, userIP) && !slices.Contains(oauthDeviceCodeAllowedIPs, userIP) &&
!slices.Contains(oauthDeviceCodeAllowedIPs, userIPforwarded) { !slices.Contains(oauthDeviceCodeAllowedIPs, userIPforwarded) {
fmt.Fprintln(os.Stderr, "denied userIP: "+userIP) fmt.Fprintln(os.Stderr, "denied userIP: "+userIP+" forwarded: "+userIPforwarded)
fmt.Fprintf(os.Stderr, "alowed ips: %+v", oauthDeviceCodeAllowedIPs)
// Parcourir tous les headers // Parcourir tous les headers
for name, values := range r.Header { for name, values := range r.Header {
// name représente le nom de l'en-tête // name représente le nom de l'en-tête
@@ -493,7 +494,6 @@ func main() {
http.HandleFunc("/retrieve", retrieveHandler) http.HandleFunc("/retrieve", retrieveHandler)
http.HandleFunc("/test-oauth-callback", test_oauth2_callback) http.HandleFunc("/test-oauth-callback", test_oauth2_callback)
// Start the HTTP server // Start the HTTP server
port := ":8080" port := ":8080"
log.Printf("Server starting on port %s\n", port) log.Printf("Server starting on port %s\n", port)