Re: nginx testcookie
On 04.10.2015 11:28, Dmitry Ivanov wrote: Здравствуйте, bagas. Вы писали 4 октября 2015 г., 8:54:37: Хмм, я не думаю что прям все боты могут и редирект и куки шифрованные Умеют, умеют... Мы в свое время замахались решать это на уровне приложений и сдали проблему сетевикам наверху. Они там уже как-то сами.. Не у всех есть сетевики наверху, чтобы решить подобные проблемы:) Да, конечно, например phantomjs достучится до браузера несмотря на куки. Но школьника запустившего wrk или ab, для флуда на сайт подобные решения с куками успешно остановят. В принципе модуль testcookie не обязательно нужен, можно проверять наличие необходимой куки на уровне nginx(if блоки или lua). Мне часто подобная защита помогала от тупого флуда. ___ nginx-ru mailing list nginx-ru@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx-ru
Re: nginx testcookie
Ясно, хотелось бы разоабратся. Но мало информации и примеров мало по этому модулю. Posted at Nginx Forum: http://forum.nginx.org/read.php?21,261991,262000#msg-262000 ___ nginx-ru mailing list nginx-ru@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx-ru
Re: nginx testcookie
Здравствуйте, bagas. Вы писали 4 октября 2015 г., 8:54:37: > Хмм, я не думаю что прям все боты могут и редирект и куки шифрованные Умеют, умеют... Мы в свое время замахались решать это на уровне приложений и сдали проблему сетевикам наверху. Они там уже как-то сами.. -- С уважением, Dmitry nginx...@sadok.spb.ru ___ nginx-ru mailing list nginx-ru@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx-ru
Re: nginx testcookie
Хмм, я не думаю что прям все боты могут и редирект и куки шифрованные подделывать, в 95% случаев думаю этого бдит достаточно. Но хотелось бы настроить и понять как модуль testcookie. И что я делаю не так в настройке этого модуля. Posted at Nginx Forum: http://forum.nginx.org/read.php?21,261991,261995#msg-261995 ___ nginx-ru mailing list nginx-ru@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx-ru
Re: nginx testcookie
Посмотрите senginx и их модуль robot_mitigation (это переписан на С модуль Roboo). http://www.senginx.org/en/index.php/HTTP_Robot_Mitigation#robot_mitigation_mode Можно фильтровать флэшом, если бот который Вас атакует такое умеет то видимо уже самодельными решениями не обойтись. 03.10.2015 21:18, bagas пишет: Народ добрый вечер. Кто использует для отсечения ддос атака моудль нгинс testcookie? есть некторые непонятки, не пойму логики. настраиваю по этой инструкции http://habrahabr.ru/post/139931/ # uname -rms FreeBSD 10.2-RELEASE-p4 amd64 Нгинс собран с модулем testcookie # nginx -V nginx version: nginx/1.8.0 built by clang 3.4.1 (tags/RELEASE_34/dot1-final 208032) 20140512 built with OpenSSL 1.0.1p-freebsd 9 Jul 2015 TLS SNI support enabled configure arguments: --prefix=/usr/local/etc/nginx --with-cc-opt='-I /usr/local/include' --with-ld-opt='-L /usr/local/lib' --conf-path=/usr/local/etc/nginx/nginx.conf --sbin-path=/usr/local/sbin/nginx --pid-path=/var/run/nginx.pid --error-log-path=/mnt/log/nginx/nginx-error.log --user=www --group=www --http-client-body-temp-path=/var/tmp/nginx/client_body_temp --http-fastcgi-temp-path=/var/tmp/nginx/fastcgi_temp --http-proxy-temp-path=/var/tmp/nginx/proxy_temp --http-scgi-temp-path=/var/tmp/nginx/scgi_temp --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi_temp --http-log-path=/mnt/log/nginx/nginx-access.log --with-http_gzip_static_module --with-http_stub_status_module --with-pcre --add-module=/usr/sources/kyprizel-testcookie-nginx-module-fa546e2 конфиг nginx.conf http { testcookie off; testcookie_name ddos; testcookie_secret a1bes8r0f7bj228r2e16f4b2djslfka39ds5962; testcookie_session $remote_addr; testcookie_arg attempt; testcookie_max_attempts 3; testcookie_fallback /cookies.html?backurl=http://$host$request_uri; testcookie_get_only on; testcookie_redirect_via_refresh on; testcookie_refresh_encrypt_cookie on; testcookie_refresh_encrypt_cookie_key random; testcookie_refresh_encrypt_cookie_iv random; include /usr/local/etc/nginx/testcookie_whitelist.conf; testcookie_refresh_template ' Для нашего сервиса нужно включить куки в вашем браузере. При выключенных куках браузера, у вас есть несколько попыток, после вы будите заблокированы. For our service you need to enable cookies in your browser. If you turn off cookies the browser, you have a few attempts before you\'ll blocked.function toNumbers(d){vare=[];d.replace(/(..)/g,function(d){e.push(parseInt(d,16))});return e}function toHex(){for(var d=[],d=1==arguments.length&&arguments[0].constructor==Array?arguments[0]:arguments,e="",f=0;fd[f]?"0":"")+d[f].toString(16);return e.toLowerCase()}var a=toNumbers("$testcookie_enc_key"),b=toNumbers("$testcookie_enc_iv"),c=toNumbers("$testcookie_enc_set");document.cookie="ddos="+toHex(slowAES.decrypt(c,2,a,b))+"; expires=Thu, 31-Dec-37 23:55:55 GMT; path=/";document.location.href="$testcookie_nexturl";'; виртуал хост . пока на тестовом сервере тестирую. location = /cookies.html { root /usr/local/www/def; } location = /aes.min.js { gzip on; gzip_min_length 1000; gzip_types text/plain; root /usr/local/www/def; } location / { testcookie on; root /usr/local/www/munin; ... Лог. 2.2.2.2 - [03/Oct/2015:20:39:29 +0300] "GET /cookies.html?backurl=http://9.0.9.0/?attempt=3 HTTP/1.1" 200 "Opera/9.80 (X11; Linux x86_64) Presto/2.12.388 Version/12.16" 2.2.2.2 - [03/Oct/2015:20:39:29 +0300] "GET /favicon.ico HTTP/1.1" 200 "Opera/9.80 (X11; Linux x86_64) Presto/2.12.388 Version/12.16" 2.2.2.2 - [03/Oct/2015:20:39:29 +0300] "GET /cookies.html?backurl=http://9.0.9.0/?attempt=3 HTTP/1.1" 200 "Opera/9.80 (X11; Linux x86_64) Presto/2.12.388 Version/12.16" 2.2.2.2 - [03/Oct/2015:20:39:29 +0300] "GET /favicon.ico HTTP/1.1" 200 "Opera/9.80 (X11; Linux x86_64) Presto/2.12.388 Version/12.16" 2.2.2.2 - [03/Oct/2015:20:39:30 +0300] "GET /cookies.html?backurl=http://9.0.9.0/?attempt=3 HTTP/1.1" 200 "Opera/9.80 (X11; Linux x86_64) Presto/2.12.388 Version/12.16" 2.2.2.2 - [03/Oct/2015:20:39:30 +0300] "GET /favicon.ico HTTP/1.1" 200 "Opera/9.80 (X11; Linux x86_64) Presto/2.12.388 Version/12.16" 2.2.2.2 - [03/Oct/2015:20:39:30 +0300] "GET /cookies.html?backurl=http://9.0.9.0/?attempt=3 HTTP/1.1" 200 "Opera/9.80 (X11; Linux x86_64) Presto/2.12.388 Version/12.16" 2.2.2.2 - [03/Oct/2015:20:39:30 +0300] "GET /favicon.ico HTTP/1.1" 200 "Opera/9.80 (X11; Linux x86_64) Presto/2.12.388 Version/12.16" Я логики не пойму этого модуля, как мне отслеживать ботов при этом? Если включить куки, то сайт конечно грузится, либо если добавить себя в исключения. Если же с отключенными куками как видно в логах опера, то сразу без предупреждения вылетает cookies.html, и код ответа 200. Подск
Re: nginx testcookie
Здравствуйте, bagas. > Народ добрый вечер. > Кто использует для отсечения ддос атака моудль нгинс testcookie? > есть некторые непонятки, не пойму логики. > настраиваю по этой инструкции > http://habrahabr.ru/post/139931/ Боты часто умеют и куки и редиректы и Javascript и всё прочее. Посмотрите на chromium - это встраиваемый браузер. В боты его тоже успешно встраивают и так имитируют обычных юзеров. Если досят конкретно Ваш сайт, то этот модуль Вам не поможет, ибо всё описанное в статье обходится. -- С уважением, Михаил mailto:postmas...@softsearch.ru ___ nginx-ru mailing list nginx-ru@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx-ru
nginx testcookie
Народ добрый вечер. Кто использует для отсечения ддос атака моудль нгинс testcookie? есть некторые непонятки, не пойму логики. настраиваю по этой инструкции http://habrahabr.ru/post/139931/ # uname -rms FreeBSD 10.2-RELEASE-p4 amd64 Нгинс собран с модулем testcookie # nginx -V nginx version: nginx/1.8.0 built by clang 3.4.1 (tags/RELEASE_34/dot1-final 208032) 20140512 built with OpenSSL 1.0.1p-freebsd 9 Jul 2015 TLS SNI support enabled configure arguments: --prefix=/usr/local/etc/nginx --with-cc-opt='-I /usr/local/include' --with-ld-opt='-L /usr/local/lib' --conf-path=/usr/local/etc/nginx/nginx.conf --sbin-path=/usr/local/sbin/nginx --pid-path=/var/run/nginx.pid --error-log-path=/mnt/log/nginx/nginx-error.log --user=www --group=www --http-client-body-temp-path=/var/tmp/nginx/client_body_temp --http-fastcgi-temp-path=/var/tmp/nginx/fastcgi_temp --http-proxy-temp-path=/var/tmp/nginx/proxy_temp --http-scgi-temp-path=/var/tmp/nginx/scgi_temp --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi_temp --http-log-path=/mnt/log/nginx/nginx-access.log --with-http_gzip_static_module --with-http_stub_status_module --with-pcre --add-module=/usr/sources/kyprizel-testcookie-nginx-module-fa546e2 конфиг nginx.conf http { testcookie off; testcookie_name ddos; testcookie_secret a1bes8r0f7bj228r2e16f4b2djslfka39ds5962; testcookie_session $remote_addr; testcookie_arg attempt; testcookie_max_attempts 3; testcookie_fallback /cookies.html?backurl=http://$host$request_uri; testcookie_get_only on; testcookie_redirect_via_refresh on; testcookie_refresh_encrypt_cookie on; testcookie_refresh_encrypt_cookie_key random; testcookie_refresh_encrypt_cookie_iv random; include /usr/local/etc/nginx/testcookie_whitelist.conf; testcookie_refresh_template ' Для нашего сервиса нужно включить куки в вашем браузере. При выключенных куках браузера, у вас есть несколько попыток, после вы будите заблокированы. For our service you need to enable cookies in your browser. If you turn off cookies the browser, you have a few attempts before you\'ll blocked. function toNumbers(d){var e=[];d.replace(/(..)/g,function(d){e.push(parseInt(d,16))});return e}function toHex(){for(var d=[],d=1==arguments.length&&arguments[0].constructor==Array?arguments[0]:arguments,e="",f=0;fd[f]?"0":"")+d[f].toString(16);return e.toLowerCase()}var a=toNumbers("$testcookie_enc_key"),b=toNumbers("$testcookie_enc_iv"),c=toNumbers("$testcookie_enc_set");document.cookie="ddos="+toHex(slowAES.decrypt(c,2,a,b))+"; expires=Thu, 31-Dec-37 23:55:55 GMT; path=/";document.location.href="$testcookie_nexturl";'; виртуал хост . пока на тестовом сервере тестирую. location = /cookies.html { root /usr/local/www/def; } location = /aes.min.js { gzip on; gzip_min_length 1000; gzip_types text/plain; root /usr/local/www/def; } location / { testcookie on; root /usr/local/www/munin; ... Лог. 2.2.2.2 - [03/Oct/2015:20:39:29 +0300] "GET /cookies.html?backurl=http://9.0.9.0/?attempt=3 HTTP/1.1" 200 "Opera/9.80 (X11; Linux x86_64) Presto/2.12.388 Version/12.16" 2.2.2.2 - [03/Oct/2015:20:39:29 +0300] "GET /favicon.ico HTTP/1.1" 200 "Opera/9.80 (X11; Linux x86_64) Presto/2.12.388 Version/12.16" 2.2.2.2 - [03/Oct/2015:20:39:29 +0300] "GET /cookies.html?backurl=http://9.0.9.0/?attempt=3 HTTP/1.1" 200 "Opera/9.80 (X11; Linux x86_64) Presto/2.12.388 Version/12.16" 2.2.2.2 - [03/Oct/2015:20:39:29 +0300] "GET /favicon.ico HTTP/1.1" 200 "Opera/9.80 (X11; Linux x86_64) Presto/2.12.388 Version/12.16" 2.2.2.2 - [03/Oct/2015:20:39:30 +0300] "GET /cookies.html?backurl=http://9.0.9.0/?attempt=3 HTTP/1.1" 200 "Opera/9.80 (X11; Linux x86_64) Presto/2.12.388 Version/12.16" 2.2.2.2 - [03/Oct/2015:20:39:30 +0300] "GET /favicon.ico HTTP/1.1" 200 "Opera/9.80 (X11; Linux x86_64) Presto/2.12.388 Version/12.16" 2.2.2.2 - [03/Oct/2015:20:39:30 +0300] "GET /cookies.html?backurl=http://9.0.9.0/?attempt=3 HTTP/1.1" 200 "Opera/9.80 (X11; Linux x86_64) Presto/2.12.388 Version/12.16" 2.2.2.2 - [03/Oct/2015:20:39:30 +0300] "GET /favicon.ico HTTP/1.1" 200 "Opera/9.80 (X11; Linux x86_64) Presto/2.12.388 Version/12.16" Я логики не пойму этого модуля, как мне отслеживать ботов при этом? Если включить куки, то сайт конечно грузится, либо если добавить себя в исключения. Если же с отключенными куками как видно в логах опера, то сразу без предупреждения вылетает cookies.html, и код ответа 200. Подскажите пожалуйста что я делаю не так в настройке этого модуля? Posted at Nginx Forum: http://forum.nginx.org/read.php?21,261991,261991#msg-261991 ___ nginx-ru mailing list nginx-ru@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx-ru