Hi guys,
I am not sure if this bellong here or in the Installation and Maintenance section of the forum...
I have installed security/openvpn in the aim of allowing ssh access from outside the office ONLY via OpenVPN for security reason.
My main FreeBSD host has a public IP 91.203.72.xxx and all my sysutils/iocage jails run on a clone interface
/etc/rc.conf
I managed to get OpenVPN client to successfully connect to the OpenVPN server and I can ssh to all the jails with no problem but I cannot ssh to the FreeBSD host..
I have tried all sort of push route setting but nothing successfull so far..
To connect to the jail I do
To connect to the host I tried:
and always get
Could someone please advise on what to add in order to get ssh access to the host via OpenVPN?
I added my config files bellow and I think I need to add a line in /etc/openvpn/up.sh but not sure what.?
Thank you
/etc/openvpn/server.conf
/etc/openvpn/up.sh
I am not sure if this bellong here or in the Installation and Maintenance section of the forum...
I have installed security/openvpn in the aim of allowing ssh access from outside the office ONLY via OpenVPN for security reason.
My main FreeBSD host has a public IP 91.203.72.xxx and all my sysutils/iocage jails run on a clone interface
lo1/etc/rc.conf
Code:
## Set gateway
ifconfig_bce0="inet 91.203.72.xxx netmask 255.255.255.248" # This server
defaultrouter="91.203.72.xxx"
gateway_enable="YES"
## Set jails aliace interface
cloned_interfaces="${cloned_interfaces} lo1" # allows loopback isolation in the jail
ipv4_addrs_lo1="10.8.20.10-49/29"
I have tried all sort of push route setting but nothing successfull so far..
To connect to the jail I do
ssh admin@10.8.20.xxTo connect to the host I tried:
ssh admin@10.8.21.0 ssh admin@91.203.72.xxxand always get
Code:
ssh: connect to host 91.203.72.xxx port 22: Connection timed out
Code:
ssh: connect to host 10.8.21.0 port 22: Connection timed out
I added my config files bellow and I think I need to add a line in /etc/openvpn/up.sh but not sure what.?
Thank you
/etc/openvpn/server.conf
Code:
# Which local IP address should OpenVPN listen on?
local 91.203.72.xxx
# Which TCP/UDP port should OpenVPN listen on?
port 1194
# PF firewall integration
script-security 2
setenv-safe wan bce0
up /usr/local/etc/openvpn/up.sh
down /usr/local/etc/openvpn/down.sh
# TCP or UDP server?
proto udp
# "dev tun" will create a routed IP tunnel,
dev tun
# SSL/TLS certificate
ca /usr/local/etc/openvpn/keys/ca.crt
cert /usr/local/etc/openvpn/keys/vpnserver.crt
key /usr/local/etc/openvpn/keys/vpnserver.key
# Diffie hellman parameters.
dh /usr/local/etc/openvpn/keys/dh4096.pem
# Configure server mode and supply a VPN subnet
server 10.8.21.0 255.255.255.0
# Maintain a record of client <-> virtual IP address associations
ifconfig-pool-persist ipp.txt
# Push routes to client
push "route 91.203.72.xxx 255.255.255.248"
push "route 10.8.20.0 255.255.255.0"
# Assign specific IP addresses to clients
client-config-dir ccd
route 10.8.20.0 255.255.255.0
# The keepalive directive
keepalive 10 120
# Block DoS attacks and UDP port flooding.
tls-auth /usr/local/etc/openvpn/keys/ta.key 0
# Cryptographic cipher.
cipher AES-256-CBC
# Enable compression on the VPN link.
comp-lzo
# The maximum number of concurrently connected
# clients we want to allow.
max-clients 2
# Reduce the OpenVPN daemon's privileges
user nobody
group nobody
# Set persist options
persist-key
persist-tun
# Output a short status file showing
# current connections, truncated
# and rewritten every minute.
status /var/log/openvpn/openvpn-status.log
# Set, log messages path
log /var/log/openvpn/openvpn.log
# Set the log level
verb 3
mute 20
Code:
#!/bin/sh
ANCHOR="openvpn"
/sbin/ifconfig ${dev} inet6 -ifdisabled
/sbin/pfctl -a ${ANCHOR} -F rules
/sbin/pfctl -a ${ANCHOR} -F nat
/sbin/pfctl -a ${ANCHOR} -f - <<EOT
nat on ${OPENVPN_wan} inet from ${dev}:network to any -> (${OPENVPN_wan}:0) port 1024:65535
pass quick on ${dev} all
pass in quick on ${OPENVPN_wan} inet proto udp from any to (${OPENVPN_wan}) port ${local_port_1}
EOT