-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TCP_OPEN restrict to certain interfaces #100
Comments
The curly brackets are not correct
I would not use |
Thank you. I tried NAT_FORWARD_TCP last weekend and yesterday, but somehow I am mentally stuck. The machine is a single machine in a data center. It has four interfaces: lo, eth0, wg0, wg1 My problem: What is INTERNAL_NET in this case? I tried 127.0.0.1and I had the impression, that this net is special. Is 127.0.0.1 a good choice? Do I have to set:
If I want to allow access from the external interface wg0 to the port 22 of the internal net? What exactly is a local port? I have some services listening to all interfaces like ssh. It is listening on 0.0.0.0:22 |
Given that info, try something like:
(Optional) Only if Wireguard traffic needs to go outbound, outside of tunnel:
Then to allow inbound Wireguard to wg0 (ex. port 51820)
This should allow you to use an external Wireguard peer to connect to your Wireguard instance and SSH over the tunnel. Try little steps at a time. |
Hi, I experimented a bit more and did not achieve the level of separation I want. Basically ports are reachable on the internal_net, where I do not expect them. If I scan from my laptop the internal address 10.0.1.1 interface wg1 of the server I see:
I have currently this configured wrt to wg1 and ssh:
I did an iptables-save -f /tmp/xx of the iptables config and:
I thought port 22 would be open on ens3 and wg0, but not on wg1. |
Hi,
I would like to have several internal nets wg0 10.0.0.0/24 ,wg1 10.0.1.0/24 which are isolated from each other and have different configuration wrt to NAT.
I am using the debian package arno-iptables-firewall 2.1.1-2
Both wg0/wg1 nets are created by wireguard
My debian managed config is:
cat conf.d/00debconf.conf | grep -v ^#
EXT_IF="ens3"
EXT_IF_DHCP_IP=1
OPEN_TCP="{ens3,wg0}#22 {ens3,wg0}#53 ens3#8443 ens3#8444:8449"
OPEN_UDP="{ens3,wg0}#53 ens3#443 ens3#444 ens3#8443"
INT_IF="wg0 wg1"
NAT=1
INTERNAL_NET="10.0.0.0/24 10.0.1.0/24"
NAT_INTERNAL_NET="10.0.0.0/24"
HOST_OPEN_UDP="10.0.0.1
53"53"HOST_OPEN_TCP="10.0.0.1
OPEN_ICMP=0
This does not seem to work:
a) I do not want port 22 to be open on wg1
But nmap reports:
`
nmap 10.0.1.1
Starting Nmap 7.93 ( https://nmap.org ) at 2024-02-28 10:44 CET
Nmap scan report for 10.0.1.1
Host is up (0.025s latency).
Not shown: 998 closed tcp ports (reset)
PORT STATE SERVICE
22/tcp open ssh
8443/tcp open https-alt
`
/usr/sbin/arno-iptables-firewall status
shows:
'''
Chain EXT_INPUT_CHAIN (2 references)
pkts bytes target prot opt in out source destination
0 0 LOG tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:0 limit: avg 6/hour burst 1 LOG flags 0 level 7 prefix "AIF:Port 0 OS
fingerprint: "
0 0 LOG udp -- * * 0.0.0.0/0 0.0.0.0/0 udp dpt:0 limit: avg 6/hour burst 1 LOG flags 0 level 7 prefix "AIF:Port 0 OS
fingerprint: "
0 0 POST_INPUT_DROP_CHAIN tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:0
0 0 POST_INPUT_DROP_CHAIN udp -- * * 0.0.0.0/0 0.0.0.0/0 udp dpt:0
0 0 LOG tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp spt:0 limit: avg 6/hour burst 5 LOG flags 0 level 7 prefix "AIF:TCP source
port 0: "
0 0 LOG udp -- * * 0.0.0.0/0 0.0.0.0/0 udp spt:0 limit: avg 6/hour burst 5 LOG flags 0 level 7 prefix "AIF:UDP source
port 0: "
0 0 POST_INPUT_DROP_CHAIN tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp spt:0
0 0 POST_INPUT_DROP_CHAIN udp -- * * 0.0.0.0/0 0.0.0.0/0 udp spt:0
0 0 ACCEPT udp -- * * 0.0.0.0/0 0.0.0.0/0 udp spt:67 dpt:68
0 0 ACCEPT tcp -- * * 10.0.0.1 0.0.0.0/0 tcp dpt:53
0 0 ACCEPT udp -- * * 10.0.0.1 0.0.0.0/0 udp dpt:53
0 0 ACCEPT tcp -- {ens3 * 0.0.0.0/0 0.0.0.0/0 tcp dpt:22
0 0 ACCEPT tcp -- wg0} * 0.0.0.0/0 0.0.0.0/0 tcp dpt:22
0 0 ACCEPT tcp -- {ens3 * 0.0.0.0/0 0.0.0.0/0 tcp dpt:53
0 0 ACCEPT tcp -- wg0} * 0.0.0.0/0 0.0.0.0/0 tcp dpt:53
0 0 ACCEPT tcp -- ens3 * 0.0.0.0/0 0.0.0.0/0 tcp dpt:8443
0 0 ACCEPT tcp -- ens3 * 0.0.0.0/0 0.0.0.0/0 tcp dpts:8444:8449
0 0 ACCEPT udp -- {ens3 * 0.0.0.0/0 0.0.0.0/0 udp dpt:53
0 0 ACCEPT udp -- wg0} * 0.0.0.0/0 0.0.0.0/0 udp dpt:53
0 0 ACCEPT udp -- ens3 * 0.0.0.0/0 0.0.0.0/0 udp dpt:443
0 0 ACCEPT udp -- ens3 * 0.0.0.0/0 0.0.0.0/0 udp dpt:444
0 0 ACCEPT udp -- ens3 * 0.0.0.0/0 0.0.0.0/0 udp dpt:8443
0 0 POST_INPUT_DROP_CHAIN tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp flags:!0x17/0x02
0 0 EXT_BROADCAST_CHAIN all -- * * 0.0.0.0/0 255.255.255.255
0 0 EXT_BROADCAST_CHAIN all -- * * 0.0.0.0/0 46.38.251.255
0 0 EXT_MULTICAST_CHAIN all -- * * 0.0.0.0/0 224.0.0.0/4
0 0 LOG 2 -- * * 0.0.0.0/0 0.0.0.0/0 limit: avg 1/min burst 5 LOG flags 0 level 7 prefix "AIF:IGMP packet: "
9 464 POST_INPUT_CHAIN all -- * * 0.0.0.0/0 0.0.0.0/0
'''
Which looks quite wrong with the curly brackets. I see no error from the tool reported.
If I change the config to
OPEN_TCP="ens3,wg0#22 ens3,wg0#53 ens3#8443 ens3#8444:8449"
then nmap still reports port 22 open on the wg1 network
The text was updated successfully, but these errors were encountered: