LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 07-28-2020, 01:40 AM   #16
ferrari
LQ Guru
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 5,805

Rep: Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140

That looks as expected to me.

NAT rules?
Code:
sudo iptables -t nat -L -n -v
 
Old 07-28-2020, 01:48 AM   #17
THawk254
LQ Newbie
 
Registered: Dec 2016
Location: Manila, Philippines
Distribution: Ubuntu
Posts: 16

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by ferrari View Post
That looks as expected to me.

NAT rules?
Code:
sudo iptables -t nat -L -n -v
Results below.

Quote:
Chain PREROUTING (policy ACCEPT 32484 packets, 4742K bytes)
pkts bytes target prot opt in out source destination
32486 4742K PREROUTING_direct all -- * * 0.0.0.0/0 0.0.0.0/0
32486 4742K PREROUTING_ZONES all -- * * 0.0.0.0/0 0.0.0.0/0

Chain INPUT (policy ACCEPT 1304 packets, 78805 bytes)
pkts bytes target prot opt in out source destination

Chain OUTPUT (policy ACCEPT 1246 packets, 97226 bytes)
pkts bytes target prot opt in out source destination
1246 97226 OUTPUT_direct all -- * * 0.0.0.0/0 0.0.0.0/0

Chain POSTROUTING (policy ACCEPT 28 packets, 23386 bytes)
pkts bytes target prot opt in out source destination
0 0 RETURN all -- * * 192.168.122.0/24 224.0.0.0/24
0 0 RETURN all -- * * 192.168.122.0/24 255.255.255.255
0 0 MASQUERADE tcp -- * * 192.168.122.0/24 !192.168.122.0/24 masq ports: 1024-65535
0 0 MASQUERADE udp -- * * 192.168.122.0/24 !192.168.122.0/24 masq ports: 1024-65535
0 0 MASQUERADE all -- * * 192.168.122.0/24 !192.168.122.0/24
11731 1629K POSTROUTING_direct all -- * * 0.0.0.0/0 0.0.0.0/0
28 23386 POSTROUTING_ZONES all -- * * 0.0.0.0/0 0.0.0.0/0

Chain OUTPUT_direct (1 references)
pkts bytes target prot opt in out source destination

Chain POSTROUTING_ZONES (1 references)
pkts bytes target prot opt in out source destination
28 23386 POST_internal all -- * * 0.0.0.0/0 192.168.20.0/24 [goto]
0 0 POST_trusted all -- * * 0.0.0.0/0 0.0.0.0/0 [goto] match-set sshOK dst
0 0 POST_public all -- * enp2s0 0.0.0.0/0 0.0.0.0/0 [goto]
0 0 POST_internal all -- * enp3s0 0.0.0.0/0 0.0.0.0/0 [goto]
0 0 POST_trusted all -- * tun0 0.0.0.0/0 0.0.0.0/0 [goto]
0 0 POST_public all -- * + 0.0.0.0/0 0.0.0.0/0 [goto]

Chain POSTROUTING_direct (1 references)
pkts bytes target prot opt in out source destination
11703 1605K MASQUERADE all -- * enp2s0 0.0.0.0/0 0.0.0.0/0

Chain POST_internal (2 references)
pkts bytes target prot opt in out source destination
28 23386 POST_internal_log all -- * * 0.0.0.0/0 0.0.0.0/0
28 23386 POST_internal_deny all -- * * 0.0.0.0/0 0.0.0.0/0
28 23386 POST_internal_allow all -- * * 0.0.0.0/0 0.0.0.0/0

Chain POST_internal_allow (1 references)
pkts bytes target prot opt in out source destination

Chain POST_internal_deny (1 references)
pkts bytes target prot opt in out source destination

Chain POST_internal_log (1 references)
pkts bytes target prot opt in out source destination

Chain POST_public (2 references)
pkts bytes target prot opt in out source destination
0 0 POST_public_log all -- * * 0.0.0.0/0 0.0.0.0/0
0 0 POST_public_deny all -- * * 0.0.0.0/0 0.0.0.0/0
0 0 POST_public_allow all -- * * 0.0.0.0/0 0.0.0.0/0

Chain POST_public_allow (1 references)
pkts bytes target prot opt in out source destination
0 0 MASQUERADE all -- * !lo 0.0.0.0/0 0.0.0.0/0
0 0 MASQUERADE all -- * !lo 0.0.0.0/0 0.0.0.0/0

Chain POST_public_deny (1 references)
pkts bytes target prot opt in out source destination

Chain POST_public_log (1 references)
pkts bytes target prot opt in out source destination

Chain POST_trusted (2 references)
pkts bytes target prot opt in out source destination
0 0 POST_trusted_log all -- * * 0.0.0.0/0 0.0.0.0/0
0 0 POST_trusted_deny all -- * * 0.0.0.0/0 0.0.0.0/0
0 0 POST_trusted_allow all -- * * 0.0.0.0/0 0.0.0.0/0

Chain POST_trusted_allow (1 references)
pkts bytes target prot opt in out source destination

Chain POST_trusted_deny (1 references)
pkts bytes target prot opt in out source destination

Chain POST_trusted_log (1 references)
pkts bytes target prot opt in out source destination

Chain PREROUTING_ZONES (1 references)
pkts bytes target prot opt in out source destination
31225 4525K PRE_internal all -- * * 192.168.20.0/24 0.0.0.0/0 [goto]
0 0 PRE_trusted all -- * * 0.0.0.0/0 0.0.0.0/0 [goto] match-set sshOK src
775 117K PRE_public all -- enp2s0 * 0.0.0.0/0 0.0.0.0/0 [goto]
486 100K PRE_internal all -- enp3s0 * 0.0.0.0/0 0.0.0.0/0 [goto]
0 0 PRE_trusted all -- tun0 * 0.0.0.0/0 0.0.0.0/0 [goto]
0 0 PRE_public all -- + * 0.0.0.0/0 0.0.0.0/0 [goto]

Chain PREROUTING_direct (1 references)
pkts bytes target prot opt in out source destination

Chain PRE_internal (2 references)
pkts bytes target prot opt in out source destination
31711 4625K PRE_internal_log all -- * * 0.0.0.0/0 0.0.0.0/0
31711 4625K PRE_internal_deny all -- * * 0.0.0.0/0 0.0.0.0/0
31711 4625K PRE_internal_allow all -- * * 0.0.0.0/0 0.0.0.0/0

Chain PRE_internal_allow (1 references)
pkts bytes target prot opt in out source destination

Chain PRE_internal_deny (1 references)
pkts bytes target prot opt in out source destination

Chain PRE_internal_log (1 references)
pkts bytes target prot opt in out source destination

Chain PRE_public (2 references)
pkts bytes target prot opt in out source destination
775 117K PRE_public_log all -- * * 0.0.0.0/0 0.0.0.0/0
775 117K PRE_public_deny all -- * * 0.0.0.0/0 0.0.0.0/0
775 117K PRE_public_allow all -- * * 0.0.0.0/0 0.0.0.0/0

Chain PRE_public_allow (1 references)
pkts bytes target prot opt in out source destination

Chain PRE_public_deny (1 references)
pkts bytes target prot opt in out source destination

Chain PRE_public_log (1 references)
pkts bytes target prot opt in out source destination

Chain PRE_trusted (2 references)
pkts bytes target prot opt in out source destination
0 0 PRE_trusted_log all -- * * 0.0.0.0/0 0.0.0.0/0
0 0 PRE_trusted_deny all -- * * 0.0.0.0/0 0.0.0.0/0
0 0 PRE_trusted_allow all -- * * 0.0.0.0/0 0.0.0.0/0

Chain PRE_trusted_allow (1 references)
pkts bytes target prot opt in out source destination

Chain PRE_trusted_deny (1 references)
pkts bytes target prot opt in out source destination

Chain PRE_trusted_log (1 references)
pkts bytes target prot opt in out source destination
 
Old 07-28-2020, 03:04 AM   #18
ferrari
LQ Guru
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 5,805

Rep: Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140
I'm struggling to see where the openvpn-related packets are being dropped. This command will show any differences dynamically...
Code:
sudo watch -d iptables -vnL
As your rules are lengthy though it might only show the first pageful in the terminal.

Some other similar approaches (including sorting and filtering) to help identify rules being triggered by changes to packet counters....
https://unix.stackexchange.com/quest...pping-a-packet

Some careful observation when attempting to connect to the server should help you identify the issue. You may also want to ensure little/no other services are running to minimise other kinds of traffic hitting/leaving the server.
 
1 members found this post helpful.
Old 07-29-2020, 01:31 AM   #19
THawk254
LQ Newbie
 
Registered: Dec 2016
Location: Manila, Philippines
Distribution: Ubuntu
Posts: 16

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by ferrari View Post
I'm struggling to see where the openvpn-related packets are being dropped. This command will show any differences dynamically...
Code:
sudo watch -d iptables -vnL
As your rules are lengthy though it might only show the first pageful in the terminal.

Some other similar approaches (including sorting and filtering) to help identify rules being triggered by changes to packet counters....
https://unix.stackexchange.com/quest...pping-a-packet

Some careful observation when attempting to connect to the server should help you identify the issue. You may also want to ensure little/no other services are running to minimise other kinds of traffic hitting/leaving the server.
will I be able to save the results or will this be happening in real time?

On a semi-related note, how can I simplify my rules? Basically my setup is just a CentOS 7 box with 2 NICs (edge firewall) running squid and firewalld. Nothing special about it.
 
Old 07-29-2020, 02:08 AM   #20
ferrari
LQ Guru
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 5,805

Rep: Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140
Quote:
will I be able to save the results or will this be happening in real time?
You can use the approach described in the link to save two (or more) captures and then use 'diff' to show the difference between the files.

Quote:
On a semi-related note, how can I simplify my rules? Basically my setup is just a CentOS 7 box with 2 NICs (edge firewall) running squid and firewalld. Nothing special about it.
I did hint at a minimal iptables config (refer post #14 link) which just shows what is needed to allow OpenVPN (single interface config), but I'm sure you could tweak that as necessary for your situation. Once you have a working iptables config, it's not hard to config firewalld based on the required iptables rules.
 
1 members found this post helpful.
Old 07-29-2020, 02:32 AM   #21
THawk254
LQ Newbie
 
Registered: Dec 2016
Location: Manila, Philippines
Distribution: Ubuntu
Posts: 16

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by ferrari View Post
You can use the approach described in the link to save two (or more) captures and then use 'diff' to show the difference between the files.


I did hint at a minimal iptables config (refer post #14 link) which just shows what is needed to allow OpenVPN (single interface config), but I'm sure you could tweak that as necessary for your situation. Once you have a working iptables config, it's not hard to config firewalld based on the required iptables rules.
Read the link again and yes, I did see it. I'll have to scrounge up another CPU and ask my ISP for another public IP address to test on. I can establish the VPN link inside the LAN but hitting the public IP is a whole different ballgame. I'll be back...
 
Old 11-10-2020, 11:00 PM   #22
THawk254
LQ Newbie
 
Registered: Dec 2016
Location: Manila, Philippines
Distribution: Ubuntu
Posts: 16

Original Poster
Rep: Reputation: Disabled
Hi all, I know it's been awhile. Took our ISP more than a month to migrate our account to a corporate account which allowed more than one public IP address.

New settings as follows. I have migrated the firewall to iptables.

From the iptables output, the packets are hitting the interface and are being allowed to enter. But somehow something is getting messed up upon authentication..

result of iptables -nvL (includes the nat table):

Chain INPUT (policy ACCEPT 1228 packets, 226K bytes)
pkts bytes target prot opt in out source destination
2259 145K ACCEPT tcp -- * * 192.168.20.0/24 0.0.0.0/0 tcp dpt:22 state NEW,ESTABLISHED /* Allow ssh */
0 0 ACCEPT icmp -- * * 192.168.20.0/24 0.0.0.0/0 icmptype 8 /* Allow pings from the inside */
0 0 ACCEPT icmp -- enp4s0 * 0.0.0.0/0 0.0.0.0/0 icmptype 0
0 0 ACCEPT tcp -- * * 192.168.20.0/24 0.0.0.0/0 tcp dpt:3128 state NEW,ESTABLISHED /* Allow Squid */
4 200 ACCEPT all -- lo * 0.0.0.0/0 0.0.0.0/0 /* Allow everything from loopback */
0 0 ACCEPT all -- tun+ * 0.0.0.0/0 0.0.0.0/0 /* Trust the tunnel interfaces */
68 3856 ACCEPT udp -- * * 0.0.0.0/0 0.0.0.0/0 udp dpt:1194 /* Allow openvpn traffic */
199 23276 ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
0 0 DROP icmp -- enp4s0 * 0.0.0.0/0 0.0.0.0/0 icmptype 8 /* Drop pings from the outside */
351 62722 DROP all -- enp4s0 * 0.0.0.0/0 0.0.0.0/0

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
0 0 ACCEPT all -- tun+ * 0.0.0.0/0 0.0.0.0/0
6 405 ACCEPT all -- * enp4s0 0.0.0.0/0 0.0.0.0/0 state NEW
12 1286 ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED

Chain OUTPUT (policy ACCEPT 80 packets, 4128 bytes)
pkts bytes target prot opt in out source destination
1598 322K ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp spt:22 state ESTABLISHED
0 0 ACCEPT icmp -- * enp4s0 0.0.0.0/0 0.0.0.0/0 icmptype 8
51 3665 ACCEPT all -- * enp4s0 0.0.0.0/0 0.0.0.0/0 state NEW
12 1570 ACCEPT all -- * tun+ 0.0.0.0/0 0.0.0.0/0
Chain PREROUTING (policy ACCEPT 1564 packets, 333K bytes)
pkts bytes target prot opt in out source destination

Chain INPUT (policy ACCEPT 578 packets, 138K bytes)
pkts bytes target prot opt in out source destination

Chain OUTPUT (policy ACCEPT 42 packets, 2810 bytes)
pkts bytes target prot opt in out source destination

Chain POSTROUTING (policy ACCEPT 12 packets, 636 bytes)
pkts bytes target prot opt in out source destination
36 2579 MASQUERADE all -- * enp4s0 0.0.0.0/0 0.0.0.0/0

server.conf file:

port 1194
float
proto udp
dev tun
ca server/keys/ca.crt
cert server/keys/server.crt
key server/keys/server.key
dh server/keys/dh4096.pem
topology subnet
server 10.9.0.0 255.255.255.0
push "route 192.168.20.0 255.255.255.0"
keepalive 10 120
cipher AES-256-CBC
comp-lzo
user nobody
group nobody
persist-key
persist-tun
status openvpn-status.log
log-append openvpn.log
ifconfig-pool-persist ipp.txt
verb 4
explicit-exit-notify 1

client.conf:

client
dev tun
proto udp
remote ... 1194
float
resolv-retry infinite
nobind
user nobody
group nobody
persist-key
persist-tun
ca client/ca.crt
cert ...
key ...
cipher AES-256-CBC
comp-lzo
verb 4

openvpn.log snippet:

Wed Nov 11 12:55:35 2020 us=354766 210.4.125.138:38147 Local Options String (VER=V4): 'V4,dev-type tun,link-mtu 1558,tun-mtu 1500,proto UDPv4,comp-lzo,cipher AES-256-CBC,auth SHA1,keysize 256,key-method 2,tls-server'
Wed Nov 11 12:55:35 2020 us=354802 210.4.125.138:38147 Expected Remote Options String (VER=V4): 'V4,dev-type tun,link-mtu 1558,tun-mtu 1500,proto UDPv4,comp-lzo,cipher AES-256-CBC,auth SHA1,keysize 256,key-method 2,tls-client'
Wed Nov 11 12:55:35 2020 us=354883 210.4.125.138:38147 TLS: Initial packet from [AF_INET]210.4.125.138:38147, sid=697de220 8ce4f40e
Wed Nov 11 12:55:35 2020 us=355031 210.4.125.138:38147 TLS Error: reading acknowledgement record from packet
Wed Nov 11 12:55:37 2020 us=671070 210.4.125.138:38147 TLS Error: reading acknowledgement record from packet
Wed Nov 11 12:55:41 2020 us=144338 210.4.125.138:38147 TLS Error: reading acknowledgement record from packet
Wed Nov 11 12:55:49 2020 us=148177 210.4.125.138:38147 TLS Error: reading acknowledgement record from packet
Wed Nov 11 12:56:05 2020 us=922602 210.4.125.138:38147 TLS Error: reading acknowledgement record from packet
Wed Nov 11 12:56:34 2020 us=641114 MULTI: multi_create_instance called
Wed Nov 11 12:56:34 2020 us=641301 192.168.20.151:59344 Re-using SSL/TLS context
Wed Nov 11 12:56:34 2020 us=641366 192.168.20.151:59344 LZO compression initializing
Wed Nov 11 12:56:34 2020 us=641483 192.168.20.151:59344 Control Channel MTU parms [ L:1622 D:1212 EF:38 EB:0 ET:0 EL:3 ]
Wed Nov 11 12:56:34 2020 us=641528 192.168.20.151:59344 Data Channel MTU parms [ L:1622 D:1450 EF:122 EB:406 ET:0 EL:3 ]
Wed Nov 11 12:56:34 2020 us=641608 192.168.20.151:59344 Local Options String (VER=V4): 'V4,dev-type tun,link-mtu 1558,tun-mtu 1500,proto UDPv4,comp-lzo,cipher AES-256-CBC,auth SHA1,keysize 256,key-method 2,tls-server'
Wed Nov 11 12:56:34 2020 us=641645 192.168.20.151:59344 Expected Remote Options String (VER=V4): 'V4,dev-type tun,link-mtu 1558,tun-mtu 1500,proto UDPv4,comp-lzo,cipher AES-256-CBC,auth SHA1,keysize 256,key-method 2,tls-client'
Wed Nov 11 12:56:34 2020 us=641755 192.168.20.151:59344 TLS: Initial packet from [AF_INET]192.168.20.151:59344, sid=77be5316 73e82d0a
Wed Nov 11 12:56:35 2020 us=867464 210.4.125.138:38147 TLS Error: TLS key negotiation failed to occur within 60 seconds (check your network connectivity)
Wed Nov 11 12:56:35 2020 us=867536 210.4.125.138:38147 TLS Error: TLS handshake failed
Wed Nov 11 12:56:35 2020 us=867652 210.4.125.138:38147 SIGUSR1[soft,tls-error] received, client-instance restarting
 
Old 11-10-2020, 11:38 PM   #23
ferrari
LQ Guru
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 5,805

Rep: Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140
The TLS error caught my attention...
Code:
TLS Error: reading acknowledgement record from packet
See if this advice helps...
http://www.f15ijp.com/2010/08/openvp...d-from-packet/
 
Old 11-10-2020, 11:41 PM   #24
THawk254
LQ Newbie
 
Registered: Dec 2016
Location: Manila, Philippines
Distribution: Ubuntu
Posts: 16

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by ferrari View Post
The TLS error caught my attention...
Code:
TLS Error: reading acknowledgement record from packet
See if this advice helps...
http://www.f15ijp.com/2010/08/openvp...d-from-packet/
the key is indeed present but I don't reference it in the server and client config files (i.e. it's physically there but not part of the config files). Does it matter -- i.e. if I'm not using it for simplicity of the config should I just delete it?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Unable to connect to OpenVPN server on current. Also, unable to build NetworkManager-openvpn The_Dark_Passenger Slackware 2 07-19-2019 05:51 PM
OpenVPN assigning public & static IPs to pcs/devices behind an OpenVPN client dgonzalezh Linux - Networking 6 07-18-2010 09:50 AM
Able to connect via SSH but not able to connect via web port 80 Orange Sunshine Linux - Server 9 04-03-2010 07:11 PM
OpenVPN client has not default gateway when connect to OpenVPN server sailershen Linux - Security 3 03-04-2010 02:20 AM
Not able to connect client with openvpn pawan_lal Linux - Server 1 12-08-2009 04:39 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 12:17 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration