[SOLVED] -- See update below.
I installed outline-server (link) on my server and unfortunately FirewallD drops all packets coming from outline-client.
My System:
Ubuntu 18.04 x64
Linux x 4.15.0-20-generic #21-Ubuntu SMP Tue Apr 24 06:16:15 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
FirewallD Version :0.4.4.5
Docker Version: Docker version18.05.0-ce, build f150324
FirewallD rules:
root@x:~# firewall-cmd --get-active-zones
public
interfaces: ens3 docker0
root@x:~# firewall-cmd --list-ports
{outline_server_port}/tcp {outline_server_port}/udp
The answer on this link hasn't help either.
Outline-Manager works fine for example: I can create keys and it connects successfully but Outline Client gives me the following error:
A networking error occurred. If this happens again, please submit feedback.
As soon as I stop FirewallD using the following command:
systemctl stop firewalld.service
outline-client works fine, and when I start FirewallD, it doesn't work again.
The following is from FirewallD status
root@x:~# systemctl status firewalld.service
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2018-05-15 23:37:31 CEST; 8s ago
Docs: man:firewalld(1)
Main PID: 2479 (firewalld)
Tasks: 2 (limit: 1113)
CGroup: /system.slice/firewalld.service
└─2479 /usr/bin/python3 -Es /usr/sbin/firewalld --nofork --nopid
May 15 23:37:31 x systemd[1]: Starting firewalld - dynamic firewall daemon...
May 15 23:37:31 x systemd[1]: Started firewalld - dynamic firewall daemon.
May 15 23:37:32 x firewalld[2479]: WARNING: COMMAND_FAILED: '/sbin/iptables -w2 -t filter -n -L DOCKER-USER' failed: iptables: No chain/target/match by that name.
May 15 23:37:32 x firewalld[2479]: WARNING: COMMAND_FAILED: '/sbin/iptables -w2 -t filter -C DOCKER-USER -j RETURN' failed: iptables: Bad rule (does a matching rule exist in that chain?).
May 15 23:37:32 x firewalld[2479]: WARNING: COMMAND_FAILED: '/sbin/iptables -w2 -t filter -C FORWARD -j DOCKER-USER' failed: iptables: No chain/target/match by that name.
I've enabled
- Masquerading on FirewallD too (
firewall-cmd --add-masquerade) - And also enabled ipv4 packet forwarding (
vim /etc/sysctl.conf&net.ipv4.ip_forward=1)
Now my question is: How can I configure FirewallD to allow outline-client packets?
Thanks a lot.
Outline uses docker.
UPDATE [2018.05.16]:
The problem resides in the unique port that outline creates in docker container for each new key AKA client, so to fix the problem, do the following:
run the following command (thanks a lot @abe)
ss -tlp
now, all ss-servers with their related port will be shown, for example mine looks like the following:
root@dockerTest:~# ss -tlp
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 0.0.0.0:12615 0.0.0.0:* users:(("ss-server",pid=1162,fd=5))
LISTEN 0 128 127.0.0.53%lo:domain 0.0.0.0:* users:(("systemd-resolve",pid=617,fd=13))
LISTEN 0 128 0.0.0.0:ssh 0.0.0.0:* users:(("sshd",pid=824,fd=3))
LISTEN 0 128 [::]:ssh [::]:* users:(("sshd",pid=824,fd=4))
LISTEN 0 128 *:47515 *:* users:(("node",pid=1103,fd=12))
now, as we can see from the output, ss-server uses the port "12615", we should allow this port in FirewallD. to do this, run the following commands:
firewall-cmd --add-port=12615/tcp
firewall-cmd --add-port=12615/udp
Check outline-client, it should connect.
if everything works as expected, run the following commands, to make changes permanent
firewall-cmd --add-port=12615/tcp --permanent
firewall-cmd --add-port=12615/udp --permanent
Thanks a lot @abe, I greatly appreciate your help.