diff --git a/nginx-config.configmap.yaml b/nginx-config.configmap.yaml index 1a80cc5..7587ef9 100644 --- a/nginx-config.configmap.yaml +++ b/nginx-config.configmap.yaml @@ -19,8 +19,9 @@ data: $status $body_bytes_sent '\n '\"$http_referer\" \"$http_user_agent\" '\n '$geoip2_data_city_name $geoip2_data_country_name';\n\tlog_format blocked_fmt '$http_host \\t $remote_addr - [$time_local] '\n\t\t'Blocked Country: - $geoip2_data_country_iso_code '\n '\"$request\" $status';\n\n\tserver - {\n\tlisten 80;\n listen 443 default ssl;\n\tssl_certificate /etc/nginx/ssl/live/default.tryton.geeraert.eu/fullchain.pem; + $geoip2_data_country_iso_code '\n '\"$request\" $status';\n\n\tlog_format + deny_style 'deny $remote_addr;';\n\n\tserver {\n\tlisten 80;\n listen 443 + default ssl;\n\tssl_certificate /etc/nginx/ssl/live/default.tryton.geeraert.eu/fullchain.pem; # managed by$\n ssl_certificate_key /etc/nginx/ssl/live/default.tryton.geeraert.eu/privkey.pem; # managed $\n location / {\n proxy_pass http://1.1.1.1;\n \ proxy_redirect off;\n proxy_set_header Host $host;\n diff --git a/nginx.conf b/nginx.conf index b681ba5..8eb60c5 100755 --- a/nginx.conf +++ b/nginx.conf @@ -35,6 +35,8 @@ http { 'Blocked Country: $geoip2_data_country_iso_code ' '"$request" $status'; + log_format deny_style 'deny $remote_addr;'; + server { listen 80; listen 443 default ssl; diff --git a/terraform/nginx_config.tftpl b/terraform/nginx_config.tftpl index 4cddf1a..5d65111 100644 --- a/terraform/nginx_config.tftpl +++ b/terraform/nginx_config.tftpl @@ -43,6 +43,11 @@ server { You are banned!"; } + location ^~ /wp-content { + # Logs the IP in "deny IP;" format to your specific file + access_log /etc/nginx/blacklisted.d/blacklisted-sessions.conf deny_style; + return 444; + } access_log /var/log/nginx/access.log my_custom_format; access_log /var/log/nginx/ip_audit.log ip_audit;