flaviostutz / freepbx

FreePBX container (Asterisk 16; OpenPBX 15 with Backup and IVR modules installed)
MIT License
58 stars 46 forks source link

Can't initialize iptables table 'filter' #27

Open backupandforkacc opened 2 years ago

backupandforkacc commented 2 years ago

I was using the following docker-compose.yaml:

version: '3.3'
services:
  freepbx:
    image: flaviostutz/freepbx
    ports:
      - 8092:80
      - 5060:5060/udp
      - 5160:5160/udp
      - 3306:3306
      - 18000-18100:18000-18100/udp
    environment:
      - ADMIN_PASSWORD=admin123
    volumes:
      - backup:/backup
      - recordings:/var/spool/asterisk/monitor

volumes:
  backup:
  recordings:

I have the following logs:

~/Downloads/freepbx$ sudo docker-compose logs -t -f --tail 10
Attaching to freepbx_freepbx_1
freepbx_1  | 2022-01-03T14:15:45.791808263Z iptables v1.8.2 (legacy): can't initialize iptables table `filter': Permission denied (you must be root)
freepbx_1  | 2022-01-03T14:15:45.791959813Z Perhaps iptables or your kernel needs to be upgraded.
freepbx_1  | 2022-01-03T14:15:45.795578022Z For enabling fail2ban you have to run this container with 'privileged: true'
freepbx_freepbx_1 exited with code 1

I have not configured the network in any way or applied netplan.

backupandforkacc commented 2 years ago

Changed the code a bit, seems working now:

version: '3.3'
services:
  freepbx:
    image: flaviostutz/freepbx
    ports:
      - 8092:80
      - 5060:5060/udp
      - 5160:5160/udp
      - 3306:3306
      - 18000-18100:18000-18100/udp
    environment:
      - ADMIN_PASSWORD=admin123
    volumes:
      - backup:/backup
      - recordings:/var/spool/asterisk/monitor
    cap_add:
      - NET_ADMIN
volumes:
  backup:
  recordings:
flaviostutz commented 2 years ago

Oh, great!

Sent from my iPhone

On 3 Jan 2022, at 15:26, Serge @.***> wrote:

 Changed the code a bit, seems working now:

version: '3.3' services: freepbx: image: flaviostutz/freepbx ports:

  • 8092:80
  • 5060:5060/udp
  • 5160:5160/udp
  • 3306:3306
  • 18000-18100:18000-18100/udp environment:
  • ADMIN_PASSWORD=admin123 volumes:
  • backup:/backup
  • recordings:/var/spool/asterisk/monitor cap_add:
  • NET_ADMIN volumes: backup: recordings: — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.
negesti commented 8 months ago

disabling fail2bin in compose file works, looks like it is default tru

environment: 
  - FAIL2BAN_ENABLE=false
flaviostutz commented 8 months ago

You need to run the container with privileged true so it has access to ip tables kernel operations from the hosting OS.