Restrict access by IP address
vitobotta opened this issue · 7 comments
HI, how can I restrict access to a container's port to a specific IP only? For example I want to be able to access Nginx Proxy Manager only from my home IP. Thanks!
ufw route allow proto tcp from HOME_IP_HERE to any port XX
ufw route allow from <source> to <container> port <container_port> proto tcp
# example
ufw route allow from 192.168.3.0/24 to 172.17.0.4 port 8080 proto tcpI changed approach actually. For Nginx Proxy Manager and Portainer I am now using Cloudflare Zero Trust Access, and have changed the script slightly to always allow traffic from Cloudflare IP ranges, see https://bin.botta.me/Z0ZC7b.sh
I haven't whitelisted anything at all with ufw-docker. Do you see any issues with this approach?
@vitobotta hey, the link has expired
Oops. This one doesn't have an expiration https://bin.botta.me/am9mxb.sh
@vitobotta hey, the link has expired
ufw route allow from <source> to <container> port <container_port> proto tcp # example ufw route allow from 192.168.3.0/24 to 172.17.0.4 port 8080 proto tcp
do i can use this ?
ufw route allow from 31.184.139.26 to sg-db-1 port 3306 proto tcp