Sign inSign up

introzen/pfsense-auto-nat

By introzen

•Updated about 1 year ago
Archived

Automatically manages pfSense NAT rules (port forwarding)

Image
Networking
0

322

introzen/pfsense-auto-nat repository overview

⁠pfSense AutoNAT

Docker Pulls Discord GitHub Repo stars

pfSense AutoNAT monitors your docker containers and automatically manages pfSense NAT rules (port forwarding) via REST API.

⁠Requirements

⁠Notes

  • pfSense automatically removes unofficial packages during update, so reinstallation of jaredhendrickson13/pfsense-api⁠ is required after each system update.
  • Currently this image only supports Basic Authentication.

⁠Getting started

The image works by attaching to /var/run/docker.sock and listens for start/stop events of any docker containers. If it finds a container with the correct label, it will reach out to the designated pfSense using the API and open/close the port(s) accordingly.

⁠Docker compose

services:
  pfsense-auto-nat:
    container_name: pfsense-auto-nat
    image: introzen/pfsense-auto-nat
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
    environment:
      - PFSENSE_HOST=192.168.1.1 #Your pfSense IP Address
      - PFSENSE_PORT=1337 #optional (Default: 80)
      - PFSENSE_PROTO=https #optional (Default: https)
      - PFSENSE_USER=admin #Your pfSense username
      - PFSENSE_PASS=1234 #Your pfSense password
      - DOCKER_HOST_IP=192.168.1.100 #Your Docker Host IP
      - RULE_PREFIX="MyNAT" #optional (Default: Docker AutoNAT)
      - SUPRESS_SSL_WARNINGS=true #optional (Default: false)
    restart: unless-stopped

Add the pfsense.port label to your containers that should prompt the AutoNAT to open a port in your pfSense firewall.

services:
  nginx:
    image: lscr.io/linuxserver/nginx:latest
    ports:
      - 80:80
      - 443:443
    labels:
      - pfsense.port=80/tcp,443/tcp

Tag summary

Content type

Image

Digest

sha256:f701844d6…

Size

45.7 MB

Last updated

about 1 year ago

docker pull introzen/pfsense-auto-nat