{"id":456819,"date":"2025-04-21T21:00:39","date_gmt":"2025-04-21T21:00:39","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=456819"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=456819","title":{"rendered":"<span>DDoS-\u0430\u0442\u0430\u043a\u0438: \u043e\u0442 \u0442\u0435\u043e\u0440\u0438\u0438 \u043a \u043a\u043e\u0440\u043f\u043e\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0439 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u0437\u0430\u0449\u0438\u0442\u044b<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/2e5\/4f4\/fe0\/2e54f4fe071e45e5e8907de0209807be.jpg\" width=\"1080\" height=\"720\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/2e5\/4f4\/fe0\/2e54f4fe071e45e5e8907de0209807be.jpg 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/2e5\/4f4\/fe0\/2e54f4fe071e45e5e8907de0209807be.jpg 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<p>\u041f\u0440\u0438\u0432\u0435\u0442! \u041c\u0435\u043d\u044f \u0437\u043e\u0432\u0443\u0442 \u041c\u0430\u043a\u0441\u0438\u043c \u0420\u044b\u0431\u0430\u043b\u043a\u043e, \u044f \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440 \u043f\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044e \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u043c\u0438 \u0432 \u04221 \u0418\u043d\u043d\u043e\u0442\u0435\u0445. \u0412 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u043c \u0446\u0438\u0444\u0440\u043e\u0432\u043e\u043c \u043c\u0438\u0440\u0435 DDoS-\u0430\u0442\u0430\u043a\u0438 \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u043b\u0438\u0441\u044c \u0438\u0437 \u0442\u0435\u043e\u0440\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0443\u0433\u0440\u043e\u0437\u044b \u0432 \u0435\u0436\u0435\u0434\u043d\u0435\u0432\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 \u0434\u043b\u044f \u0431\u0438\u0437\u043d\u0435\u0441\u0430. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043e \u0431\u0430\u0437\u043e\u0432\u044b\u0445 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0430\u0445 \u0437\u0430\u0449\u0438\u0442\u044b, \u043d\u043e \u0438 \u043f\u043e\u0434\u0435\u043b\u044e\u0441\u044c \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u0441\u043b\u0443\u0447\u0430\u044f\u043c\u0438 \u0438\u0437 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0438, \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0451\u043d\u043d\u044b\u043c\u0438 \u043e\u0448\u0438\u0431\u043a\u0430\u043c\u0438 \u0438 \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0438\u043c\u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u044f\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u043c.<\/p>\n<h2>\u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 DDoS-\u0430\u0442\u0430\u043a\u0430?<\/h2>\n<p>DDoS-\u0430\u0442\u0430\u043a\u0430 \u2014 \u044d\u0442\u043e \u043a\u0438\u0431\u0435\u0440\u0430\u0442\u0430\u043a\u0430, \u0446\u0435\u043b\u044c\u044e \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u0433\u0440\u0443\u0437\u043a\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0430, \u0441\u0435\u0442\u0438 \u0438\u043b\u0438 \u0432\u0435\u0431-\u0441\u0430\u0439\u0442\u0430 \u043e\u0433\u0440\u043e\u043c\u043d\u044b\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432, \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442 \u0438\u0445 \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u043c\u0438 \u0434\u043b\u044f \u043b\u0435\u0433\u0438\u0442\u0438\u043c\u043d\u044b\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439. \u0410\u0442\u0430\u043a\u0430 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432, \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0451\u043d\u043d\u044b\u0445 \u0432 \u0441\u0435\u0442\u044c (\u0431\u043e\u0442\u043d\u0435\u0442), \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0442 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043a \u0446\u0435\u043b\u0435\u0432\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435.<\/p>\n<p>\u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0438 DDoS-\u0430\u0442\u0430\u043a:<\/p>\n<ul>\n<li>\n<p><strong>\u0420\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0441\u0442\u044c:<\/strong> \u0430\u0442\u0430\u043a\u0430 \u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0438\u0437 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u0432, \u0447\u0442\u043e \u0437\u0430\u0442\u0440\u0443\u0434\u043d\u044f\u0435\u0442 \u0435\u0451 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 .<\/p>\n<\/li>\n<li>\n<p><strong>\u041c\u0430\u0441\u0441\u043e\u0432\u043e\u0441\u0442\u044c:<\/strong> \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043c\u043e\u0436\u0435\u0442 \u0434\u043e\u0441\u0442\u0438\u0433\u0430\u0442\u044c \u043c\u0438\u043b\u043b\u0438\u043e\u043d\u043e\u0432 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443.<\/p>\n<\/li>\n<li>\n<p><strong>\u0426\u0435\u043b\u044c:<\/strong> \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0438\u0437 \u0441\u0442\u0440\u043e\u044f, \u0441\u0434\u0435\u043b\u0430\u0432 \u0435\u0451 \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u0439.<\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u043e\u0447\u0435\u043c\u0443 \u044d\u0442\u043e \u043e\u043f\u0430\u0441\u043d\u043e:<\/p>\n<ul>\n<li>\n<p><strong>\u0424\u0438\u043d\u0430\u043d\u0441\u043e\u0432\u044b\u0435 \u043f\u043e\u0442\u0435\u0440\u0438:<\/strong>\u00a0\u043a\u0430\u0436\u0434\u0430\u044f \u043c\u0438\u043d\u0443\u0442\u0430 \u043f\u0440\u043e\u0441\u0442\u043e\u044f \u043c\u043e\u0436\u0435\u0442 \u0441\u0442\u043e\u0438\u0442\u044c \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u044f\u043c \u0434\u043e $5600 (\u043f\u043e \u0434\u0430\u043d\u043d\u044b\u043c Gartner).<\/p>\n<\/li>\n<li>\n<p><strong>\u0420\u0435\u043f\u0443\u0442\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u0440\u0438\u0441\u043a\u0438:<\/strong>\u00a0\u043a\u043b\u0438\u0435\u043d\u0442\u044b \u0442\u0435\u0440\u044f\u044e\u0442 \u0434\u043e\u0432\u0435\u0440\u0438\u0435 \u043f\u043e\u0441\u043b\u0435 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u044b\u0445 \u0438\u043d\u0446\u0438\u0434\u0435\u043d\u0442\u043e\u0432.<\/p>\n<\/li>\n<li>\n<p><strong>\u041c\u0430\u0441\u043a\u0438\u0440\u043e\u0432\u043a\u0430 \u0434\u0440\u0443\u0433\u0438\u0445 \u0430\u0442\u0430\u043a:<\/strong>\u00a0\u0447\u0430\u0441\u0442\u043e DDoS \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u043a\u0430\u043a \u00ab\u0434\u044b\u043c\u043e\u0432\u0443\u044e \u0437\u0430\u0432\u0435\u0441\u0443\u00bb \u0434\u043b\u044f \u0445\u0438\u0449\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<\/li>\n<\/ul>\n<h2>\u0422\u0438\u043f\u044b \u0430\u0442\u0430\u043a \u0438 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u044b<\/h2>\n<p><strong>1.\u00a0\u041e\u0431\u044a\u0451\u043c\u043d\u044b\u0435 \u0430\u0442\u0430\u043a\u0438<\/strong><\/p>\n<ul>\n<li>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u0440 \u0438\u0437 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0438:<\/strong>\u00a0\u0430\u0442\u0430\u043a\u0430 \u043d\u0430 350 \u0413\u0431\u0438\u0442\/\u0441. \u0447\u0435\u0440\u0435\u0437 UDP-\u0444\u043b\u0443\u0434.<\/p>\n<\/li>\n<li>\n<p><strong>\u0420\u0435\u0448\u0435\u043d\u0438\u0435:<\/strong>\u00a0\u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u044f \u0442\u0440\u0430\u0444\u0438\u043a\u0430 \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430 + Anycast DNS.<\/p>\n<\/li>\n<\/ul>\n<p><strong>2.\u00a0\u0410\u0442\u0430\u043a\u0438 \u043d\u0430 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u044b<\/strong><\/p>\n<ul>\n<li>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u0440 \u0438\u0437 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0438:<\/strong>\u00a0SYN-\u0444\u043b\u0443\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u00ab\u043f\u043e\u043b\u043e\u0436\u0438\u043b\u00bb API-\u0448\u043b\u044e\u0437 \u0438\u0437-\u0437\u0430 \u043d\u0435\u0432\u0435\u0440\u043d\u044b\u0445 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a \u0442\u0430\u0439\u043c\u0430\u0443\u0442\u043e\u0432.<\/p>\n<\/li>\n<li>\n<p><strong>\u0420\u0435\u0448\u0435\u043d\u0438\u0435:<\/strong>\u00a0\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u00a0tcp_syncookies\u00a0\u0432 Linux \u0438 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u0443\u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0445 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0439.<\/p>\n<\/li>\n<\/ul>\n<p><strong>3.\u00a0\u0410\u0442\u0430\u043a\u0438 \u043d\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f<\/strong><\/p>\n<ul>\n<li>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u0440 \u0438\u0437 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0438:<\/strong>\u00a0Slowloris-\u0430\u0442\u0430\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043e\u0431\u043e\u0448\u043b\u0430 WAF \u0438\u0437-\u0437\u0430 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u00ab\u043c\u044f\u0433\u043a\u0438\u0445\u00bb \u043b\u0438\u043c\u0438\u0442\u043e\u0432 \u043d\u0430 \u0434\u043b\u0438\u043d\u0443 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u043e\u0432.<\/p>\n<\/li>\n<\/ul>\n<h2>\u041f\u0440\u0430\u043a\u0442\u0438\u043a\u0430 \u0437\u0430\u0449\u0438\u0442\u044b \u043e\u0442 DDoS<\/h2>\n<p><strong>1. \u041c\u043d\u043e\u0433\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u0430\u044f \u0437\u0430\u0449\u0438\u0442\u0430<\/strong><\/p>\n<ul>\n<li>\n<p><strong>Edge-\u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u044f:<\/strong>\u00a0\u043e\u0442\u0441\u0435\u043a\u0430\u0435\u0442 95 % \u043c\u0443\u0441\u043e\u0440\u043d\u043e\u0433\u043e \u0442\u0440\u0430\u0444\u0438\u043a\u0430.<\/p>\n<\/li>\n<li>\n<p><strong>\u041a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u0430 WAF:<\/strong>\u00a0\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0441 \u043f\u043e\u0434\u0434\u0435\u043b\u044c\u043d\u044b\u043c\u0438 User-Agent.<\/p>\n<\/li>\n<\/ul>\n<p><strong>2. \u041e\u0448\u0438\u0431\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u0441\u043e\u0432\u0435\u0440\u0448\u0438\u043b\u0438 (\u0438 \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u043b\u0438)<\/strong><\/p>\n<ul>\n<li>\n<p><strong>\u041e\u0448\u0438\u0431\u043a\u0430 1:<\/strong>\u00a0\u0413\u0435\u043e\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0430 \u0432\u0441\u0435\u0433\u043e \u0442\u0440\u0430\u0444\u0438\u043a\u0430 \u0438\u0437 \u0410\u0437\u0438\u0438 \u2192 \u043b\u0435\u0433\u0438\u0442\u0438\u043c\u043d\u044b\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u044b \u043d\u0435 \u0441\u043c\u043e\u0433\u043b\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c.<\/p>\n<ul>\n<li>\n<p><strong>\u0420\u0435\u0448\u0435\u043d\u0438\u0435:<\/strong>\u00a0\u0413\u0440\u0430\u0434\u0443\u0430\u043b\u044c\u043d\u0430\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0447\u0435\u0440\u0435\u0437 CAPTCHA + \u0430\u043d\u0430\u043b\u0438\u0437 \u0441\u0435\u0441\u0441\u0438\u0439.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u041e\u0448\u0438\u0431\u043a\u0430 2:<\/strong>\u00a0\u041e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 \u043f\u043b\u0430\u043d\u0430 \u044d\u0441\u043a\u0430\u043b\u0430\u0446\u0438\u0438 \u043f\u0440\u0438 \u0430\u0442\u0430\u043a\u0435 \u2192 47 \u043c\u0438\u043d\u0443\u0442 \u043f\u0440\u043e\u0441\u0442\u043e\u044f.<\/p>\n<ul>\n<li>\n<p><strong>\u0424\u0438\u043a\u0441:<\/strong>\u00a0\u0427\u0451\u0442\u043a\u0438\u0439 runbook \u0441 \u0440\u043e\u043b\u044f\u043c\u0438 SOC, DevOps \u0438 \u043c\u0435\u043d\u0435\u0434\u0436\u043c\u0435\u043d\u0442\u0430.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><strong>3. \u041c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433 \u0438 \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u0430<\/strong><\/p>\n<ul>\n<li>\n<p><strong>\u041d\u0435\u043e\u0447\u0435\u0432\u0438\u0434\u043d\u044b\u0435 \u043c\u0435\u0442\u0440\u0438\u043a\u0438:<\/strong><\/p>\n<ul>\n<li>\n<p>\u0420\u043e\u0441\u0442 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043a\u00a0\/wp-login.php\u00a0(\u043c\u043e\u0436\u0435\u0442 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043d\u0430 \u0431\u0440\u0443\u0442\u0444\u043e\u0440\u0441 \u043f\u0435\u0440\u0435\u0434 DDoS).<\/p>\n<\/li>\n<li>\n<p>\u0410\u043d\u043e\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0441\u043e\u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0435 GET\/POST (1:100 \u2014 \u043f\u0440\u0438\u0437\u043d\u0430\u043a \u0444\u043b\u0443\u0434\u0430).<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u0418\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b:<\/strong><\/p>\n<ul>\n<li>\n<p>ELK-\u0441\u0442\u0435\u043a \u0434\u043b\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u043b\u043e\u0433\u043e\u0432.<\/p>\n<\/li>\n<li>\n<p>\u041a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0435 \u0434\u0430\u0448\u0431\u043e\u0440\u0434\u044b \u0432 Grafana \u0441 \u043f\u043e\u0440\u043e\u0433\u0430\u043c\u0438 \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043d\u0438\u044f.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h2>\u041f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u0434\u0430 \u0434\u043b\u044f \u0431\u0430\u0437\u043e\u0432\u043e\u0439 \u0437\u0430\u0449\u0438\u0442\u044b \u043e\u0442 DDoS-\u0430\u0442\u0430\u043a<\/h2>\n<p>\u041e\u0434\u0438\u043d \u0438\u0437 \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432 \u0437\u0430\u0449\u0438\u0442\u044b \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u2014 \u044d\u0442\u043e \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043e\u0442 \u043e\u0434\u043d\u043e\u0433\u043e IP-\u0430\u0434\u0440\u0435\u0441\u0430 \u0437\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0439 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u043a \u0432\u0440\u0435\u043c\u0435\u043d\u0438. \u042d\u0442\u043e \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u0441\u043d\u0438\u0437\u0438\u0442\u044c \u0440\u0438\u0441\u043a HTTP-\u0444\u043b\u0443\u0434\u0430. \u0412\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u043a\u043e\u0434\u0430 \u043d\u0430 Python \u0438 Java.<\/p>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u0440 \u043d\u0430 Python \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c Flask \u0438 Redis:<\/strong><\/p>\n<pre><code class=\"python\">from flask import Flask, request, jsonify import redis import time  app = Flask(__name__) # \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043a Redis \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0441\u0447\u0435\u0442\u0447\u0438\u043a\u043e\u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 redis_client = redis.StrictRedis(host='localhost', port=6379, db=0)  # \u041b\u0438\u043c\u0438\u0442 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0435 \u043e\u043a\u043d\u043e RATE_LIMIT = 100  # \u041c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 TIME_WINDOW = 60  # \u0412\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0435 \u043e\u043a\u043d\u043e \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0430\u0445 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, 60 \u0441\u0435\u043a\u0443\u043d\u0434)  @app.before_request def rate_limit():     # \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c IP-\u0430\u0434\u0440\u0435\u0441 \u043a\u043b\u0438\u0435\u043d\u0442\u0430     client_ip = request.remote_addr      # \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043a\u043b\u044e\u0447 \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0441\u0447\u0435\u0442\u0447\u0438\u043a\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432     key = f\"rate_limit:{client_ip}\"      # \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0442\u0435\u043a\u0443\u0449\u0435\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432     current_requests = redis_client.get(key)      if current_requests and int(current_requests) &gt;= RATE_LIMIT:         # \u0415\u0441\u043b\u0438 \u043b\u0438\u043c\u0438\u0442 \u043f\u0440\u0435\u0432\u044b\u0448\u0435\u043d, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u043e\u0448\u0438\u0431\u043a\u0443         return jsonify({\"error\": \"Too many requests. Please try again later.\"}), 429      if not current_requests:         # \u0415\u0441\u043b\u0438 \u043a\u043b\u044e\u0447\u0430 \u043d\u0435\u0442, \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0435\u0433\u043e \u0438 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0432\u0440\u0435\u043c\u044f \u0436\u0438\u0437\u043d\u0438         redis_client.set(key, 1, ex=TIME_WINDOW)     else:         # \u0423\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u043c \u0441\u0447\u0435\u0442\u0447\u0438\u043a \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432         redis_client.incr(key)  @app.route('\/') def index():     return \"Welcome to the protected service!\"  if __name__ == '__main__':     app.run(debug=True)<\/code><\/pre>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u0440 \u043d\u0430 Java \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c Spring Boot \u0438 Redis:<\/strong><\/p>\n<pre><code class=\"java\">import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.data.redis.core.ValueOperations; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.beans.factory.annotation.Autowired;  import javax.servlet.http.HttpServletRequest; import java.util.concurrent.TimeUnit;  @SpringBootApplication @RestController public class DDoSProtectionApplication {      @Autowired     private StringRedisTemplate redisTemplate;      private static final int RATE_LIMIT = 100; \/\/ \u041c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432     private static final int TIME_WINDOW = 60; \/\/ \u0412\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0435 \u043e\u043a\u043d\u043e \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0430\u0445      public static void main(String[] args) {         SpringApplication.run(DDoSProtectionApplication.class, args);     }      @GetMapping(\"\/\")     public ResponseEntity&lt;String&gt; index(HttpServletRequest request) {         String clientIp = request.getRemoteAddr();         String key = \"rate_limit:\" + clientIp;          ValueOperations&lt;String, String&gt; ops = redisTemplate.opsForValue();         String currentRequests = ops.get(key);          if (currentRequests != null &amp;&amp; Integer.parseInt(currentRequests) &gt;= RATE_LIMIT) {             return ResponseEntity.status(HttpStatus.TOO_MANY_REQUESTS).body(\"Too many requests. Please try again later.\");         }          if (currentRequests == null) {             ops.set(key, \"1\", TIME_WINDOW, TimeUnit.SECONDS);         } else {             ops.increment(key);         }          return ResponseEntity.ok(\"Welcome to the protected service!\");     } }<\/code><\/pre>\n<p>\u041a\u0430\u043a \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442:<\/p>\n<ul>\n<li>\n<p><strong>Redis <\/strong>\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0441\u0447\u0451\u0442\u0447\u0438\u043a\u043e\u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043e\u0442 \u043a\u0430\u0436\u0434\u043e\u0433\u043e IP-\u0430\u0434\u0440\u0435\u0441\u0430.<\/p>\n<\/li>\n<li>\n<p><strong>RATE_LIMIT <\/strong>\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0437\u0430<strong> TIME_WINDOW <\/strong>(\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0435 \u043e\u043a\u043d\u043e).<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043e\u0442 \u043e\u0434\u043d\u043e\u0433\u043e IP-\u0430\u0434\u0440\u0435\u0441\u0430 \u043f\u0440\u0435\u0432\u044b\u0448\u0430\u0435\u0442 \u043b\u0438\u043c\u0438\u0442, \u0441\u0435\u0440\u0432\u0435\u0440 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043e\u0448\u0438\u0431\u043a\u0443 429 Too Many Requests.<\/p>\n<\/li>\n<\/ul>\n<p>\u00a0\u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430:<\/p>\n<ul>\n<li>\n<p>\u041f\u0440\u043e\u0441\u0442\u043e\u0442\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438.<\/p>\n<\/li>\n<li>\n<p>\u042d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u043e\u0442\u0438\u0432 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0430\u0442\u0430\u043a, \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a HTTP-\u0444\u043b\u0443\u0434.<\/p>\n<\/li>\n<li>\n<p>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c Redis.<\/p>\n<\/li>\n<\/ul>\n<p>\u041e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f:<\/p>\n<ul>\n<li>\n<p>\u042d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u043d\u0435 \u0437\u0430\u0449\u0438\u0442\u0438\u0442 \u043e\u0442 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 DDoS-\u0430\u0442\u0430\u043a, \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a SYN-\u0444\u043b\u0443\u0434 \u0438\u043b\u0438 UDP-\u0444\u043b\u0443\u0434.<\/p>\n<\/li>\n<li>\n<p>\u0414\u043b\u044f \u043f\u043e\u043b\u043d\u043e\u0439 \u0437\u0430\u0449\u0438\u0442\u044b \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a Cloudflare \u0438\u043b\u0438 AWS Shield.<\/p>\n<\/li>\n<\/ul>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u0440 \u043d\u0430 Go \u0434\u043b\u044f \u0432\u044b\u0441\u043e\u043a\u043e\u043d\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u0445 API:<\/strong><\/p>\n<p><strong>1. \u041a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0439 rate-limiter\u00a0<\/strong><\/p>\n<pre><code class=\"go\">package main  import ( \"context\" \"net\/http\" \"time\" \"github.com\/redis\/go-redis\/v9\" )  var rdb = redis.NewClient(&amp;redis.Options{Addr: \"localhost:6379\"}) var ctx = context.Background()  func rateLimit(next http.HandlerFunc) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { ip := r.RemoteAddr key := \"rate_limit:\" + ip  current, err := rdb.Incr(ctx, key).Result() if err != nil { http.Error(w, \"Internal error\", http.StatusInternalServerError) return }  if current == 1 { rdb.Expire(ctx, key, 1*time.Minute) \/\/ TTL = 1 \u043c\u0438\u043d }  if current &gt; 100 { \/\/ \u041b\u0438\u043c\u0438\u0442: 100 RPM http.Error(w, \"Too many requests\", http.StatusTooManyRequests) return }  next(w, r) } }<\/code><\/pre>\n<p>\u041f\u043e\u0447\u0435\u043c\u0443 Go? \u041e\u043d \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0432 \u0442\u0440\u0438 \u0440\u0430\u0437\u0430 \u0431\u043e\u043b\u044c\u0448\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443, \u0447\u0435\u043c Python.<\/p>\n<p><strong>2. \u0424\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u044f \u0431\u043e\u0442\u043e\u0432 \u0447\u0435\u0440\u0435\u0437 Nginx + Lua<\/strong><\/p>\n<pre><code class=\"lua\">http {     lua_shared_dict ip_blacklist 10m;     server {         location \/ {             access_by_lua_block {                 local ip = ngx.var.remote_addr                 local blacklist = ngx.shared.ip_blacklist                 if blacklist:get(ip) then                     ngx.exit(ngx.HTTP_FORBIDDEN)                 end             }         }     } }<\/code><\/pre>\n<p>\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043c\u0435\u0440\u044b:<\/p>\n<ul>\n<li>\n<p><strong>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 CAPTCHA<\/strong> \u0434\u043b\u044f \u043f\u043e\u0434\u043e\u0437\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432, \u0447\u0442\u043e\u0431\u044b \u043e\u0442\u0441\u0435\u0447\u044c \u0431\u043e\u0442\u043e\u0432.<\/p>\n<\/li>\n<li>\n<p><strong>\u0413\u0435\u043e\u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u044f:<\/strong> \u0431\u043b\u043e\u043a\u0438\u0440\u0443\u0439\u0442\u0435 \u0442\u0440\u0430\u0444\u0438\u043a \u0438\u0437 \u0440\u0435\u0433\u0438\u043e\u043d\u043e\u0432, \u0433\u0434\u0435 \u043e\u043d \u043d\u0435 \u043e\u0436\u0438\u0434\u0430\u0435\u0442\u0441\u044f.<\/p>\n<\/li>\n<li>\n<p><strong>\u0410\u043d\u0430\u043b\u0438\u0437 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f:<\/strong> \u0432\u043d\u0435\u0434\u0440\u0438\u0442\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043c\u0430\u0448\u0438\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u0442\u0440\u0430\u0444\u0438\u043a\u0430 \u0438 \u0432\u044b\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u0430\u043d\u043e\u043c\u0430\u043b\u0438\u0439.<\/p>\n<\/li>\n<\/ul>\n<h2>\u0427\u0442\u043e \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0434\u043b\u044f \u0443\u0433\u043b\u0443\u0431\u043b\u0451\u043d\u043d\u043e\u0433\u043e \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u044f<\/h2>\n<ul>\n<li>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u0440\u044b:<\/strong><\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/github.blog\/2018-03-01-ddos-incident-report\/\"><u>\u041a\u0430\u043a GitHub \u0432\u044b\u0434\u0435\u0440\u0436\u0430\u043b \u0430\u0442\u0430\u043a\u0443 1.35 Tbps<\/u><\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/aws.amazon.com\/ru\/shield\/\"><u>AWS Shield Advanced: \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u044b<\/u><\/a><\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u0422\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0438:<\/strong><\/p>\n<ul>\n<li>\n<p>\u041b\u0430\u0431\u043e\u0440\u0430\u0442\u043e\u0440\u043d\u044b\u0435 \u0440\u0430\u0431\u043e\u0442\u044b \u0432 GNS3 \u0434\u043b\u044f \u043c\u043e\u0434\u0435\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0430\u0442\u0430\u043a.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<hr\/>\n<p>DDoS-\u0430\u0442\u0430\u043a\u0438 \u2014 \u044d\u0442\u043e \u043d\u0435 \u0441\u0442\u0440\u0430\u0448\u0438\u043b\u043a\u0430, \u0430 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c. \u0417\u0430\u0449\u0438\u0442\u0430 \u043e\u0442 \u043d\u0438\u0445 \u0442\u0440\u0435\u0431\u0443\u0435\u0442:<\/p>\n<ol>\n<li>\n<p><strong>\u041c\u043d\u043e\u0433\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u043e\u0439 \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438<\/strong>\u00a0(\u043e\u0442 edge \u0434\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f).<\/p>\n<\/li>\n<li>\n<p><strong>\u041f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f<\/strong>\u00a0(\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0447\u0435\u0440\u0435\u0437 Red Team).<\/p>\n<\/li>\n<li>\n<p><strong>\u0427\u0451\u0442\u043a\u0438\u0445 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432<\/strong>\u00a0(\u043a\u0442\u043e \u0438 \u043a\u043e\u0433\u0434\u0430 \u043d\u0430\u0436\u0438\u043c\u0430\u0435\u0442 \u00ab\u043a\u0440\u0430\u0441\u043d\u0443\u044e \u043a\u043d\u043e\u043f\u043a\u0443\u00bb).<\/p>\n<\/li>\n<\/ol>\n<p>\u00ab\u041b\u0443\u0447\u0448\u0430\u044f \u0437\u0430\u0449\u0438\u0442\u0430 \u2014 \u044d\u0442\u043e \u043a\u043e\u0433\u0434\u0430 \u0430\u0442\u0430\u043a\u0430 \u0434\u0430\u0436\u0435 \u043d\u0435 \u0437\u0430\u043c\u0435\u0442\u043d\u0430 \u0434\u043b\u044f \u0431\u0438\u0437\u043d\u0435\u0441\u0430\u00bb (\u0438\u0437 \u043d\u0430\u0448\u0435\u0433\u043e \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0433\u043e \u043c\u0430\u043d\u0443\u0430\u043b\u0430).<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/902796\/\"> https:\/\/habr.com\/ru\/articles\/902796\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><\/figure>\n<p>\u041f\u0440\u0438\u0432\u0435\u0442! \u041c\u0435\u043d\u044f \u0437\u043e\u0432\u0443\u0442 \u041c\u0430\u043a\u0441\u0438\u043c \u0420\u044b\u0431\u0430\u043b\u043a\u043e, \u044f \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440 \u043f\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044e \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u043c\u0438 \u0432 \u04221 \u0418\u043d\u043d\u043e\u0442\u0435\u0445. \u0412 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u043c \u0446\u0438\u0444\u0440\u043e\u0432\u043e\u043c \u043c\u0438\u0440\u0435 DDoS-\u0430\u0442\u0430\u043a\u0438 \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u043b\u0438\u0441\u044c \u0438\u0437 \u0442\u0435\u043e\u0440\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0443\u0433\u0440\u043e\u0437\u044b \u0432 \u0435\u0436\u0435\u0434\u043d\u0435\u0432\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 \u0434\u043b\u044f \u0431\u0438\u0437\u043d\u0435\u0441\u0430. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043e \u0431\u0430\u0437\u043e\u0432\u044b\u0445 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0430\u0445 \u0437\u0430\u0449\u0438\u0442\u044b, \u043d\u043e \u0438 \u043f\u043e\u0434\u0435\u043b\u044e\u0441\u044c \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u0441\u043b\u0443\u0447\u0430\u044f\u043c\u0438 \u0438\u0437 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0438, \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0451\u043d\u043d\u044b\u043c\u0438 \u043e\u0448\u0438\u0431\u043a\u0430\u043c\u0438 \u0438 \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0438\u043c\u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u044f\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u043c.<\/p>\n<h2>\u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 DDoS-\u0430\u0442\u0430\u043a\u0430?<\/h2>\n<p>DDoS-\u0430\u0442\u0430\u043a\u0430 \u2014 \u044d\u0442\u043e \u043a\u0438\u0431\u0435\u0440\u0430\u0442\u0430\u043a\u0430, \u0446\u0435\u043b\u044c\u044e \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u0433\u0440\u0443\u0437\u043a\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0430, \u0441\u0435\u0442\u0438 \u0438\u043b\u0438 \u0432\u0435\u0431-\u0441\u0430\u0439\u0442\u0430 \u043e\u0433\u0440\u043e\u043c\u043d\u044b\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432, \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442 \u0438\u0445 \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u043c\u0438 \u0434\u043b\u044f \u043b\u0435\u0433\u0438\u0442\u0438\u043c\u043d\u044b\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439. \u0410\u0442\u0430\u043a\u0430 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432, \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0451\u043d\u043d\u044b\u0445 \u0432 \u0441\u0435\u0442\u044c (\u0431\u043e\u0442\u043d\u0435\u0442), \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0442 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043a \u0446\u0435\u043b\u0435\u0432\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435.<\/p>\n<p>\u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0438 DDoS-\u0430\u0442\u0430\u043a:<\/p>\n<ul>\n<li>\n<p><strong>\u0420\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0441\u0442\u044c:<\/strong> \u0430\u0442\u0430\u043a\u0430 \u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0438\u0437 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u0432, \u0447\u0442\u043e \u0437\u0430\u0442\u0440\u0443\u0434\u043d\u044f\u0435\u0442 \u0435\u0451 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 .<\/p>\n<\/li>\n<li>\n<p><strong>\u041c\u0430\u0441\u0441\u043e\u0432\u043e\u0441\u0442\u044c:<\/strong> \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043c\u043e\u0436\u0435\u0442 \u0434\u043e\u0441\u0442\u0438\u0433\u0430\u0442\u044c \u043c\u0438\u043b\u043b\u0438\u043e\u043d\u043e\u0432 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443.<\/p>\n<\/li>\n<li>\n<p><strong>\u0426\u0435\u043b\u044c:<\/strong> \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0438\u0437 \u0441\u0442\u0440\u043e\u044f, \u0441\u0434\u0435\u043b\u0430\u0432 \u0435\u0451 \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u0439.<\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u043e\u0447\u0435\u043c\u0443 \u044d\u0442\u043e \u043e\u043f\u0430\u0441\u043d\u043e:<\/p>\n<ul>\n<li>\n<p><strong>\u0424\u0438\u043d\u0430\u043d\u0441\u043e\u0432\u044b\u0435 \u043f\u043e\u0442\u0435\u0440\u0438:<\/strong>\u00a0\u043a\u0430\u0436\u0434\u0430\u044f \u043c\u0438\u043d\u0443\u0442\u0430 \u043f\u0440\u043e\u0441\u0442\u043e\u044f \u043c\u043e\u0436\u0435\u0442 \u0441\u0442\u043e\u0438\u0442\u044c \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u044f\u043c \u0434\u043e $5600 (\u043f\u043e \u0434\u0430\u043d\u043d\u044b\u043c Gartner).<\/p>\n<\/li>\n<li>\n<p><strong>\u0420\u0435\u043f\u0443\u0442\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u0440\u0438\u0441\u043a\u0438:<\/strong>\u00a0\u043a\u043b\u0438\u0435\u043d\u0442\u044b \u0442\u0435\u0440\u044f\u044e\u0442 \u0434\u043e\u0432\u0435\u0440\u0438\u0435 \u043f\u043e\u0441\u043b\u0435 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u044b\u0445 \u0438\u043d\u0446\u0438\u0434\u0435\u043d\u0442\u043e\u0432.<\/p>\n<\/li>\n<li>\n<p><strong>\u041c\u0430\u0441\u043a\u0438\u0440\u043e\u0432\u043a\u0430 \u0434\u0440\u0443\u0433\u0438\u0445 \u0430\u0442\u0430\u043a:<\/strong>\u00a0\u0447\u0430\u0441\u0442\u043e DDoS \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u043a\u0430\u043a \u00ab\u0434\u044b\u043c\u043e\u0432\u0443\u044e \u0437\u0430\u0432\u0435\u0441\u0443\u00bb \u0434\u043b\u044f \u0445\u0438\u0449\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<\/li>\n<\/ul>\n<h2>\u0422\u0438\u043f\u044b \u0430\u0442\u0430\u043a \u0438 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u044b<\/h2>\n<p><strong>1.\u00a0\u041e\u0431\u044a\u0451\u043c\u043d\u044b\u0435 \u0430\u0442\u0430\u043a\u0438<\/strong><\/p>\n<ul>\n<li>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u0440 \u0438\u0437 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0438:<\/strong>\u00a0\u0430\u0442\u0430\u043a\u0430 \u043d\u0430 350 \u0413\u0431\u0438\u0442\/\u0441. \u0447\u0435\u0440\u0435\u0437 UDP-\u0444\u043b\u0443\u0434.<\/p>\n<\/li>\n<li>\n<p><strong>\u0420\u0435\u0448\u0435\u043d\u0438\u0435:<\/strong>\u00a0\u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u044f \u0442\u0440\u0430\u0444\u0438\u043a\u0430 \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430 + Anycast DNS.<\/p>\n<\/li>\n<\/ul>\n<p><strong>2.\u00a0\u0410\u0442\u0430\u043a\u0438 \u043d\u0430 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u044b<\/strong><\/p>\n<ul>\n<li>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u0440 \u0438\u0437 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0438:<\/strong>\u00a0SYN-\u0444\u043b\u0443\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u00ab\u043f\u043e\u043b\u043e\u0436\u0438\u043b\u00bb API-\u0448\u043b\u044e\u0437 \u0438\u0437-\u0437\u0430 \u043d\u0435\u0432\u0435\u0440\u043d\u044b\u0445 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a \u0442\u0430\u0439\u043c\u0430\u0443\u0442\u043e\u0432.<\/p>\n<\/li>\n<li>\n<p><strong>\u0420\u0435\u0448\u0435\u043d\u0438\u0435:<\/strong>\u00a0\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u00a0tcp_syncookies\u00a0\u0432 Linux \u0438 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u0443\u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0445 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0439.<\/p>\n<\/li>\n<\/ul>\n<p><strong>3.\u00a0\u0410\u0442\u0430\u043a\u0438 \u043d\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f<\/strong><\/p>\n<ul>\n<li>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u0440 \u0438\u0437 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0438:<\/strong>\u00a0Slowloris-\u0430\u0442\u0430\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043e\u0431\u043e\u0448\u043b\u0430 WAF \u0438\u0437-\u0437\u0430 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u00ab\u043c\u044f\u0433\u043a\u0438\u0445\u00bb \u043b\u0438\u043c\u0438\u0442\u043e\u0432 \u043d\u0430 \u0434\u043b\u0438\u043d\u0443 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u043e\u0432.<\/p>\n<\/li>\n<\/ul>\n<h2>\u041f\u0440\u0430\u043a\u0442\u0438\u043a\u0430 \u0437\u0430\u0449\u0438\u0442\u044b \u043e\u0442 DDoS<\/h2>\n<p><strong>1. \u041c\u043d\u043e\u0433\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u0430\u044f \u0437\u0430\u0449\u0438\u0442\u0430<\/strong><\/p>\n<ul>\n<li>\n<p><strong>Edge-\u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u044f:<\/strong>\u00a0\u043e\u0442\u0441\u0435\u043a\u0430\u0435\u0442 95 % \u043c\u0443\u0441\u043e\u0440\u043d\u043e\u0433\u043e \u0442\u0440\u0430\u0444\u0438\u043a\u0430.<\/p>\n<\/li>\n<li>\n<p><strong>\u041a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u0430 WAF:<\/strong>\u00a0\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0441 \u043f\u043e\u0434\u0434\u0435\u043b\u044c\u043d\u044b\u043c\u0438 User-Agent.<\/p>\n<\/li>\n<\/ul>\n<p><strong>2. \u041e\u0448\u0438\u0431\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u0441\u043e\u0432\u0435\u0440\u0448\u0438\u043b\u0438 (\u0438 \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u043b\u0438)<\/strong><\/p>\n<ul>\n<li>\n<p><strong>\u041e\u0448\u0438\u0431\u043a\u0430 1:<\/strong>\u00a0\u0413\u0435\u043e\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0430 \u0432\u0441\u0435\u0433\u043e \u0442\u0440\u0430\u0444\u0438\u043a\u0430 \u0438\u0437 \u0410\u0437\u0438\u0438 \u2192 \u043b\u0435\u0433\u0438\u0442\u0438\u043c\u043d\u044b\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u044b \u043d\u0435 \u0441\u043c\u043e\u0433\u043b\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c.<\/p>\n<ul>\n<li>\n<p><strong>\u0420\u0435\u0448\u0435\u043d\u0438\u0435:<\/strong>\u00a0\u0413\u0440\u0430\u0434\u0443\u0430\u043b\u044c\u043d\u0430\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0447\u0435\u0440\u0435\u0437 CAPTCHA + \u0430\u043d\u0430\u043b\u0438\u0437 \u0441\u0435\u0441\u0441\u0438\u0439.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u041e\u0448\u0438\u0431\u043a\u0430 2:<\/strong>\u00a0\u041e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 \u043f\u043b\u0430\u043d\u0430 \u044d\u0441\u043a\u0430\u043b\u0430\u0446\u0438\u0438 \u043f\u0440\u0438 \u0430\u0442\u0430\u043a\u0435 \u2192 47 \u043c\u0438\u043d\u0443\u0442 \u043f\u0440\u043e\u0441\u0442\u043e\u044f.<\/p>\n<ul>\n<li>\n<p><strong>\u0424\u0438\u043a\u0441:<\/strong>\u00a0\u0427\u0451\u0442\u043a\u0438\u0439 runbook \u0441 \u0440\u043e\u043b\u044f\u043c\u0438 SOC, DevOps \u0438 \u043c\u0435\u043d\u0435\u0434\u0436\u043c\u0435\u043d\u0442\u0430.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><strong>3. \u041c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433 \u0438 \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u0430<\/strong><\/p>\n<ul>\n<li>\n<p><strong>\u041d\u0435\u043e\u0447\u0435\u0432\u0438\u0434\u043d\u044b\u0435 \u043c\u0435\u0442\u0440\u0438\u043a\u0438:<\/strong><\/p>\n<ul>\n<li>\n<p>\u0420\u043e\u0441\u0442 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043a\u00a0\/wp-login.php\u00a0(\u043c\u043e\u0436\u0435\u0442 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043d\u0430 \u0431\u0440\u0443\u0442\u0444\u043e\u0440\u0441 \u043f\u0435\u0440\u0435\u0434 DDoS).<\/p>\n<\/li>\n<li>\n<p>\u0410\u043d\u043e\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0441\u043e\u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0435 GET\/POST (1:100 \u2014 \u043f\u0440\u0438\u0437\u043d\u0430\u043a \u0444\u043b\u0443\u0434\u0430).<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u0418\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b:<\/strong><\/p>\n<ul>\n<li>\n<p>ELK-\u0441\u0442\u0435\u043a \u0434\u043b\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u043b\u043e\u0433\u043e\u0432.<\/p>\n<\/li>\n<li>\n<p>\u041a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0435 \u0434\u0430\u0448\u0431\u043e\u0440\u0434\u044b \u0432 Grafana \u0441 \u043f\u043e\u0440\u043e\u0433\u0430\u043c\u0438 \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043d\u0438\u044f.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h2>\u041f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u0434\u0430 \u0434\u043b\u044f \u0431\u0430\u0437\u043e\u0432\u043e\u0439 \u0437\u0430\u0449\u0438\u0442\u044b \u043e\u0442 DDoS-\u0430\u0442\u0430\u043a<\/h2>\n<p>\u041e\u0434\u0438\u043d \u0438\u0437 \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432 \u0437\u0430\u0449\u0438\u0442\u044b \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u2014 \u044d\u0442\u043e \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043e\u0442 \u043e\u0434\u043d\u043e\u0433\u043e IP-\u0430\u0434\u0440\u0435\u0441\u0430 \u0437\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0439 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u043a \u0432\u0440\u0435\u043c\u0435\u043d\u0438. \u042d\u0442\u043e \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u0441\u043d\u0438\u0437\u0438\u0442\u044c \u0440\u0438\u0441\u043a HTTP-\u0444\u043b\u0443\u0434\u0430. \u0412\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u043a\u043e\u0434\u0430 \u043d\u0430 Python \u0438 Java.<\/p>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u0440 \u043d\u0430 Python \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c Flask \u0438 Redis:<\/strong><\/p>\n<pre><code class=\"python\">from flask import Flask, request, jsonify import redis import time  app = Flask(__name__) # \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043a Redis \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0441\u0447\u0435\u0442\u0447\u0438\u043a\u043e\u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 redis_client = redis.StrictRedis(host='localhost', port=6379, db=0)  # \u041b\u0438\u043c\u0438\u0442 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0435 \u043e\u043a\u043d\u043e RATE_LIMIT = 100  # \u041c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 TIME_WINDOW = 60  # \u0412\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0435 \u043e\u043a\u043d\u043e \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0430\u0445 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, 60 \u0441\u0435\u043a\u0443\u043d\u0434)  @app.before_request def rate_limit():     # \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c IP-\u0430\u0434\u0440\u0435\u0441 \u043a\u043b\u0438\u0435\u043d\u0442\u0430     client_ip = request.remote_addr      # \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043a\u043b\u044e\u0447 \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0441\u0447\u0435\u0442\u0447\u0438\u043a\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432     key = f\"rate_limit:{client_ip}\"      # \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0442\u0435\u043a\u0443\u0449\u0435\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432     current_requests = redis_client.get(key)      if current_requests and int(current_requests) &gt;= RATE_LIMIT:         # \u0415\u0441\u043b\u0438 \u043b\u0438\u043c\u0438\u0442 \u043f\u0440\u0435\u0432\u044b\u0448\u0435\u043d, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u043e\u0448\u0438\u0431\u043a\u0443         return jsonify({\"error\": \"Too many requests. Please try again later.\"}), 429      if not current_requests:         # \u0415\u0441\u043b\u0438 \u043a\u043b\u044e\u0447\u0430 \u043d\u0435\u0442, \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0435\u0433\u043e \u0438 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0432\u0440\u0435\u043c\u044f \u0436\u0438\u0437\u043d\u0438         redis_client.set(key, 1, ex=TIME_WINDOW)     else:         # \u0423\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u043c \u0441\u0447\u0435\u0442\u0447\u0438\u043a \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432         redis_client.incr(key)  @app.route('\/') def index():     return \"Welcome to the protected service!\"  if __name__ == '__main__':     app.run(debug=True)<\/code><\/pre>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u0440 \u043d\u0430 Java \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c Spring Boot \u0438 Redis:<\/strong><\/p>\n<pre><code class=\"java\">import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.data.redis.core.ValueOperations; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.beans.factory.annotation.Autowired;  import javax.servlet.http.HttpServletRequest; import java.util.concurrent.TimeUnit;  @SpringBootApplication @RestController public class DDoSProtectionApplication {      @Autowired     private StringRedisTemplate redisTemplate;      private static final int RATE_LIMIT = 100; \/\/ \u041c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432     private static final int TIME_WINDOW = 60; \/\/ \u0412\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0435 \u043e\u043a\u043d\u043e \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0430\u0445      public static void main(String[] args) {         SpringApplication.run(DDoSProtectionApplication.class, args);     }      @GetMapping(\"\/\")     public ResponseEntity&lt;String&gt; index(HttpServletRequest request) {         String clientIp = request.getRemoteAddr();         String key = \"rate_limit:\" + clientIp;          ValueOperations&lt;String, String&gt; ops = redisTemplate.opsForValue();         String currentRequests = ops.get(key);          if (currentRequests != null &amp;&amp; Integer.parseInt(currentRequests) &gt;= RATE_LIMIT) {             return ResponseEntity.status(HttpStatus.TOO_MANY_REQUESTS).body(\"Too many requests. Please try again later.\");         }          if (currentRequests == null) {             ops.set(key, \"1\", TIME_WINDOW, TimeUnit.SECONDS);         } else {             ops.increment(key);         }          return ResponseEntity.ok(\"Welcome to the protected service!\");     } }<\/code><\/pre>\n<p>\u041a\u0430\u043a \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442:<\/p>\n<ul>\n<li>\n<p><strong>Redis <\/strong>\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0441\u0447\u0451\u0442\u0447\u0438\u043a\u043e\u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043e\u0442 \u043a\u0430\u0436\u0434\u043e\u0433\u043e IP-\u0430\u0434\u0440\u0435\u0441\u0430.<\/p>\n<\/li>\n<li>\n<p><strong>RATE_LIMIT <\/strong>\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0437\u0430<strong> TIME_WINDOW <\/strong>(\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0435 \u043e\u043a\u043d\u043e).<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043e\u0442 \u043e\u0434\u043d\u043e\u0433\u043e IP-\u0430\u0434\u0440\u0435\u0441\u0430 \u043f\u0440\u0435\u0432\u044b\u0448\u0430\u0435\u0442 \u043b\u0438\u043c\u0438\u0442, \u0441\u0435\u0440\u0432\u0435\u0440 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043e\u0448\u0438\u0431\u043a\u0443 429 Too Many Requests.<\/p>\n<\/li>\n<\/ul>\n<p>\u00a0\u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430:<\/p>\n<ul>\n<li>\n<p>\u041f\u0440\u043e\u0441\u0442\u043e\u0442\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438.<\/p>\n<\/li>\n<li>\n<p>\u042d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u043e\u0442\u0438\u0432 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0430\u0442\u0430\u043a, \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a HTTP-\u0444\u043b\u0443\u0434.<\/p>\n<\/li>\n<li>\n<p>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c Redis.<\/p>\n<\/li>\n<\/ul>\n<p>\u041e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f:<\/p>\n<ul>\n<li>\n<p>\u042d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u043d\u0435 \u0437\u0430\u0449\u0438\u0442\u0438\u0442 \u043e\u0442 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 DDoS-\u0430\u0442\u0430\u043a, \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a SYN-\u0444\u043b\u0443\u0434 \u0438\u043b\u0438 UDP-\u0444\u043b\u0443\u0434.<\/p>\n<\/li>\n<li>\n<p>\u0414\u043b\u044f \u043f\u043e\u043b\u043d\u043e\u0439 \u0437\u0430\u0449\u0438\u0442\u044b \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a Cloudflare \u0438\u043b\u0438 AWS Shield.<\/p>\n<\/li>\n<\/ul>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u0440 \u043d\u0430 Go \u0434\u043b\u044f \u0432\u044b\u0441\u043e\u043a\u043e\u043d\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u0445 API:<\/strong><\/p>\n<p><strong>1. \u041a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0439 rate-limiter\u00a0<\/strong><\/p>\n<pre><code class=\"go\">package main  import ( \"context\" \"net\/http\" \"time\" \"github.com\/redis\/go-redis\/v9\" )  var rdb = redis.NewClient(&amp;redis.Options{Addr: \"localhost:6379\"}) var ctx = context.Background()  func rateLimit(next http.HandlerFunc) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { ip := r.RemoteAddr key := \"rate_limit:\" + ip  current, err := rdb.Incr(ctx, key).Result() if err != nil { http.Error(w, \"Internal error\", http.StatusInternalServerError) return }  if current == 1 { rdb.Expire(ctx, key, 1*time.Minute) \/\/ TTL = 1 \u043c\u0438\u043d }  if current &gt; 100 { \/\/ \u041b\u0438\u043c\u0438\u0442: 100 RPM http.Error(w, \"Too many requests\", http.StatusTooManyRequests) return }  next(w, r) } }<\/code><\/pre>\n<p>\u041f\u043e\u0447\u0435\u043c\u0443 Go? \u041e\u043d \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0432 \u0442\u0440\u0438 \u0440\u0430\u0437\u0430 \u0431\u043e\u043b\u044c\u0448\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443, \u0447\u0435\u043c Python.<\/p>\n<p><strong>2. \u0424\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u044f \u0431\u043e\u0442\u043e\u0432 \u0447\u0435\u0440\u0435\u0437 Nginx + Lua<\/strong><\/p>\n<pre><code class=\"lua\">http {     lua_shared_dict ip_blacklist 10m;     server {         location \/ {             access_by_lua_block {                 local ip = ngx.var.remote_addr                 local blacklist = ngx.shared.ip_blacklist                 if blacklist:get(ip) then                     ngx.exit(ngx.HTTP_FORBIDDEN)                 end             }         }     } }<\/code><\/pre>\n<p>\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043c\u0435\u0440\u044b:<\/p>\n<ul>\n<li>\n<p><strong>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 CAPTCHA<\/strong> \u0434\u043b\u044f \u043f\u043e\u0434\u043e\u0437\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432, \u0447\u0442\u043e\u0431\u044b \u043e\u0442\u0441\u0435\u0447\u044c \u0431\u043e\u0442\u043e\u0432.<\/p>\n<\/li>\n<li>\n<p><strong>\u0413\u0435\u043e\u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u044f:<\/strong> \u0431\u043b\u043e\u043a\u0438\u0440\u0443\u0439\u0442\u0435 \u0442\u0440\u0430\u0444\u0438\u043a \u0438\u0437 \u0440\u0435\u0433\u0438\u043e\u043d\u043e\u0432, \u0433\u0434\u0435 \u043e\u043d \u043d\u0435 \u043e\u0436\u0438\u0434\u0430\u0435\u0442\u0441\u044f.<\/p>\n<\/li>\n<li>\n<p><strong>\u0410\u043d\u0430\u043b\u0438\u0437 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f:<\/strong> \u0432\u043d\u0435\u0434\u0440\u0438\u0442\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043c\u0430\u0448\u0438\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u0442\u0440\u0430\u0444\u0438\u043a\u0430 \u0438 \u0432\u044b\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u0430\u043d\u043e\u043c\u0430\u043b\u0438\u0439.<\/p>\n<\/li>\n<\/ul>\n<h2>\u0427\u0442\u043e \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0434\u043b\u044f \u0443\u0433\u043b\u0443\u0431\u043b\u0451\u043d\u043d\u043e\u0433\u043e \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u044f<\/h2>\n<ul>\n<li>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u0440\u044b:<\/strong><\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/github.blog\/2018-03-01-ddos-incident-report\/\"><u>\u041a\u0430\u043a GitHub \u0432\u044b\u0434\u0435\u0440\u0436\u0430\u043b \u0430\u0442\u0430\u043a\u0443 1.35 Tbps<\/u><\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/aws.amazon.com\/ru\/shield\/\"><u>AWS Shield Advanced: \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u044b<\/u><\/a><\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u0422\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0438:<\/strong><\/p>\n<ul>\n<li>\n<p>\u041b\u0430\u0431\u043e\u0440\u0430\u0442\u043e\u0440\u043d\u044b\u0435 \u0440\u0430\u0431\u043e\u0442\u044b \u0432 GNS3 \u0434\u043b\u044f \u043c\u043e\u0434\u0435\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0430\u0442\u0430\u043a.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<hr\/>\n<p>DDoS-\u0430\u0442\u0430\u043a\u0438 \u2014 \u044d\u0442\u043e \u043d\u0435 \u0441\u0442\u0440\u0430\u0448\u0438\u043b\u043a\u0430, \u0430 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c. \u0417\u0430\u0449\u0438\u0442\u0430 \u043e\u0442 \u043d\u0438\u0445 \u0442\u0440\u0435\u0431\u0443\u0435\u0442:<\/p>\n<ol>\n<li>\n<p><strong>\u041c\u043d\u043e\u0433\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u043e\u0439 \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438<\/strong>\u00a0(\u043e\u0442 edge \u0434\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f).<\/p>\n<\/li>\n<li>\n<p><strong>\u041f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f<\/strong>\u00a0(\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0447\u0435\u0440\u0435\u0437 Red Team).<\/p>\n<\/li>\n<li>\n<p><strong>\u0427\u0451\u0442\u043a\u0438\u0445 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432<\/strong>\u00a0(\u043a\u0442\u043e \u0438 \u043a\u043e\u0433\u0434\u0430 \u043d\u0430\u0436\u0438\u043c\u0430\u0435\u0442 \u00ab\u043a\u0440\u0430\u0441\u043d\u0443\u044e \u043a\u043d\u043e\u043f\u043a\u0443\u00bb).<\/p>\n<\/li>\n<\/ol>\n<p>\u00ab\u041b\u0443\u0447\u0448\u0430\u044f \u0437\u0430\u0449\u0438\u0442\u0430 \u2014 \u044d\u0442\u043e \u043a\u043e\u0433\u0434\u0430 \u0430\u0442\u0430\u043a\u0430 \u0434\u0430\u0436\u0435 \u043d\u0435 \u0437\u0430\u043c\u0435\u0442\u043d\u0430 \u0434\u043b\u044f \u0431\u0438\u0437\u043d\u0435\u0441\u0430\u00bb (\u0438\u0437 \u043d\u0430\u0448\u0435\u0433\u043e \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0433\u043e \u043c\u0430\u043d\u0443\u0430\u043b\u0430).<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/902796\/\"> https:\/\/habr.com\/ru\/articles\/902796\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-456819","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/456819","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=456819"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/456819\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=456819"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=456819"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=456819"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}