Score:0

OpenVPN+iptables: unable to connect to ssh

bq flag

I have a bastion server running openvpn on port 7777. Each openvpn client has a static ip fixed for him. I'm using iptables to define which routes a client can go.

My server also running ssh on port 22.

my first client is unique client because he has access to everywhere. His fixed ip address is 10.8.0.1. This client also can connect the SSH, using the internal machine ip, to gain ssh control on the machine.

So, I tried this rule set:

#!/bin/sh
# flush all
iptables -F
iptables -X

# Setting default filter policy
iptables -P INPUT DROP
iptables -P OUTPUT DROP
iptables -P FORWARD DROP

# Allow unlimited traffic on loopback
iptables -A INPUT -i lo -j ACCEPT
iptables -A OUTPUT -o lo -j ACCEPT

#allow ssh
iptables -A INPUT -p tcp --dport 22 -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT
iptables -A OUTPUT -p tcp --sport 22 -m conntrack --ctstate ESTABLISHED -j ACCEPT

#allow openvpn
iptables -A INPUT -p udp --dport 7777 -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT
iptables -A OUTPUT -p udp --sport 7777 -m conntrack --ctstate ESTABLISHED -j ACCEPT

# Allow everywhere for client `10.8.0.1`
iptables -A FORWARD --source 10.8.0.1 -j ACCEPT
iptables -A FORWARD --destination 10.8.0.1 -j ACCEPT

The problem I'm facing is that 10.8.0.1 do everything on the network, except doing new SSH connections to the bastion machine. Existing ssh connection remain without problems, even after setup those rules.

Why?

Kamil J avatar
it flag
OpenVPN has "own" routing table. What about the setting there?
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.