linuxserver / fail2ban-confs

These confs are pulled into our fail2ban image: https://github.com/linuxserver/docker-fail2ban
GNU General Public License v3.0
38 stars 12 forks source link

Can't find fail2ban.sock #19

Closed ohshitgorillas closed 1 year ago

ohshitgorillas commented 1 year ago

linuxserver.io

I'm using this fail2ban Prometheus exporter which relies on the fail2ban socket, but the exporter log is filled with errors about not being able to find the socket file.

Note that the author of the exporter recommends mounting the folder, not the socket file directly.

Ubuntu Server 20.04

docker-compose.yaml:

version: "3.9"
networks:
  metrix:
    external: true

services:
  fail2ban:
    image: lscr.io/linuxserver/fail2ban:latest
    container_name: fail2ban
    restart: unless-stopped
    environment:
      - TZ=America/Los_Angeles
    volumes:
      - ./socket:/var/run/fail2ban
      - ./config:/config
      - /var/log:/var/log:ro
      - /srv/emby/config/logs:/remotelogs/emby:ro
      - /srv/bittorrent/nginx/log:/remotelogs/nginx:ro
      - /srv/plex/config/Library/Application\ Support/Plex\ Media\ Server/Logs:/remotelogs/plex:ro
    cap_add:
      - NET_ADMIN
    network_mode: "host"

  f2b-exporter:
    image: registry.gitlab.com/hectorjsmith/fail2ban-prometheus-exporter:latest
    container_name: f2b-exporter
    volumes:
      - ./socket:/var/run/fail2ban:ro
    ports:
      - 9191:9191
    depends_on:
      - fail2ban
    networks:
      - metrix

I've tried to use a defined volume as well, but honestly, it doesn't seem that the fail2ban.sock file is located in /var/run/fail2ban at all in this image. If I run 'docker-compose exec fail2ban ls /var/run/fail2ban', I get an empty output.

Where is the fail2ban.sock file located in this image?

Thanks, team linuxserver.io

ohshitgorillas commented 1 year ago

It turns out the issue was that my fail2ban server was constantly restarting due to a syntax error in one of the .local files, and therefore never generating the socket file. Now that the error is fixed, everything is good. My apologies.