{"id":411357,"date":"2024-06-29T21:55:23","date_gmt":"2024-06-29T21:55:23","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=411357"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=411357","title":{"rendered":"<span>\u041e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u043c \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c \u0441\u0442\u0435\u043a\u043e\u0432 Docker Compose \u0441\u00a0\u043f\u043e\u043c\u043e\u0449\u044c\u044e CrowdSec<\/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<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u043a\u0430\u043a \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0438\u0442\u044c CrowdSec \u0438 Docker Compose \u0434\u043b\u044f \u0437\u0430\u0449\u0438\u0442\u044b \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439, \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u044b\u0445 \u0432 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u044b. \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u043d\u0430\u043c:<\/p>\n<ul>\n<li>\n<p>\u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0437\u0430\u043a\u0440\u044b\u0432\u0430\u0442\u044c \u0441\u043a\u043e\u043c\u043f\u0440\u043e\u043c\u0435\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c IP-\u0430\u0434\u0440\u0435\u0441\u0430\u043c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043d\u0430\u0448\u0438\u043c \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043d\u044b\u043c \u0441\u0435\u0440\u0432\u0438\u0441\u0430\u043c;<\/p>\n<\/li>\n<li>\n<p>\u0432\u0440\u0443\u0447\u043d\u0443\u044e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c\/\u0443\u0434\u0430\u043b\u044f\u0442\u044c \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043e \u0437\u0430\u043f\u0440\u0435\u0442\u0435;<\/p>\n<\/li>\n<li>\n<p>\u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0442\u044c \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 CrowdSec (\u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e cli \u0438 \u0434\u0430\u0448\u0431\u043e\u0440\u0434\u043e\u0432)<\/p>\n<\/li>\n<\/ul>\n<p>\u042d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u0431\u044b\u043b\u0430 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u0430 \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 CrowdSec.\u00a0<\/p>\n<p><strong>\u0426\u0435\u043b\u0435\u0432\u0430\u044f \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430<\/strong><\/p>\n<p>\u041d\u0430 \u0441\u0445\u0435\u043c\u0435 \u043d\u0438\u0436\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0430 \u043d\u0430\u0448\u0430 \u0446\u0435\u043b\u0435\u0432\u0430\u044f \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/c3a\/3fb\/115\/c3a3fb1155414b4ecd7d91160d17a13b.png\" width=\"731\" height=\"561\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/c3a\/3fb\/115\/c3a3fb1155414b4ecd7d91160d17a13b.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0444\u0430\u0439\u043b Docker Compose, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438:<\/p>\n<ul>\n<li>\n<p>\u043e\u0431\u0440\u0430\u0442\u043d\u044b\u0439 \u043f\u0440\u043e\u043a\u0441\u0438-\u0441\u0435\u0440\u0432\u0435\u0440, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u0439 Nginx;<\/p>\n<\/li>\n<li>\n<p>\u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0432\u044b\u0432\u043e\u0434\u044f\u0449\u0435\u0435 \u00abhello world\u00bb \u043d\u0430 Apache2;<\/p>\n<\/li>\n<li>\n<p>\u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 CrowdSec, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442 \u0436\u0443\u0440\u043d\u0430\u043b\u044b \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u043a\u0441\u0438-\u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0441 \u0446\u0435\u043b\u044c\u044e \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u0430\u0442\u0430\u043a \u043d\u0430 \u0441\u043b\u0443\u0436\u0431\u0443 HTTP;<\/p>\n<\/li>\n<li>\n<p>\u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 Metabase, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043b\u043e\u0436\u043d\u044b\u0435 \u0434\u0430\u0448\u0431\u043e\u0440\u0434\u044b \u0434\u043b\u044f \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0435\u0433\u043e.<\/p>\n<\/li>\n<\/ul>\n<p>\u041c\u044b \u0432\u044b\u0431\u0440\u0430\u043b\u0438 \u0441\u0430\u043c\u044b\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0441\u0431\u043e\u0440\u0430 \u043b\u043e\u0433\u043e\u0432: \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0442\u043e\u043c\u043e\u0432 \u043c\u0435\u0436\u0434\u0443 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430\u043c\u0438. \u0415\u0441\u043b\u0438 \u0432\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442\u0435 \u0432 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u0441\u0440\u0435\u0434\u0435, \u0442\u043e \u0432\u044b, \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 <a href=\"https:\/\/docs.docker.com\/config\/containers\/logging\/configure\/\"><u>\u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/u><\/a> \u0434\u043b\u044f \u0446\u0435\u043d\u0442\u0440\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0436\u0443\u0440\u043d\u0430\u043b\u043e\u0432 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e rsyslog \u0438\u043b\u0438 \u0434\u0440\u0443\u0433\u043e\u0439 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0435 \u0437\u0430\u0431\u0443\u0434\u044c\u0442\u0435 \u043e\u0442\u043b\u0430\u0434\u0438\u0442\u044c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e CrowdSec Docker Compose \u0434\u043b\u044f \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0433\u043e \u0447\u0442\u0435\u043d\u0438\u044f \u0436\u0443\u0440\u043d\u0430\u043b\u043e\u0432.<\/p>\n<p>\u0424\u0430\u0439\u043b <a href=\"https:\/\/github.com\/crowdsecurity\/example-docker-compose\/blob\/main\/docker-compose.yml\"><u>docker-compose.yml<\/u><\/a> \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c: <\/p>\n<pre><code>version: '3'   services:  #the application itself : static html served by apache2.  #the html can be found in .\/app\/  app:    image: httpd:alpine    restart: always    volumes:      - .\/app\/:\/usr\/local\/apache2\/htdocs\/    networks:      crowdsec_test:        ipv4_address: 172.20.0.2    #the reverse proxy that will serve the application  #you can see nginx's config in .\/reverse-proxy\/nginx.conf  reverse-proxy:    image: nginx:alpine    restart: always    ports:      - 8000:80    depends_on:      - 'app'    volumes:      - .\/reverse-proxy\/nginx.conf:\/etc\/nginx\/nginx.conf      - logs:\/var\/log\/nginx    networks:      crowdsec_test:        ipv4_address: 172.20.0.3   #crowdsec : it will be fed nginx's logs  #and later we're going to plug a firewall bouncer to it  crowdsec:    image: crowdsecurity\/crowdsec:v1.0.8    restart: always    environment:      #this is the list of collections we want to install      #https:\/\/hub.crowdsec.net\/author\/crowdsecurity\/collections\/nginx      COLLECTIONS: \"crowdsecurity\/nginx\"      GID: \"${GID-1000}\"    depends_on:      - 'reverse-proxy'    volumes:      - .\/crowdsec\/acquis.yaml:\/etc\/crowdsec\/acquis.yaml      - logs:\/var\/log\/nginx      - crowdsec-db:\/var\/lib\/crowdsec\/data\/      - crowdsec-config:\/etc\/crowdsec\/    networks:      crowdsec_test:        ipv4_address: 172.20.0.4   #metabase, because security is cool, but dashboards are cooler  dashboard:    #we're using a custom Dockerfile so that metabase pops with pre-configured dashboards    build: .\/crowdsec\/dashboard    restart: always    ports:      - 3000:3000    environment:      MB_DB_FILE: \/data\/metabase.db      MGID: \"${GID-1000}\"    depends_on:      - 'crowdsec'    volumes:      - crowdsec-db:\/metabase-data\/    networks:      crowdsec_test:        ipv4_address: 172.20.0.5   volumes:  logs:  crowdsec-db:  crowdsec-config:   networks:  crowdsec_test:    ipam:      driver: default      config:        - subnet: 172.20.0.0\/24<\/code><\/pre>\n<p>\u041a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u043a\u0441\u0438-\u0441\u0435\u0440\u0432\u0435\u0440\u0430 reverse-proxy (nginx) \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u0441\u0432\u043e\u0438 \u043b\u043e\u0433\u0438 \u0432 \u0442\u043e\u043c \u043b\u043e\u0433\u043e\u0432, \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0439 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u043c crowdsec.<\/p>\n<p>\u0411\u0430\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 SQLite CrowdSec \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u0442\u043e\u043c\u0435 crowdsec-db, \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u043e\u043c dashboard-\u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u043c (metabase).<\/p>\n<p><strong>\u041f\u0435\u0440\u0432\u043e\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0435 \u0440\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u0435<\/strong><\/p>\n<p>\u041e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f: \u043d\u0430\u043b\u0438\u0447\u0438\u0435 <a href=\"https:\/\/docs.docker.com\/engine\/install\/\"><u>Docker <\/u><\/a>\/ <a href=\"https:\/\/docs.docker.com\/compose\/install\/\"><u>Docker Compose<\/u><\/a>.\u00a0<\/p>\n<p>\u041c\u044b \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u043b\u0438 \u0432\u0441\u0435 \u0444\u0430\u0439\u043b\u044b \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 <a href=\"https:\/\/github.com\/crowdsecurity\/example-docker-compose\"><u>\u0432 \u044d\u0442\u043e \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435<\/u><\/a>, \u0447\u0442\u043e\u0431\u044b \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043a\u043b\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0445 \u0434\u043b\u044f \u0440\u0430\u0437\u0432\u0451\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u044f.<\/p>\n<p>\u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0440\u0430\u0437\u0432\u0451\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u0435 \u0438\u0437 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 Docker Compose \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u044b docker-compose up -d, \u0430 \u0437\u0430\u0442\u0435\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u043e\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e docker-compose ps.<\/p>\n<pre><code>> git clone https:\/\/github.com\/crowdsecurity\/example-docker-compose > cd example-docker-compose > sudo docker-compose up > sudo docker-compose ps  # cd examples\/docker-compose # docker-compose up -d ... # docker-compose ps                   Name                           Command               State           Ports          ------------------------------------------------------------------------------------------------ docker-compose_app_1             httpd-foreground                 Up      80\/tcp                 docker-compose_crowdsec_1        \/bin\/sh -c \/bin\/sh docker_ ...   Up                             docker-compose_dashboard_1       \/app\/run_metabase.sh             Up      0.0.0.0:3000->3000\/tcp docker-compose_reverse-proxy_1   \/docker-entrypoint.sh ngin ...   Up      0.0.0.0:8000->80\/tcp <\/code><\/pre>\n<p>\u00a0\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043c, \u0447\u0442\u043e \u0432\u0441\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442!  <\/p>\n<p><strong>\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u00a0<\/strong><\/p>\n<p>\u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u044d\u0442\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c, \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043b\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043d\u0430\u0448\u0435\u043c\u0443 \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u043c\u0443 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044e.<\/p>\n<pre><code> curl http:\/\/localhost:8000\/ Hello world !%<\/code><\/pre>\n<p><strong>\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430<\/strong><\/p>\n<p>\u041d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c, \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043b\u0438 CrowdSec \u0447\u0438\u0442\u0430\u0435\u0442 \u0436\u0443\u0440\u043d\u0430\u043b\u044b.<\/p>\n<pre><code>docker-compose exec crowdsec cscli metrics  sudo docker-compose exec crowdsec cscli metrics INFO[25-02-2021 03:38:50 PM] Buckets Metrics:                              +--------------------------------------+---------------+-----------+--------------+--------+---------+ |                BUCKET                | CURRENT COUNT | OVERFLOWS | INSTANCIATED | POURED | EXPIRED | +--------------------------------------+---------------+-----------+--------------+--------+---------+ | crowdsecurity\/http-crawl-non_statics | -             | -         |            2 |      2 |       2 | +--------------------------------------+---------------+-----------+--------------+--------+---------+ INFO[25-02-2021 03:38:50 PM] Acquisition Metrics:                          +-----------------------------------+------------+--------------+----------------+------------------------+ |              SOURCE               | LINES READ | LINES PARSED | LINES UNPARSED | LINES POURED TO BUCKET | +-----------------------------------+------------+--------------+----------------+------------------------+ | \/var\/log\/nginx\/example.access.log |          2 |            2 | -              |                      2 | +-----------------------------------+------------+--------------+----------------+------------------------+ INFO[25-02-2021 03:38:50 PM] Parser Metrics:                               +--------------------------------+------+--------+----------+ |            PARSERS             | HITS | PARSED | UNPARSED | +--------------------------------+------+--------+----------+ | child-crowdsecurity\/http-logs  |    6 |      2 |        4 | | child-crowdsecurity\/nginx-logs |    2 |      2 | -        | | crowdsecurity\/dateparse-enrich |    2 |      2 | -        | | crowdsecurity\/geoip-enrich     |    2 |      2 | -        | | crowdsecurity\/http-logs        |    2 | -      |        2 | | crowdsecurity\/nginx-logs       |    2 |      2 | -        | | crowdsecurity\/non-syslog       |    2 |      2 | -        | +--------------------------------+------+--------+----------+ INFO[25-02-2021 03:38:50 PM] Local Api Metrics:                            +--------------------+--------+------+ |       ROUTE        | METHOD | HITS | +--------------------+--------+------+ | \/v1\/watchers\/login | POST   |    2 | +--------------------+--------+------+<\/code><\/pre>\n<p>\u0427\u0442\u043e \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u043e \u0438 \u0447\u0442\u043e \u0437\u0434\u0435\u0441\u044c \u043a \u0447\u0435\u043c\u0443?\u00a0<\/p>\n<p>\u041a\u043e\u043c\u0430\u043d\u0434\u0430 cscli metrics \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u0442 <a href=\"https:\/\/prometheus.io\/docs\/introduction\/overview\/\"><u>\u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u0438\u0437 Prometheus<\/u><\/a>, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0435 CrowdSec \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e, \u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0438\u0445 \u0432 \u0442\u0430\u043a\u043e\u043c \u043d\u0435\u043e\u0431\u044b\u0447\u043d\u043e\u043c \u0432\u0438\u0434\u0435:<\/p>\n<ul>\n<li>\n<p>Acquisition metrics (\u00ab\u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u0438\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u044f\u00bb) \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442 \u043d\u0430\u043c, \u0447\u0442\u043e \u043d\u0430\u0448\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u044e\u0442 \u0436\u0443\u0440\u043d\u0430\u043b\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0447\u0438\u0442\u0430\u044e\u0442\u0441\u044f (LINES READ), \u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u044e\u0442\u0441\u044f (LINES PARSED) \u0438 \u0434\u0430\u0436\u0435 \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0441 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u043c\u0438 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f\u043c\u0438 (LINES POURED TO BUCKET),<\/p>\n<\/li>\n<li>\n<p>Buckets metrics (\u00ab\u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u043e\u0432\u00bb) \u0438 parser metrics (\u00ab\u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430\u00bb) \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442 \u043d\u0430\u043c, \u043a\u0430\u043a\u0438\u0435 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u044b \u0438 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u044e\u0442\u0441\u044f.<\/p>\n<\/li>\n<\/ul>\n<p><strong>\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 CrowdSec<\/strong><\/p>\n<p>\u041a\u043e\u043c\u0430\u043d\u0434\u0430 cscli hub list \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u043a\u0430\u043a\u0438\u0435 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u044b \u0438 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0438 \u0440\u0430\u0437\u0432\u0451\u0440\u043d\u0443\u0442\u044b.<\/p>\n<pre><code>sudo docker-compose exec crowdsec cscli hub list INFO[25-02-2021 03:46:41 PM] Loaded 14 collecs, 19 parsers, 23 scenarios, 3 post-overflow parsers  INFO[25-02-2021 03:46:41 PM] unmanaged items : 20 local, 0 tainted         INFO[25-02-2021 03:46:41 PM] PARSERS:                                      -------------------------------------------------------------------------------------------------------------  NAME                             STATUS   VERSION  LOCAL PATH                                              -------------------------------------------------------------------------------------------------------------  crowdsecurity\/sshd-logs         \u2714  enabled  0.1      \/etc\/crowdsec\/parsers\/s01-parse\/sshd-logs.yaml           crowdsecurity\/syslog-logs       \u2714  enabled  0.1      \/etc\/crowdsec\/parsers\/s00-raw\/syslog-logs.yaml           crowdsecurity\/dateparse-enrich  \u2714  enabled  0.1      \/etc\/crowdsec\/parsers\/s02-enrich\/dateparse-enrich.yaml   crowdsecurity\/geoip-enrich      \u2714  enabled  0.2      \/etc\/crowdsec\/parsers\/s02-enrich\/geoip-enrich.yaml       crowdsecurity\/nginx-logs        \u2714  enabled  0.2      \/etc\/crowdsec\/parsers\/s01-parse\/nginx-logs.yaml          crowdsecurity\/http-logs         \u2714  enabled  0.4      \/etc\/crowdsec\/parsers\/s02-enrich\/http-logs.yaml         ------------------------------------------------------------------------------------------------------------- INFO[25-02-2021 03:46:41 PM] SCENARIOS:                                    --------------------------------------------------------------------------------------------------------------------------  NAME                                        STATUS   VERSION  LOCAL PATH                                                --------------------------------------------------------------------------------------------------------------------------  ltsich\/http-w00tw00t                       \u2714  enabled  0.1      \/etc\/crowdsec\/scenarios\/http-w00tw00t.yaml                 crowdsecurity\/http-crawl-non_statics       \u2714  enabled  0.2      \/etc\/crowdsec\/scenarios\/http-crawl-non_statics.yaml        crowdsecurity\/http-probing                 \u2714  enabled  0.2      \/etc\/crowdsec\/scenarios\/http-probing.yaml                  crowdsecurity\/http-path-traversal-probing  \u2714  enabled  0.2      \/etc\/crowdsec\/scenarios\/http-path-traversal-probing.yaml   crowdsecurity\/http-xss-probing             \u2714  enabled  0.2      \/etc\/crowdsec\/scenarios\/http-xss-probing.yaml              crowdsecurity\/http-bad-user-agent          \u2714  enabled  0.3      \/etc\/crowdsec\/scenarios\/http-bad-user-agent.yaml           crowdsecurity\/ssh-bf                       \u2714  enabled  0.1      \/etc\/crowdsec\/scenarios\/ssh-bf.yaml                        crowdsecurity\/http-backdoors-attempts      \u2714  enabled  0.2      \/etc\/crowdsec\/scenarios\/http-backdoors-attempts.yaml       crowdsecurity\/http-sensitive-files         \u2714  enabled  0.2      \/etc\/crowdsec\/scenarios\/http-sensitive-files.yaml          crowdsecurity\/http-sqli-probing            \u2714  enabled  0.2      \/etc\/crowdsec\/scenarios\/http-sqli-probing.yaml            -------------------------------------------------------------------------------------------------------------------------- INFO[25-02-2021 03:46:41 PM] COLLECTIONS:                                  ------------------------------------------------------------------------------------------------------------  NAME                                STATUS   VERSION  LOCAL PATH                                          ------------------------------------------------------------------------------------------------------------  crowdsecurity\/sshd                 \u2714  enabled  0.1      \/etc\/crowdsec\/collections\/sshd.yaml                  crowdsecurity\/base-http-scenarios  \u2714  enabled  0.3      \/etc\/crowdsec\/collections\/base-http-scenarios.yaml   crowdsecurity\/linux                \u2714  enabled  0.2      \/etc\/crowdsec\/collections\/linux.yaml                 crowdsecurity\/nginx                \u2714  enabled  0.1      \/etc\/crowdsec\/collections\/nginx.yaml                ------------------------------------------------------------------------------------------------------------ INFO[25-02-2021 03:46:41 PM] POSTOVERFLOWS:                                --------------------------------------  NAME   STATUS  VERSION  LOCAL PATH  -------------------------------------- --------------------------------------<\/code><\/pre>\n<p><strong>\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 Metabase<\/strong><\/p>\n<p>Metabase \u2014 \u044d\u0442\u043e \u043e\u0434\u0438\u043d \u0438\u0437 \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u044b\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0434\u0430\u0448\u0431\u043e\u0440\u0434\u044b \u0434\u043b\u044f \u0431\u043e\u043b\u0435\u0435 \u043a\u043e\u043c\u0444\u043e\u0440\u0442\u043d\u043e\u0433\u043e \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0435\u0433\u043e. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043d\u0430 <a href=\"http:\/\/127.0.0.1:3000\/\"><u>http:\/\/127.0.0.1:3000\/<\/u><\/a> \u0438 \u0432\u043e\u0439\u0442\u0438 \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u043e\u0447\u0442\u043e\u0432\u043e\u0433\u043e \u0430\u0434\u0440\u0435\u0441\u0430 crowdsec@crowdsec.net \u0438 \u043f\u0430\u0440\u043e\u043b\u044f !!Cr0wdS3c_M3t4b4s3??<\/p>\n<p>Metabase \u043f\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441 \u043f\u0430\u0440\u043e\u043b\u0435\u043c \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0441\u043f\u043e\u0441\u043e\u0431\u0430 \u0435\u0433\u043e \u0440\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u044f. \u041d\u0435 \u0437\u0430\u0431\u0443\u0434\u044c\u0442\u0435 \u0441\u043c\u0435\u043d\u0438\u0442\u044c \u043f\u0430\u0440\u043e\u043b\u044c \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0438 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a metabase, \u0440\u0430\u0437\u0440\u0435\u0448\u0438\u0432 \u0435\u0433\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0445 IP-\u0430\u0434\u0440\u0435\u0441\u043e\u0432 \u0438\u043b\u0438 \u0441\u0435\u0442\u0435\u0432\u044b\u0445 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u043e\u0432.<\/p>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0434\u0430\u0448\u0431\u043e\u0440\u0434\u044b \u0431\u0443\u0434\u0443\u0442 \u043f\u0443\u0441\u0442\u044b\u043c\u0438, \u0442\u0430\u043a \u043a\u0430\u043a \u0430\u0442\u0430\u043a \u0435\u0449\u0435 \u043d\u0435 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u043e. \u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0434\u0430\u0448\u0431\u043e\u0440\u0434 \u0434\u043e\u043b\u0436\u0435\u043d \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/dd4\/4f1\/945\/dd44f1945206e227d3aa728412730724.png\" width=\"1200\" height=\"574\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/dd4\/4f1\/945\/dd44f1945206e227d3aa728412730724.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0415\u0441\u043b\u0438 \u043a\u0430\u043a\u0430\u044f-\u043b\u0438\u0431\u043e \u0438\u0437 \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a \u043d\u0435 \u043f\u0440\u043e\u0448\u043b\u0430, \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u043b\u043e\u0433\u0438 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u0432 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u044b docker-compose logs \u0441rowdsec (\u043a\u0430\u043a \u043f\u0440\u0438\u043c\u0435\u0440).  <\/p>\n<p><strong>\u0424\u0443\u043d\u043a\u0446\u0438\u0438 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f<\/strong><\/p>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435<\/strong>. \u0412 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0445 \u0443\u0441\u043b\u043e\u0432\u0438\u044f\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f <a href=\"https:\/\/hub.crowdsec.net\/author\/crowdsecurity\/configurations\/whitelists\"><u>\u0431\u0435\u043b\u044b\u0435 \u0441\u043f\u0438\u0441\u043a\u0438<\/u><\/a> \u0434\u043b\u044f \u043f\u0440\u0435\u0434\u043e\u0442\u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u0435\u0442\u0430 \u0447\u0430\u0441\u0442\u043d\u044b\u0445 IP-\u0430\u0434\u0440\u0435\u0441\u043e\u0432.<\/p>\n<p>\u0423\u0431\u0435\u0434\u0438\u0432\u0448\u0438\u0441\u044c, \u0447\u0442\u043e \u0432\u0441\u0451 \u0433\u043e\u0442\u043e\u0432\u043e \u043a \u0440\u0430\u0431\u043e\u0442\u0435, \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f. \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043c\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c \u0441 \u043e\u0442\u043a\u0440\u044b\u0442\u043e\u0439 \u0441\u043b\u0443\u0436\u0431\u043e\u0439 HTTP, \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043c Nikto \u0441 \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0430 \u0432 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0435\u0442\u0438 nikto -host <a href=\"http:\/\/192.168.2.227:8000\"><u>http:\/\/192.168.2.227:8000<\/u><\/a><\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/3cf\/92f\/6dd\/3cf92f6dd9560c6b6b522bb8c83ef557.png\" width=\"843\" height=\"203\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/3cf\/92f\/6dd\/3cf92f6dd9560c6b6b522bb8c83ef557.png\"\/><figcaption><\/figcaption><\/figure>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435<\/strong>. IP-\u0430\u0434\u0440\u0435\u0441 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0435\u0442\u0438 \u0438 \u043f\u043b\u0430\u043d\u0430 \u0430\u0434\u0440\u0435\u0441\u0430\u0446\u0438\u0438.<\/p>\n<p>\u041c\u044b \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u0435\u043c \u0441\u043b\u0435\u0434\u0438\u0442\u044c \u0437\u0430 \u043b\u043e\u0433\u0430\u043c\u0438 CrowdSec \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b: docker-compose logs -f crowdsec<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/464\/d45\/cf5\/464d45cf5a38525dce636732a66ae410.png\" width=\"1774\" height=\"382\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/464\/d45\/cf5\/464d45cf5a38525dce636732a66ae410.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0417\u0434\u0435\u0441\u044c \u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e IP-\u0430\u0434\u0440\u0435\u0441 \u043d\u0430\u0448\u0435\u0433\u043e \u043a\u043b\u0438\u0435\u043d\u0442\u0430 (192.168.2.211) \u0431\u044b\u043b \u043f\u043e\u043c\u0435\u0447\u0435\u043d, \u0442\u0430\u043a \u043a\u0430\u043a \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043b \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0435\u0432:<\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/hub.crowdsec.net\/author\/crowdsecurity\/configurations\/http-bad-user-agent\"><u>crowdsecurity\/http-bad-user-agent<\/u><\/a>: IP \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0438\u0442 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e\u043c\u0443 \u0432\u0440\u0435\u0434\u043e\u043d\u043e\u0441\u043d\u043e\u043c\u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u043c\u0443 \u0430\u0433\u0435\u043d\u0442\u0443;<\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/hub.crowdsec.net\/author\/crowdsecurity\/configurations\/http-probing\"><u>crowdsecurity\/http-probing<\/u><\/a>: \u043f\u044b\u0442\u0430\u043b\u0441\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u043c \u043d\u0435\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c \u0444\u0430\u0439\u043b\u0430\u043c;<\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/hub.crowdsec.net\/author\/crowdsecurity\/configurations\/http-crawl-non_statics\"><u>crowdsecurity\/http-crawl-non_statics<\/u><\/a>: \u043f\u043e\u043f\u044b\u0442\u043a\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c \u043d\u0435\u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u0440\u0435\u0441\u0443\u0440\u0441\u0430\u043c;<\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/hub.crowdsec.net\/author\/crowdsecurity\/configurations\/http-sensitive-files\"><u>crowdsecurity\/http-sensitive-files<\/u><\/a>: IP \u043f\u044b\u0442\u0430\u043b\u0441\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0431\u043e\u043b\u044c\u0448\u043e\u043c\u0443 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0443 \u043a\u043e\u043d\u0444\u0438\u0434\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432;<\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/hub.crowdsec.net\/author\/crowdsecurity\/configurations\/http-path-traversal-probing\"><u>crowdsecurity\/http-path-traversal-probing<\/u><\/a>: IP \u043f\u044b\u0442\u0430\u043b\u0441\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0430\u0442\u0430\u043a\u0443 \u043f\u043e <a href=\"https:\/\/owasp.org\/www-community\/attacks\/Path_Traversal\"><u>\u043e\u0431\u0445\u043e\u0434\u043d\u043e\u043c\u0443 \u043f\u0443\u0442\u0438<\/u><\/a>.\u00a0<\/p>\n<\/li>\n<\/ul>\n<p>\u041c\u044b \u0432\u0438\u0434\u0438\u043c, \u0447\u0442\u043e \u043d\u0430\u0448 IP-\u0430\u0434\u0440\u0435\u0441 \u0431\u044b\u043b \u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e docker-compose exec crowdsec cscli decisions list.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/a37\/098\/8e2\/a370988e22a9a900b0f21cc1d92f0ab3.png\" width=\"1127\" height=\"118\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/a37\/098\/8e2\/a370988e22a9a900b0f21cc1d92f0ab3.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u041c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u043e\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u043e\u043f\u043e\u0432\u0435\u0449\u0435\u043d\u0438\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e docker-compose exec crowdsec cscli alerts list \u0438 docker-compose exec crowdsec cscli alerts inspect -d XX:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/66b\/79d\/388\/66b79d388e2d0d3346d201875bdf8e7d.png\" width=\"1200\" height=\"223\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/66b\/79d\/388\/66b79d388e2d0d3346d201875bdf8e7d.png\"\/><figcaption><\/figcaption><\/figure>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435<\/strong>. cscli alerts list \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0432\u0441\u0435\u0445 \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u0432\u0448\u0438\u0445 \u043e\u043f\u043e\u0432\u0435\u0449\u0435\u043d\u0438\u0439.<\/p>\n<pre><code>sudo docker-compose exec crowdsec cscli alerts inspect -d 43  ################################################################################################   - ID         : 43  - Date       : 2021-02-26T08:26:07Z  - Machine    : ee0ebe5b529c4995964ff0b3e01b1801sxSpiCdYj9lpSD9W  - Simulation : false  - Reason     : crowdsecurity\/http-sensitive-files  - Events Count : 5  - Scope:Value: Ip:192.168.2.211  - Country    :   - AS         :    - Active Decisions  : +-----+------------------+--------+--------------------+----------------------+ | ID  |   SCOPE:VALUE    | ACTION |     EXPIRATION     |      CREATED AT      | +-----+------------------+--------+--------------------+----------------------+ | 802 | Ip:192.168.2.211 | ban    | 3h53m15.124782708s | 2021-02-26T08:26:07Z | +-----+------------------+--------+--------------------+----------------------+   - Events  :  - Date: 2021-02-26 08:26:07 +0000 UTC +---------------+-----------------+ |      KEY      |      VALUE      | +---------------+-----------------+ | ASNNumber     |               0 | | http_args_len |               0 | | log_type      | http_access-log | | service       | http            | | source_ip     | 192.168.2.211   | | http_status   |             404 | | http_path     | \/CyNqbugR.bak   | | IsInEU        | false           | +---------------+-----------------+  - Date: 2021-02-26 08:26:07 +0000 UTC +---------------+-----------------+ |      KEY      |      VALUE      | +---------------+-----------------+ | log_type      | http_access-log | | service       | http            | | source_ip     | 192.168.2.211   | | http_status   |             404 | | http_path     | \/CyNqbugR.sql   | | IsInEU        | false           | | ASNNumber     |               0 | | http_args_len |               0 | +---------------+-----------------+  - Date: 2021-02-26 08:26:07 +0000 UTC +---------------+-----------------+ |      KEY      |      VALUE      | +---------------+-----------------+ | service       | http            | | source_ip     | 192.168.2.211   | | http_status   |             404 | | http_path     | \/CyNqbugR.exe   | | IsInEU        | false           | | ASNNumber     |               0 | | http_args_len |               0 | | log_type      | http_access-log | +---------------+-----------------+  - Date: 2021-02-26 08:26:07 +0000 UTC +---------------+-------------------+ |      KEY      |       VALUE       | +---------------+-------------------+ | IsInEU        | false             | | ASNNumber     |                 0 | | http_args_len |                 0 | | log_type      | http_access-log   | | service       | http              | | source_ip     | 192.168.2.211     | | http_status   |               404 | | http_path     | \/CyNqbugR.printer | +---------------+-------------------+  - Date: 2021-02-26 08:26:07 +0000 UTC +---------------+--------------------+ |      KEY      |       VALUE        | +---------------+--------------------+ | ASNNumber     |                  0 | | http_args_len |                  0 | | log_type      | http_access-log    | | service       | http               | | source_ip     | 192.168.2.211      | | http_status   |                404 | | http_path     | \/CyNqbugR.htaccess | | IsInEU        | false              | +---------------+--------------------+<\/code><\/pre>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435.<\/strong> cscli alerts inspect -d &lt;ID> \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e\u0431 \u043e\u043f\u043e\u0432\u0435\u0449\u0435\u043d\u0438\u0438.  <\/p>\n<p><strong>\u041c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0434\u0430\u0448\u0431\u043e\u0440\u0434\u043e\u0432<\/strong><\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0435\u0432 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0432\u0435\u0440\u043d\u0443\u0442\u044c\u0441\u044f \u043a \u0434\u0430\u0448\u0431\u043e\u0440\u0434\u0430\u043c Metabase (<a href=\"http:\/\/127.0.0.1:3000\"><u>http:\/\/127.0.0.1:3000<\/u><\/a> \u0441 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u043e\u0439 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e) \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/cab\/fb0\/234\/cabfb023468318208a6e1ea2520b4a49.png\" width=\"1858\" height=\"931\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/cab\/fb0\/234\/cabfb023468318208a6e1ea2520b4a49.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0415\u0441\u043b\u0438 \u0431\u044b \u0442\u0440\u0430\u0444\u0438\u043a \u043f\u043e\u0441\u0442\u0443\u043f\u0430\u043b \u0441 \u043e\u0431\u0449\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u0433\u043e IP-\u0430\u0434\u0440\u0435\u0441\u0430 (\u0430 \u043d\u0435 \u0441 \u0447\u0430\u0441\u0442\u043d\u043e\u0433\u043e, \u043a\u0430\u043a \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435), crowdsecurity\/geoip-enrich \u043e\u0431\u043e\u0433\u0430\u0442\u0438\u043b \u0431\u044b \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0433\u0435\u043e\u043b\u043e\u043a\u0430\u0446\u0438\u0438 \u0438 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0435\u0439 \u043e\u0431 AS\/\u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0435.<\/p>\n<p><strong>\u0411\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0430 \u0430\u0442\u0430\u043a \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0431\u0430\u0443\u043d\u0441\u0435\u0440\u043e\u0432<\/strong><\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043f\u043e\u043b\u043d\u043e\u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u0430\u044f \u0441\u043b\u0443\u0436\u0431\u0430 CrowdSec, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0432\u0430\u0442\u044c \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0435 \u0430\u0442\u0430\u043a\u0438 \u043d\u0430 \u043d\u0430\u0448 \u0441\u0435\u0440\u0432\u0438\u0441 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <a href=\"https:\/\/hub.crowdsec.net\/author\/crowdsecurity\/collections\/base-http-scenarios\"><u>\u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0445 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0435\u0432 \u0441\u0431\u043e\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445<\/u><\/a>.<\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u0430\u0442\u0430\u043a \u043d\u0430\u0448\u0430 \u0446\u0435\u043b\u044c \u2014 \u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0445. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <a href=\"https:\/\/hub.crowdsec.net\/author\/crowdsecurity\/bouncers\/cs-firewall-bouncer\"><u>cs-firewall-bouncer<\/u><\/a>. \u041d\u0430\u0447\u043d\u0438\u0442\u0435 \u0441 \u0435\u0433\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u043d\u0430 \u0445\u043e\u0441\u0442\u0435 \u0438 \u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u0443\u0439\u0442\u0435 \u0432\u0440\u0435\u0434\u043e\u043d\u043e\u0441\u043d\u044b\u0439 \u0442\u0440\u0430\u0444\u0438\u043a \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0432 DOCKER-USER, \u043f\u0443\u0442\u0438 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e, \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u043c Docker \u0434\u043b\u044f \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438 \u0442\u0440\u0430\u0444\u0438\u043a\u0430, \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u043d\u043e\u0433\u043e \u0434\u043b\u044f \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u0432.<\/p>\n<p>\u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 <a href=\"https:\/\/hub.crowdsec.net\/author\/crowdsecurity\/bouncers\/cs-firewall-bouncer\"><u>\u043d\u0430\u0439\u0442\u0438 firewall bouncer \u043d\u0430 CrowdSec Hub<\/u><\/a>. \u0415\u0433\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f \u0432\u0435\u0440\u0441\u0438\u044f \u2014 v0.0.16.<\/p>\n<pre><code>wget https:\/\/github.com\/crowdsecurity\/cs-firewall-bouncer\/releases\/download\/v0.0.10\/cs-firewall-bouncer.tgz tar xvzf cs-firewall-bouncer.tgz cd cs-firewall-bouncer-v0.0.10 sudo .\/install.sh<\/code><\/pre>\n<p>\u0421 \u0438\u044e\u043b\u044f Debian, Ubuntu, CentOS, RHEL \u0438 Amazon Linux \u0432\u043a\u043b\u044e\u0447\u0430\u044e\u0442 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u043f\u0430\u043a\u0435\u0442\u044b firewall-\u0431\u0430\u0443\u043d\u0441\u0435\u0440\u043e\u0432. \u041f\u0440\u043e\u0432\u0435\u0440\u044c\u0442\u0435 \u043d\u0430\u0448 <a href=\"https:\/\/github.com\/crowdsecurity\/crowdsec\"><u>\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 GitHub<\/u><\/a> \u0434\u043b\u044f \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438. \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u0430. \u041e\u043d\u0430 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0440\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u0435 \u043c\u043e\u0434\u0443\u043b\u044f systemd \u0434\u043b\u044f \u0441\u043b\u0443\u0436\u0431\u044b \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u043d\u0430 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0435 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f\u043c. \u0417\u0434\u0435\u0441\u044c \u0443 \u043d\u0430\u0441 \u043d\u0435 \u0431\u044b\u043b \u0437\u0430\u043f\u0443\u0449\u0435\u043d ipset, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u043d \u0431\u044b\u043b \u0434\u043b\u044f \u043d\u0430\u0441 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/521\/46f\/7aa\/52146f7aaaf16517be10564d301e3a8e.png\" width=\"1233\" height=\"291\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/521\/46f\/7aa\/52146f7aaaf16517be10564d301e3a8e.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0417\u0434\u0435\u0441\u044c \u043c\u044b \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b\u0438 \u0431\u0430\u0443\u043d\u0441\u0435\u0440 \u043d\u0430 \u0445\u043e\u0441\u0442, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043d\u0435 \u0437\u0430\u043f\u0443\u0449\u0435\u043d CrowdSec. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u043b\u0443\u0436\u0431\u0430 \u043d\u0435\u0434\u043e\u0432\u043e\u043b\u044c\u043d\u0430.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043c \u0431\u0430\u0443\u043d\u0441\u0435\u0440, \u0447\u0442\u043e\u0431\u044b \u043e\u043d \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u043b \u0441 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u043c API \u043d\u0430 \u043d\u0430\u0448\u0435\u043c \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0435 CrowdSec. \u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0442\u043e\u043a\u0435\u043d\u0430 API \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u0431\u0430\u0443\u043d\u0441\u0435\u0440\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e cscli.<\/p>\n<pre><code>docker-compose exec crowdsec cscli bouncers add HostFirewallBouncer  sudo docker-compose exec crowdsec cscli bouncers add HostFirewallBouncer Api key for 'HostFirewallBouncer':     aaebb3708fe67eeeccbb52a21e5e7862  Please keep this key since you will not be able to retrive it!<\/code><\/pre>\n<p>\u0417\u0430\u0442\u0435\u043c \u0432\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0431\u0430\u0443\u043d\u0441\u0435\u0440 \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u043e\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u044d\u0442\u043e\u0442 \u0442\u043e\u043a\u0435\u043d \u0434\u043b\u044f \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0433\u043e API CrowdSec. \u0412\u00a0\/etc\/crowdsec\/cs-firewall-bouncer\/cs-firewall-bouncer.yaml, \u043e\u0442\u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u0443\u0439\u0442\u0435 api_url,\u00a0api_key, \u0438 iptables_chains. \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 IPv6 \u0442\u0430\u043a\u0436\u0435 \u0431\u044b\u043b \u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u044b disable_ipv6:<\/p>\n<pre><code>mode: iptables piddir: \/var\/run\/ update_frequency: 10s daemonize: true log_mode: file log_dir: \/var\/log\/ log_level: info api_url: http:\/\/172.20.0.4:8080\/ api_key: aaebb3708fe67eeeccbb52a21e5e7862 disable_ipv6: true #if present, insert rule in those chains iptables_chains:  - DOCKER-USER<\/code><\/pre>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435<\/strong>. \u041c\u044b \u043e\u0442\u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u043f\u0443\u0442\u0438, \u0447\u0442\u043e\u0431\u044b \u0432 \u043d\u0438\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0443\u0442\u044c DOCKER-USER, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b\u0438 api_url \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u043d\u0430\u0448\u0438\u043c \u0444\u0430\u0439\u043b\u043e\u043c docker-compose.yml \u0438 \u0443\u043a\u0430\u0437\u0430\u043b\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0442\u043e \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0442\u043e\u043a\u0435\u043d api.  <\/p>\n<p><strong>CrowdSec \u0432 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0438<\/strong><\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 \u0431\u0430\u0443\u043d\u0441\u0435\u0440 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e sudo systemctl start cs-firewall-bouncer.service, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u043d\u043e\u0432\u0443\u044e \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u0431\u0440\u0430\u043d\u0434\u043c\u0430\u0443\u044d\u0440\u0430:<\/p>\n<pre><code>sudo iptables -L -n                                                                   ... Chain DOCKER-USER (1 references) target     prot opt source               destination          DROP       all  --  0.0.0.0\/0            0.0.0.0\/0            match-set crowdsec-blacklists src ...<\/code><\/pre>\n<p>\u041c\u044b \u0432\u0438\u0434\u0438\u043c, \u0447\u0442\u043e \u043d\u0430\u0448 \u043f\u0443\u0442\u044c DOCKER-USER \u043f\u043e\u043b\u0443\u0447\u0438\u043b \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u0434\u043b\u044f \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0432\u0445\u043e\u0434\u044f\u0449\u0435\u0433\u043e \u0442\u0440\u0430\u0444\u0438\u043a\u0430 \u0441 \u043d\u0430\u0448\u0438\u043c ipset, \u0430 ipset \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0435\u0439.  <\/p>\n<pre><code> sudo ipset -L crowdsec-blacklists             Name: crowdsec-blacklists Type: hash:net Revision: 6 Header: family inet hashsize 1024 maxelem 65536 timeout 300 Size in memory: 6016 References: 1 Number of entries: 61 Members: 178.20.157.98 timeout 80103 52.184.35.59 timeout 80103 ...<\/code><\/pre>\n<p>\u041a\u0430\u043a \u0432\u044b \u0443\u0436\u0435 \u043c\u043e\u0433\u043b\u0438 \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, ipset \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430\u0448\u0438\u043c\u0438 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u044f\u043c\u0438, \u043d\u043e \u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u044f\u043c\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u0430. \u041e\u0434\u043d\u0430\u043a\u043e \u043c\u044b \u0432\u0438\u0434\u0438\u043c, \u0447\u0442\u043e \u043d\u0430\u0448\u0438 \u00ab\u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0435\u00bb \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043f\u043e\u043f\u0430\u043b\u0438 \u0432 \u0441\u043f\u0438\u0441\u043e\u043a ipset.  <\/p>\n<pre><code> sudo ipset -L crowdsec-blacklists  | grep 192 192.168.2.211 timeout 12859<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u043c\u0430\u0448\u0438\u043d\u0443 \u0437\u043b\u043e\u0443\u043c\u044b\u0448\u043b\u0435\u043d\u043d\u0438\u043a\u0430 \u0438 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0442\u044c, \u0447\u0442\u043e \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u0435\u043d\u0430 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0430 \u0438 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044e \u043d\u0435\u0442.  <\/p>\n<pre><code>$ curl -vv 192.168.2.227:8000 * Rebuilt URL to: 192.168.2.227:8000\/ *   Trying 192.168.2.227... * TCP_NODELAY set ^C<\/code><\/pre>\n<p>\u0417\u043b\u043e\u0443\u043c\u044b\u0448\u043b\u0435\u043d\u043d\u0438\u043a \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a\u043e \u0432\u0441\u0435\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u043c Docker Compose. \u041c\u044b \u043d\u0430\u043c\u0435\u0440\u0435\u043d\u043d\u043e \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u043b\u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043f\u0443\u0442\u0435\u043c DOCKER-USER, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0430 \u0445\u043e\u0441\u0442\u0435 \u0431\u0443\u0434\u0443\u0442 \u043f\u043e-\u043f\u0440\u0435\u0436\u043d\u0435\u043c\u0443 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b. \u0415\u0441\u043b\u0438 \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u0437\u0430\u043f\u0440\u0435\u0442\u0438\u0442\u044c \u0432\u0435\u0441\u044c \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0439 \u0442\u0440\u0430\u0444\u0438\u043a, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u0443\u0442\u044c INPUT \u0442\u0430\u043a \u0436\u0435, \u043a\u0430\u043a \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e.<\/p>\n<p><strong>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/strong><\/p>\n<p>\u0412 \u044d\u0442\u043e\u043c \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0435 \u043c\u044b \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u043b\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Docker Compose \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0439, \u043d\u043e \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043f\u043e\u043b\u043d\u044b\u0439 \u043f\u0440\u0438\u043a\u043b\u0430\u0434\u043d\u043e\u0439 \u0441\u0442\u0435\u043a. \u0417\u0430\u0442\u0435\u043c \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043b\u0438, \u043a\u0430\u043a \u0437\u0430\u0449\u0438\u0442\u0438\u0442\u044c \u0435\u0433\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e CrowdSec. \u0425\u043e\u0442\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 CrowdSec \u043a\u0430\u043a \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0437\u0430\u0449\u0438\u0442\u044b \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0445\u043e\u0441\u0442\u0430, \u043c\u044b \u0443\u0437\u043d\u0430\u043b\u0438, \u0447\u0442\u043e \u043e\u043d \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u0434\u043b\u044f Docker \u0441\u0440\u0435\u0434. \u0415\u0441\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u043f\u043e\u043e\u0431\u0449\u0430\u0442\u044c\u0441\u044f \u0441 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 \u0438 \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u0441\u0432\u043e\u0438\u043c \u043c\u043d\u0435\u043d\u0438\u0435\u043c, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u0432\u044f\u0437\u0430\u0442\u044c\u0441\u044f \u0441 \u043d\u0430\u043c\u0438 <a href=\"https:\/\/gitter.im\/crowdsec-project\/community\"><u>\u043d\u0430 \u043d\u0430\u0448\u0435\u043c \u043a\u0430\u043d\u0430\u043b\u0435 Gitter<\/u><\/a> \u0438\u043b\u0438 \u0432 \u0447\u0430\u0442\u0435 \u043d\u0430 \u043d\u0430\u0448\u0435\u043c <a href=\"https:\/\/crowdsec.net\/?mtm_campaign=habr%20docker%20article-website\"><u>\u0441\u0430\u0439\u0442\u0435<\/u><\/a>.\u00a0<\/p>\n<h3>\u041e\u0431 \u0430\u0432\u0442\u043e\u0440\u0435<\/h3>\n<p>\u0422\u0438\u0431\u043e \u041a\u043e\u0448\u043b\u0435\u043d (Thibault Koechlin) &#8212; CTO CrowdSec, \u043e\u043a\u043e\u043d\u0447\u0438\u043b IT-\u0448\u043a\u043e\u043b\u0443 EPITECH \u043f\u043e \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u00ab\u0411\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c \u0418\u0422-\u0441\u0438\u0441\u0442\u0435\u043c \u0438 \u0441\u0435\u0442\u0435\u0439\u00bb. \u041e\u043d \u043d\u0430\u0447\u0430\u043b \u043a\u0430\u0440\u044c\u0435\u0440\u0443 \u0432 NBS \u0432 2004 \u0433\u043e\u0434\u0443 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u044d\u043a\u0441\u043f\u0435\u0440\u0442\u0430 \u043f\u043e \u043f\u0435\u043d-\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e, \u0430 \u0437\u0430\u0442\u0435\u043c \u0431\u044b\u043b \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d \u0433\u043b\u0430\u0432\u043e\u0439 \u0433\u0440\u0443\u043f\u043f\u044b \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438. \u0417\u0430\u0442\u0435\u043c \u043e\u043d \u0441\u0442\u0430\u043b \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u043e\u043c \u043f\u043e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u0438 \u0443\u0433\u043b\u0443\u0431\u0438\u043b \u0441\u0432\u043e\u0438 \u0437\u043d\u0430\u043d\u0438\u044f \u0432 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u043e\u0431\u043e\u0440\u043e\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u043d\u0430\u0447\u0430\u043b \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u043e\u0432 \u0441 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u043c \u043a\u043e\u0434\u043e\u043c \u0438 \u0441\u043e\u0431\u0440\u0430\u043b \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u044d\u043a\u0441\u043f\u0435\u0440\u0442\u043e\u0432 \u0441 \u0440\u0435\u0434\u043a\u0438\u043c\u0438 \u043d\u0430\u0432\u044b\u043a\u0430\u043c\u0438. \u041e\u043d \u0434\u043e\u0441\u0442\u0438\u0433 \u0432\u0435\u0440\u0448\u0438\u043d\u044b \u043a\u0430\u0440\u044c\u0435\u0440\u044b \u0432 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438, \u0441\u0442\u0430\u0432 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u043c \u043f\u0430\u0440\u0442\u043d\u0435\u0440\u043e\u043c, \u0438 \u0432\u043e\u0437\u0433\u043b\u0430\u0432\u0438\u043b \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0444\u043b\u0430\u0433\u043c\u0430\u043d\u0441\u043a\u043e\u0433\u043e \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u0430 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438: Cerberhost. \u0412 \u0434\u0435\u043a\u0430\u0431\u0440\u0435 2019 \u0433\u043e\u0434\u0430 \u043e\u043d \u0441\u0442\u0430\u043b \u0441\u043e\u0443\u0447\u0440\u0435\u0434\u0438\u0442\u0435\u043b\u0435\u043c CrowdSec \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u0424\u0438\u043b\u0438\u043f\u043f\u043e\u043c \u0425\u044e\u043c\u043e (Philippe Humeau) \u0438 \u041b\u043e\u0440\u0430\u043d\u043e\u043c \u0421\u0443\u0431\u0440\u0435\u0432\u0438\u043b\u043b\u0430 (Laurent Soubrevilla). \u041e\u043d \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u043e\u043c \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438.<\/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\/581876\/\"> https:\/\/habr.com\/ru\/articles\/581876\/<\/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<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u043a\u0430\u043a \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0438\u0442\u044c CrowdSec \u0438 Docker Compose \u0434\u043b\u044f \u0437\u0430\u0449\u0438\u0442\u044b \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439, \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u044b\u0445 \u0432 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u044b. \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u043d\u0430\u043c:<\/p>\n<ul>\n<li>\n<p>\u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0437\u0430\u043a\u0440\u044b\u0432\u0430\u0442\u044c \u0441\u043a\u043e\u043c\u043f\u0440\u043e\u043c\u0435\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c IP-\u0430\u0434\u0440\u0435\u0441\u0430\u043c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043d\u0430\u0448\u0438\u043c \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043d\u044b\u043c \u0441\u0435\u0440\u0432\u0438\u0441\u0430\u043c;<\/p>\n<\/li>\n<li>\n<p>\u0432\u0440\u0443\u0447\u043d\u0443\u044e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c\/\u0443\u0434\u0430\u043b\u044f\u0442\u044c \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043e \u0437\u0430\u043f\u0440\u0435\u0442\u0435;<\/p>\n<\/li>\n<li>\n<p>\u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0442\u044c \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 CrowdSec (\u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e cli \u0438 \u0434\u0430\u0448\u0431\u043e\u0440\u0434\u043e\u0432)<\/p>\n<\/li>\n<\/ul>\n<p>\u042d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u0431\u044b\u043b\u0430 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u0430 \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 CrowdSec.\u00a0<\/p>\n<p><strong>\u0426\u0435\u043b\u0435\u0432\u0430\u044f \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430<\/strong><\/p>\n<p>\u041d\u0430 \u0441\u0445\u0435\u043c\u0435 \u043d\u0438\u0436\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0430 \u043d\u0430\u0448\u0430 \u0446\u0435\u043b\u0435\u0432\u0430\u044f \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430:<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0444\u0430\u0439\u043b Docker Compose, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438:<\/p>\n<ul>\n<li>\n<p>\u043e\u0431\u0440\u0430\u0442\u043d\u044b\u0439 \u043f\u0440\u043e\u043a\u0441\u0438-\u0441\u0435\u0440\u0432\u0435\u0440, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u0439 Nginx;<\/p>\n<\/li>\n<li>\n<p>\u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0432\u044b\u0432\u043e\u0434\u044f\u0449\u0435\u0435 \u00abhello world\u00bb \u043d\u0430 Apache2;<\/p>\n<\/li>\n<li>\n<p>\u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 CrowdSec, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442 \u0436\u0443\u0440\u043d\u0430\u043b\u044b \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u043a\u0441\u0438-\u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0441 \u0446\u0435\u043b\u044c\u044e \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u0430\u0442\u0430\u043a \u043d\u0430 \u0441\u043b\u0443\u0436\u0431\u0443 HTTP;<\/p>\n<\/li>\n<li>\n<p>\u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 Metabase, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043b\u043e\u0436\u043d\u044b\u0435 \u0434\u0430\u0448\u0431\u043e\u0440\u0434\u044b \u0434\u043b\u044f \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0435\u0433\u043e.<\/p>\n<\/li>\n<\/ul>\n<p>\u041c\u044b \u0432\u044b\u0431\u0440\u0430\u043b\u0438 \u0441\u0430\u043c\u044b\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0441\u0431\u043e\u0440\u0430 \u043b\u043e\u0433\u043e\u0432: \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0442\u043e\u043c\u043e\u0432 \u043c\u0435\u0436\u0434\u0443 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430\u043c\u0438. \u0415\u0441\u043b\u0438 \u0432\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442\u0435 \u0432 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u0441\u0440\u0435\u0434\u0435, \u0442\u043e \u0432\u044b, \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 <a href=\"https:\/\/docs.docker.com\/config\/containers\/logging\/configure\/\"><u>\u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/u><\/a> \u0434\u043b\u044f \u0446\u0435\u043d\u0442\u0440\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0436\u0443\u0440\u043d\u0430\u043b\u043e\u0432 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e rsyslog \u0438\u043b\u0438 \u0434\u0440\u0443\u0433\u043e\u0439 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0435 \u0437\u0430\u0431\u0443\u0434\u044c\u0442\u0435 \u043e\u0442\u043b\u0430\u0434\u0438\u0442\u044c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e CrowdSec Docker Compose \u0434\u043b\u044f \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0433\u043e \u0447\u0442\u0435\u043d\u0438\u044f \u0436\u0443\u0440\u043d\u0430\u043b\u043e\u0432.<\/p>\n<p>\u0424\u0430\u0439\u043b <a href=\"https:\/\/github.com\/crowdsecurity\/example-docker-compose\/blob\/main\/docker-compose.yml\"><u>docker-compose.yml<\/u><\/a> \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c: <\/p>\n<pre><code>version: '3'   services:  #the application itself : static html served by apache2.  #the html can be found in .\/app\/  app:    image: httpd:alpine    restart: always    volumes:      - .\/app\/:\/usr\/local\/apache2\/htdocs\/    networks:      crowdsec_test:        ipv4_address: 172.20.0.2    #the reverse proxy that will serve the application  #you can see nginx's config in .\/reverse-proxy\/nginx.conf  reverse-proxy:    image: nginx:alpine    restart: always    ports:      - 8000:80    depends_on:      - 'app'    volumes:      - .\/reverse-proxy\/nginx.conf:\/etc\/nginx\/nginx.conf      - logs:\/var\/log\/nginx    networks:      crowdsec_test:        ipv4_address: 172.20.0.3   #crowdsec : it will be fed nginx's logs  #and later we're going to plug a firewall bouncer to it  crowdsec:    image: crowdsecurity\/crowdsec:v1.0.8    restart: always    environment:      #this is the list of collections we want to install      #https:\/\/hub.crowdsec.net\/author\/crowdsecurity\/collections\/nginx      COLLECTIONS: \"crowdsecurity\/nginx\"      GID: \"${GID-1000}\"    depends_on:      - 'reverse-proxy'    volumes:      - .\/crowdsec\/acquis.yaml:\/etc\/crowdsec\/acquis.yaml      - logs:\/var\/log\/nginx      - crowdsec-db:\/var\/lib\/crowdsec\/data\/      - crowdsec-config:\/etc\/crowdsec\/    networks:      crowdsec_test:        ipv4_address: 172.20.0.4   #metabase, because security is cool, but dashboards are cooler  dashboard:    #we're using a custom Dockerfile so that metabase pops with pre-configured dashboards    build: .\/crowdsec\/dashboard    restart: always    ports:      - 3000:3000    environment:      MB_DB_FILE: \/data\/metabase.db      MGID: \"${GID-1000}\"    depends_on:      - 'crowdsec'    volumes:      - crowdsec-db:\/metabase-data\/    networks:      crowdsec_test:        ipv4_address: 172.20.0.5   volumes:  logs:  crowdsec-db:  crowdsec-config:   networks:  crowdsec_test:    ipam:      driver: default      config:        - subnet: 172.20.0.0\/24<\/code><\/pre>\n<p>\u041a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u043a\u0441\u0438-\u0441\u0435\u0440\u0432\u0435\u0440\u0430 reverse-proxy (nginx) \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u0441\u0432\u043e\u0438 \u043b\u043e\u0433\u0438 \u0432 \u0442\u043e\u043c \u043b\u043e\u0433\u043e\u0432, \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0439 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u043c crowdsec.<\/p>\n<p>\u0411\u0430\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 SQLite CrowdSec \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u0442\u043e\u043c\u0435 crowdsec-db, \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u043e\u043c dashboard-\u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u043c (metabase).<\/p>\n<p><strong>\u041f\u0435\u0440\u0432\u043e\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0435 \u0440\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u0435<\/strong><\/p>\n<p>\u041e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f: \u043d\u0430\u043b\u0438\u0447\u0438\u0435 <a href=\"https:\/\/docs.docker.com\/engine\/install\/\"><u>Docker <\/u><\/a>\/ <a href=\"https:\/\/docs.docker.com\/compose\/install\/\"><u>Docker Compose<\/u><\/a>.\u00a0<\/p>\n<p>\u041c\u044b \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u043b\u0438 \u0432\u0441\u0435 \u0444\u0430\u0439\u043b\u044b \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 <a href=\"https:\/\/github.com\/crowdsecurity\/example-docker-compose\"><u>\u0432 \u044d\u0442\u043e \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435<\/u><\/a>, \u0447\u0442\u043e\u0431\u044b \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043a\u043b\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0445 \u0434\u043b\u044f \u0440\u0430\u0437\u0432\u0451\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u044f.<\/p>\n<p>\u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0440\u0430\u0437\u0432\u0451\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u0435 \u0438\u0437 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 Docker Compose \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u044b docker-compose up -d, \u0430 \u0437\u0430\u0442\u0435\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u043e\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e docker-compose ps.<\/p>\n<pre><code>> git clone https:\/\/github.com\/crowdsecurity\/example-docker-compose > cd example-docker-compose > sudo docker-compose up > sudo docker-compose ps  # cd examples\/docker-compose # docker-compose up -d ... # docker-compose ps                   Name                           Command               State           Ports          ------------------------------------------------------------------------------------------------ docker-compose_app_1             httpd-foreground                 Up      80\/tcp                 docker-compose_crowdsec_1        \/bin\/sh -c \/bin\/sh docker_ ...   Up                             docker-compose_dashboard_1       \/app\/run_metabase.sh             Up      0.0.0.0:3000->3000\/tcp docker-compose_reverse-proxy_1   \/docker-entrypoint.sh ngin ...   Up      0.0.0.0:8000->80\/tcp <\/code><\/pre>\n<p>\u00a0\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043c, \u0447\u0442\u043e \u0432\u0441\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442!  <\/p>\n<p><strong>\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u00a0<\/strong><\/p>\n<p>\u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u044d\u0442\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c, \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043b\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043d\u0430\u0448\u0435\u043c\u0443 \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u043c\u0443 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044e.<\/p>\n<pre><code> curl http:\/\/localhost:8000\/ Hello world !%<\/code><\/pre>\n<p><strong>\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430<\/strong><\/p>\n<p>\u041d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c, \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043b\u0438 CrowdSec \u0447\u0438\u0442\u0430\u0435\u0442 \u0436\u0443\u0440\u043d\u0430\u043b\u044b.<\/p>\n<pre><code>docker-compose exec crowdsec cscli metrics  sudo docker-compose exec crowdsec cscli metrics INFO[25-02-2021 03:38:50 PM] Buckets Metrics:                              +--------------------------------------+---------------+-----------+--------------+--------+---------+ |                BUCKET                | CURRENT COUNT | OVERFLOWS | INSTANCIATED | POURED | EXPIRED | +--------------------------------------+---------------+-----------+--------------+--------+---------+ | crowdsecurity\/http-crawl-non_statics | -             | -         |            2 |      2 |       2 | +--------------------------------------+---------------+-----------+--------------+--------+---------+ INFO[25-02-2021 03:38:50 PM] Acquisition Metrics:                          +-----------------------------------+------------+--------------+----------------+------------------------+ |              SOURCE               | LINES READ | LINES PARSED | LINES UNPARSED | LINES POURED TO BUCKET | +-----------------------------------+------------+--------------+----------------+------------------------+ | \/var\/log\/nginx\/example.access.log |          2 |            2 | -              |                      2 | +-----------------------------------+------------+--------------+----------------+------------------------+ INFO[25-02-2021 03:38:50 PM] Parser Metrics:                               +--------------------------------+------+--------+----------+ |            PARSERS             | HITS | PARSED | UNPARSED | +--------------------------------+------+--------+----------+ | child-crowdsecurity\/http-logs  |    6 |      2 |        4 | | child-crowdsecurity\/nginx-logs |    2 |      2 | -        | | crowdsecurity\/dateparse-enrich |    2 |      2 | -        | | crowdsecurity\/geoip-enrich     |    2 |      2 | -        | | crowdsecurity\/http-logs        |    2 | -      |        2 | | crowdsecurity\/nginx-logs       |    2 |      2 | -        | | crowdsecurity\/non-syslog       |    2 |      2 | -        | +--------------------------------+------+--------+----------+ INFO[25-02-2021 03:38:50 PM] Local Api Metrics:                            +--------------------+--------+------+ |       ROUTE        | METHOD | HITS | +--------------------+--------+------+ | \/v1\/watchers\/login | POST   |    2 | +--------------------+--------+------+<\/code><\/pre>\n<p>\u0427\u0442\u043e \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u043e \u0438 \u0447\u0442\u043e \u0437\u0434\u0435\u0441\u044c \u043a \u0447\u0435\u043c\u0443?\u00a0<\/p>\n<p>\u041a\u043e\u043c\u0430\u043d\u0434\u0430 cscli metrics \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u0442 <a href=\"https:\/\/prometheus.io\/docs\/introduction\/overview\/\"><u>\u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u0438\u0437 Prometheus<\/u><\/a>, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0435 CrowdSec \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e, \u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0438\u0445 \u0432 \u0442\u0430\u043a\u043e\u043c \u043d\u0435\u043e\u0431\u044b\u0447\u043d\u043e\u043c \u0432\u0438\u0434\u0435:<\/p>\n<ul>\n<li>\n<p>Acquisition metrics (\u00ab\u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u0438\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u044f\u00bb) \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442 \u043d\u0430\u043c, \u0447\u0442\u043e \u043d\u0430\u0448\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u044e\u0442 \u0436\u0443\u0440\u043d\u0430\u043b\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0447\u0438\u0442\u0430\u044e\u0442\u0441\u044f (LINES READ), \u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u044e\u0442\u0441\u044f (LINES PARSED) \u0438 \u0434\u0430\u0436\u0435 \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0441 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u043c\u0438 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f\u043c\u0438 (LINES POURED TO BUCKET),<\/p>\n<\/li>\n<li>\n<p>Buckets metrics (\u00ab\u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u043e\u0432\u00bb) \u0438 parser metrics (\u00ab\u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430\u00bb) \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442 \u043d\u0430\u043c, \u043a\u0430\u043a\u0438\u0435 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u044b \u0438 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u044e\u0442\u0441\u044f.<\/p>\n<\/li>\n<\/ul>\n<p><strong>\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 CrowdSec<\/strong><\/p>\n<p>\u041a\u043e\u043c\u0430\u043d\u0434\u0430 cscli hub list \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u043a\u0430\u043a\u0438\u0435 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u044b \u0438 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0438 \u0440\u0430\u0437\u0432\u0451\u0440\u043d\u0443\u0442\u044b.<\/p>\n<pre><code>sudo docker-compose exec crowdsec cscli hub list INFO[25-02-2021 03:46:41 PM] Loaded 14 collecs, 19 parsers, 23 scenarios, 3 post-overflow parsers  INFO[25-02-2021 03:46:41 PM] unmanaged items : 20 local, 0 tainted         INFO[25-02-2021 03:46:41 PM] PARSERS:                                      -------------------------------------------------------------------------------------------------------------  NAME                             STATUS   VERSION  LOCAL PATH                                              -------------------------------------------------------------------------------------------------------------  crowdsecurity\/sshd-logs         \u2714  enabled  0.1      \/etc\/crowdsec\/parsers\/s01-parse\/sshd-logs.yaml           crowdsecurity\/syslog-logs       \u2714  enabled  0.1      \/etc\/crowdsec\/parsers\/s00-raw\/syslog-logs.yaml           crowdsecurity\/dateparse-enrich  \u2714  enabled  0.1      \/etc\/crowdsec\/parsers\/s02-enrich\/dateparse-enrich.yaml   crowdsecurity\/geoip-enrich      \u2714  enabled  0.2      \/etc\/crowdsec\/parsers\/s02-enrich\/geoip-enrich.yaml       crowdsecurity\/nginx-logs        \u2714  enabled  0.2      \/etc\/crowdsec\/parsers\/s01-parse\/nginx-logs.yaml          crowdsecurity\/http-logs         \u2714  enabled  0.4      \/etc\/crowdsec\/parsers\/s02-enrich\/http-logs.yaml         ------------------------------------------------------------------------------------------------------------- INFO[25-02-2021 03:46:41 PM] SCENARIOS:                                    --------------------------------------------------------------------------------------------------------------------------  NAME                                        STATUS   VERSION  LOCAL PATH                                                --------------------------------------------------------------------------------------------------------------------------  ltsich\/http-w00tw00t                       \u2714  enabled  0.1      \/etc\/crowdsec\/scenarios\/http-w00tw00t.yaml                 crowdsecurity\/http-crawl-non_statics       \u2714  enabled  0.2      \/etc\/crowdsec\/scenarios\/http-crawl-non_statics.yaml        crowdsecurity\/http-probing      <\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\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-411357","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/411357","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=411357"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/411357\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=411357"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=411357"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=411357"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}