Fail 2 금지 발견 시 IP를 금지하지 않음

Fail 2 금지 발견 시 IP를 금지하지 않음

다른 서버에서 내 애플리케이션을 테스트할 때 fail2ban다음 로그가 표시됩니다.

2021-08-01 18:48:37,692 fail2ban.filter         [1]: INFO    [nginx] Found 51.195.221.70 - 2021-08-01 18:48:37
2021-08-01 18:48:37,897 fail2ban.filter         [1]: INFO    [nginx] Found 51.195.221.70 - 2021-08-01 18:48:37
2021-08-01 18:48:38,496 fail2ban.filter         [1]: INFO    [nginx] Found 51.195.221.70 - 2021-08-01 18:48:38
2021-08-01 18:48:38,671 fail2ban.filter         [1]: INFO    [nginx] Found 51.195.221.70 - 2021-08-01 18:48:38
2021-08-01 18:48:38,860 fail2ban.filter         [1]: INFO    [nginx] Found 51.195.221.70 - 2021-08-01 18:48:38
2021-08-01 18:48:38,976 fail2ban.actions        [1]: NOTICE  [nginx] Ban 51.195.221.70
2021-08-01 18:48:39,234 fail2ban.filter         [1]: INFO    [nginx] Found 51.195.221.70 - 2021-08-01 18:48:39
[SNIP]
2021-08-01 18:48:41,686 fail2ban.filter         [1]: INFO    [nginx] Found 51.195.221.70 - 2021-08-01 18:48:41
2021-08-01 18:48:41,872 fail2ban.filter         [1]: INFO    [nginx] Found 51.195.221.70 - 2021-08-01 18:48:41
2021-08-01 18:48:41,897 fail2ban.actions        [1]: NOTICE  [nginx] 51.195.221.70 already banned

요청이 발견되어 금지된 경우에도 계속해서 요청이 이어질 수 있습니다. 내 Docker 컨테이너는 다음과 같습니다.

 fail2ban:
    image: 'crazymax/fail2ban:latest'
    restart: 'always'
    network_mode: 'host'
    cap_add:
      - 'NET_ADMIN'
      - 'NET_RAW'
    volumes:
      - 'nginx-log:/var/log:ro'
      - 'fail2ban-data:/data'
    env_file:
      - './fail2ban.env'

내 구성은 다음과 같습니다

Jail.d/nginx.conf

[nginx]
enabled = true
logpath = /var/log/access.log
port = http,https

filter.d/nginx.conf

[Definition]
failregex = ^<HOST> \- \S+ \[\] \"(GET|POST|HEAD) .+\" 419 .+$
ignoreregex =

도움을 주시면 감사하겠습니다. IP 테이블을 구성해야 합니까?

답변1

https://github.com/crazy-max/docker-fail2ban/blob/master/examples/jails/traefik/jail.d/traefik.conf

이 작업을 수행하려면 chain = DOCKER-USER내 항목을 추가해야 한다는 것을 알았습니다 .jail.d/nginx.conf

관련 정보