LinuxQuestions.org
Visit Jeremy's Blog.
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 12-16-2008, 07:33 PM   #16
Red Squirrel
Senior Member
 
Registered: Dec 2003
Distribution: Mint 20.1 on workstation, Debian 11 on servers
Posts: 1,336

Original Poster
Rep: Reputation: 54

I found some of the files, they're all over the place on the system.

Could someone point out what the /etc/openvpn directory should look like? Like should there be a easy-rsa folder IN that folder, or should those files be in root? these are all things the documentation fails to say. i don't get why they can't just prebuild the config file structure like most other programs do. Trying to do the ../vars command but no luck. Tried ./vars in case ../vars was a spelling mistake, no go either.
 
Old 12-16-2008, 10:53 PM   #17
internetSurfer
Member
 
Registered: Jan 2008
Location: w3c
Distribution: Slackware 12 Zenwalk 5.2
Posts: 71

Rep: Reputation: 16
Extra Info that may be of use:

Quote:
How to install OpenVPN on Fedora Core 2
http://www.howforge.com/how-to-insta...-fedora-core-2

HOWTO OpenVPN setup guide for FC3, FC4, FC5, CentOS ++ via M$
http://www.webhostingtalk.com/showthread.php?t=595436

How to Install Openvpn (Ubuntu)
http://www.thebakershome.net/openvpn_tutorial
_
 
Old 12-16-2008, 10:56 PM   #18
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
Here's what I have:
Code:
drwxr-xr-x 2 root root 4.0K Nov 17 13:29 ccd
drwxr-xr-x 3 root root 4.0K Nov 17 18:44 easy-rsa
-rw-rw-rw- 1 root root   39 Dec 17 15:42 ipp.txt
-rw------- 1 root root 9.3K Dec 15 08:41 openvpn.log
-rw------- 1 root root  232 Dec 17 15:46 openvpn-status.log
-rw-r--r-- 1 root root  11K Nov 17 13:50 server.conf
ipp.txt, openvpn.log and openvpn-status.log will be created by openvpn. ccd is the client config directory (see server.conf) and server.conf is copied from the sample given.

I'm not sure what isn't clear about "the easy-rsa directory can usually be found in /usr/share/doc/packages/openvpn or /usr/share/doc/openvpn-2.0 (it's best to copy this directory to another location such as /etc/openvpn". Note it doesn't say copy the contents, it says copy the directory (and that obviously includes the contents).
 
Old 12-17-2008, 04:26 PM   #19
Red Squirrel
Senior Member
 
Registered: Dec 2003
Distribution: Mint 20.1 on workstation, Debian 11 on servers
Posts: 1,336

Original Poster
Rep: Reputation: 54
hmm ok I'm way off track then. this is what I have:

Quote:
4 -rw-r--r-- 1 root root 2408 2008-12-16 20:12 auth-pam.pl
4 -rw-r--r-- 1 root root 743 2008-12-16 20:12 bridge-start
4 -rw-r--r-- 1 root root 315 2008-12-16 20:12 bridge-stop
4 -rwxr-xr-x 1 root root 121 2008-12-16 20:25 build-ca
4 -rwxr-xr-x 1 root root 354 2008-12-16 20:25 build-dh
4 -rwxr-xr-x 1 root root 190 2008-12-16 20:25 build-inter
4 -rwxr-xr-x 1 root root 165 2008-12-16 20:25 build-key
4 -rwxr-xr-x 1 root root 159 2008-12-16 20:25 build-key-pass
4 -rwxr-xr-x 1 root root 251 2008-12-16 20:25 build-key-pkcs12
4 -rwxr-xr-x 1 root root 270 2008-12-16 20:25 build-key-server
4 -rwxr-xr-x 1 root root 215 2008-12-16 20:25 build-req
4 -rwxr-xr-x 1 root root 160 2008-12-16 20:25 build-req-pass
4 -rwxr-xr-x 1 root root 430 2008-12-16 20:25 clean-all
4 -rw-r--r-- 1 root root 3427 2008-12-16 20:02 client.conf
4 -rw-r--r-- 1 root root 3564 2008-12-16 20:02 firewall.sh
4 -rw-r--r-- 1 root root 62 2008-12-16 20:02 home.up
4 -rwxr-xr-x 1 root root 1459 2008-12-16 20:25 inherit-inter
0 -rw------- 1 root root 0 2008-12-16 20:59 ipp.txt
4 drwx------ 2 root root 4096 2008-12-16 20:41 keys
4 -rwxr-xr-x 1 root root 297 2008-12-16 20:25 list-crl
4 -rw-r--r-- 1 root root 639 2008-12-16 20:02 loopback-client
4 -rw-r--r-- 1 root root 665 2008-12-16 20:02 loopback-server
4 -rw-r--r-- 1 root root 389 2008-12-16 20:25 Makefile
4 -rw-r--r-- 1 root root 62 2008-12-16 20:02 office.up
8 -rwxr-xr-x 1 root root 7768 2008-12-16 20:25 openssl-0.9.6.cnf
12 -rwxr-xr-x 1 root root 8230 2008-12-16 20:25 openssl.cnf
8 -rw-r--r-- 1 root root 5519 2008-12-16 20:12 openvpn.init
4 -rw-r--r-- 1 root root 63 2008-12-16 20:02 openvpn-shutdown.sh
4 -rw-r--r-- 1 root root 776 2008-12-16 20:02 openvpn-startup.sh
4 -rw------- 1 root root 232 2008-12-16 20:59 openvpn-status.log
12 -rwxr-xr-x 1 root root 12068 2008-12-16 20:25 pkitool
12 -rw-r--r-- 1 root root 8864 2008-12-16 20:25 README
4 -rwxr-xr-x 1 root root 894 2008-12-16 20:25 revoke-full
4 -rw-r--r-- 1 root root 820 2008-12-16 20:02 roadwarrior-client.conf
4 -rw-r--r-- 1 root root 1498 2008-12-16 20:02 roadwarrior-server.conf
4 drwxr-xr-x 2 root root 4096 2008-12-10 16:03 samples
12 -rw-r--r-- 1 root root 10062 2008-12-16 20:58 server.conf
4 -rwxr-xr-x 1 root root 180 2008-12-16 20:25 sign-req
4 -rw-r--r-- 1 root root 1742 2008-12-16 20:02 static-home.conf
4 -rw-r--r-- 1 root root 1688 2008-12-16 20:02 static-office.conf
4 -rw-r--r-- 1 root root 1937 2008-12-16 20:02 tls-home.conf
4 -rw-r--r-- 1 root root 1948 2008-12-16 20:02 tls-office.conf
4 -rw-r--r-- 1 root root 339 2008-12-16 20:12 ucn.pl
4 -rwxr-xr-x 1 root root 1590 2008-12-16 20:28 vars
4 -rw-r--r-- 1 root root 1755 2008-12-16 20:12 verify-cn
4 -rwxr-xr-x 1 root root 190 2008-12-16 20:25 whichopensslcnf
4 -rw-r--r-- 1 root root 199 2008-12-16 20:02 xinetd-client-config
4 -rw-r--r-- 1 root root 989 2008-12-16 20:02 xinetd-server-config

Think I'll jsut start over from scratch now that I know which files are actually needed and now that I know the easy-rsa is supose to be in it's own folder, which is probably why openvpn fails to start (can't find the cert files)
 
Old 12-17-2008, 08:38 PM   #20
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
Just looks like you copied the contents of easy-rsa to /etc/openvpn rather than the directory.

Just mv everything except the logs and ipp.txt to a new directory /etc/openvpn/easy-rsa

Hint - move everything (mv /etc/openvpn/* /etc/openvpn/easy-rsa) then move the other few thing back - mv /etc/openvpn/easy-rsa/*.conf /etc/openvpn and mv /etc/openvpn/easy-rsa/ipp.txt /etc/openvpn)

BM
 
Old 12-17-2008, 10:58 PM   #21
Red Squirrel
Senior Member
 
Registered: Dec 2003
Distribution: Mint 20.1 on workstation, Debian 11 on servers
Posts: 1,336

Original Poster
Rep: Reputation: 54
I managed to get it working to the point where I can connect to it with a client. It wont work (can't ping my network's IPs from vpn client) but I was doing routing and seems most tutorials are leaning towards bridging, so I'll try bridging tomorrow and see how it goes. (late night work shift FTW, slacking at it's best, can't see it's not IT related. :P)
 
Old 12-17-2008, 11:01 PM   #22
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
Are you trying to connect from outside or from your lan? Expect trouble from your lan (I think it's an IP issue, but never wasted my time tring to sort it).

Note that openvpn suggest bridging onky for certain requirements (there's a discussion at the start of the howto from memory). I'd suggest you get a basic setup working first.

Cheers

BM
 
Old 12-18-2008, 01:27 AM   #23
Red Squirrel
Senior Member
 
Registered: Dec 2003
Distribution: Mint 20.1 on workstation, Debian 11 on servers
Posts: 1,336

Original Poster
Rep: Reputation: 54
Nah from outside. At first I was trying through a SSH tunnel then realized that wont work since as soon as the vpn goes through then the ssh address becomes unroutable. So scrapped that idea and opened up the port. SSHed to my home from work, was VPNing from inside a VM. I could see in the logs that there was a connection and all.
 
Old 12-18-2008, 07:13 PM   #24
Red Squirrel
Senior Member
 
Registered: Dec 2003
Distribution: Mint 20.1 on workstation, Debian 11 on servers
Posts: 1,336

Original Poster
Rep: Reputation: 54
Ok I can connect but I think my issue is the vpn server is giving me the wrong gateway so the client cannot get onto the network properly.

My gateway is 10.1.1.1 the vpn client gets 10.1.1.15 which is the IP of the vpn server. Does openvpn only work on routers?

I also tried to use push route to no avail, so I ended up uncommenting it as my last attempt but I'm at lost here I pretty much tried everything. Once I get this working I'll be sure to write a doc or something so it's easier for myself or anyone else in the future to get it going.

This is my server.conf file:

Code:
# and bridged it with your ethernet interface.
# If you want to control access policies
# over the VPN, you must create firewall
# rules for the the TUN/TAP interface.
# On non-Windows systems, you can give
# an explicit unit number, such as tun0.
# On Windows, use "dev-node" for this.
# On most systems, the VPN will not function
# unless you partially or fully disable
# the firewall for the TUN/TAP interface.
dev tap
;dev tun

# Windows needs the TAP-Win32 adapter name
# from the Network Connections panel if you
# have more than one.  On XP SP2 or higher,
# you may need to selectively disable the
# Windows firewall for the TAP adapter.
# Non-Windows systems usually don't need this.
;dev-node MyTap

# SSL/TLS root certificate (ca), certificate
# (cert), and private key (key).  Each client
# and the server must have their own cert and
# key file.  The server and all clients will
# use the same ca file.
#
# See the "easy-rsa" directory for a series
# of scripts for generating RSA certificates
# and private keys.  Remember to use
# a unique Common Name for the server
# and each of the client certificates.
#
# Any X509 key management system can be used.
# OpenVPN can also use a PKCS #12 formatted key file
# (see "pkcs12" directive in man page).
ca /etc/openvpn/easy-rsa/keys/ca.crt
cert /etc/openvpn/easy-rsa/keys/server.crt
key /etc/openvpn/easy-rsa/keys/server.key  # This file should be kept secret

# Diffie hellman parameters.
# Generate your own with:
#   openssl dhparam -out dh1024.pem 1024
# Substitute 2048 for 1024 if you are using
# 2048 bit keys.
dh /etc/openvpn/easy-rsa/keys/dh1024.pem

# Configure server mode and supply a VPN subnet
# for OpenVPN to draw client addresses from.
# The server will take 10.8.0.1 for itself,
# the rest will be made available to clients.
# Each client will be able to reach the server
# on 10.8.0.1. Comment this line out if you are
# ethernet bridging. See the man page for more info.
;server 10.1.10.0 255.255.255.0

# Maintain a record of client <-> virtual IP address
# associations in this file.  If OpenVPN goes down or
# is restarted, reconnecting clients can be assigned
# the same virtual IP address from the pool that was
# previously assigned.
ifconfig-pool-persist ipp.txt

# Configure server mode for ethernet bridging.
# You must first use your OS's bridging capability
# to bridge the TAP interface with the ethernet
# NIC interface.  Then you must manually set the
# IP/netmask on the bridge interface, here we
# assume 10.8.0.4/255.255.255.0.  Finally we
# must set aside an IP range in this subnet
# (start=10.8.0.50 end=10.8.0.100) to allocate
# to connecting clients.  Leave this line commented
# out unless you are ethernet bridging.
server-bridge 10.1.1.15 255.255.255.0 10.1.1.200 10.1.1.255

# Push routes to the client to allow it
# to reach other private subnets behind
# the server.  Remember that these
# private subnets will also need
# to know to route the OpenVPN client
# address pool (10.8.0.0/255.255.255.0)
# back to the OpenVPN server.
;push "route 192.168.10.0 255.255.255.0"
;push "route 10.1.1.0 255.255.255.0"


# To assign specific IP addresses to specific
# clients or if a connecting client has a private
# subnet behind it that should also have VPN access,
# use the subdirectory "ccd" for client-specific
# configuration files (see man page for more info).

# EXAMPLE: Suppose the client
# having the certificate common name "Thelonious"
# also has a small subnet behind his connecting
# machine, such as 192.168.40.128/255.255.255.248.
# First, uncomment out these lines:
;client-config-dir ccd
;route 192.168.40.128 255.255.255.248
# Then create a file ccd/Thelonious with this line:
#   iroute 192.168.40.128 255.255.255.248
# This will allow Thelonious' private subnet to
# access the VPN.  This example will only work
# if you are routing, not bridging, i.e. you are
# using "dev tun" and "server" directives.

# EXAMPLE: Suppose you want to give
# Thelonious a fixed VPN IP address of 10.9.0.1.
# First uncomment out these lines:
;client-config-dir ccd
;route 10.9.0.0 255.255.255.252
# Then add this line to ccd/Thelonious:
#   ifconfig-push 10.9.0.1 10.9.0.2

# Suppose that you want to enable different
# firewall access policies for different groups
# of clients.  There are two methods:
# (1) Run multiple OpenVPN daemons, one for each
#     group, and firewall the TUN/TAP interface
#     for each group/daemon appropriately.
# (2) (Advanced) Create a script to dynamically
#     modify the firewall in response to access
#     from different clients.  See man
#     page for more info on learn-address script.
;learn-address ./script

# If enabled, this directive will configure
# all clients to redirect their default
# network gateway through the VPN, causing
# all IP traffic such as web browsing and
# and DNS lookups to go through the VPN
# (The OpenVPN server machine may need to NAT
# the TUN/TAP interface to the internet in
# order for this to work properly).
# CAVEAT: May break client's network config if
# client's local DHCP server packets get routed
# through the tunnel.  Solution: make sure
# client's local DHCP server is reachable via
# a more specific route than the default route
# of 0.0.0.0/0.0.0.0.
;push "redirect-gateway def1"

# Certain Windows-specific network settings
# can be pushed to clients, such as DNS
# or WINS server addresses.  CAVEAT:
# http://openvpn.net/faq.html#dhcpcaveats
push "dhcp-option DNS 10.1.1.10"
;push "dhcp-option WINS 10.8.0.1"


# Uncomment this directive to allow different
# clients to be able to "see" each other.
# By default, clients will only see the server.
# To force clients to only see the server, you
# will also need to appropriately firewall the
# server's TUN/TAP interface.
;client-to-client

# Uncomment this directive if multiple clients
# might connect with the same certificate/key
# files or common names.  This is recommended
# only for testing purposes.  For production use,
# each client should have its own certificate/key
# pair.
#
# IF YOU HAVE NOT GENERATED INDIVIDUAL
# CERTIFICATE/KEY PAIRS FOR EACH CLIENT,
# EACH HAVING ITS OWN UNIQUE "COMMON NAME",
# UNCOMMENT THIS LINE OUT.
;duplicate-cn

# The keepalive directive causes ping-like
# messages to be sent back and forth over
# the link so that each side knows when
# the other side has gone down.
# Ping every 10 seconds, assume that remote
# peer is down if no ping received during
# a 120 second time period.
keepalive 10 120

# For extra security beyond that provided
# by SSL/TLS, create an "HMAC firewall"
# to help block DoS attacks and UDP port flooding.
#
# Generate with:
#   openvpn --genkey --secret ta.key
#
# The server and each client must have
# a copy of this key.
# The second parameter should be '0'
# on the server and '1' on the clients.
;tls-auth ta.key 0 # This file is secret

# Select a cryptographic cipher.
# This config item must be copied to
# the client config file as well.
;cipher BF-CBC        # Blowfish (default)
cipher AES-128-CBC   # AES
;cipher DES-EDE3-CBC  # Triple-DES

# Enable compression on the VPN link.
# If you enable it here, you must also
# enable it in the client config file.
comp-lzo

# The maximum number of concurrently connected
# clients we want to allow.
;max-clients 100

# It's a good idea to reduce the OpenVPN
# daemon's privileges after initialization.
#
# You can uncomment this out on
# non-Windows systems.
;user nobody
;group nobody

# The persist options will try to avoid
# accessing certain resources on restart
# that may no longer be accessible because
# of the privilege downgrade.
persist-key
persist-tun

# Output a short status file showing
# current connections, truncated
# and rewritten every minute.
status openvpn-status.log

# By default, log messages will go to the syslog (or
# on Windows, if running as a service, they will go to
# the "\Program Files\OpenVPN\log" directory).
# Use log or log-append to override this default.
# "log" will truncate the log file on OpenVPN startup,
# while "log-append" will append to it.  Use one
# or the other (but not both).
;log         openvpn.log
;log-append  openvpn.log

# Set the appropriate level of log
# file verbosity.
#
# 0 is silent, except for fatal errors
# 4 is reasonable for general usage
# 5 and 6 can help to debug connection problems
# 9 is extremely verbose
verb 3

# Silence repeating messages.  At most 20
# sequential messages of the same message
# category will be output to the log.
;mute 20


Any help would be appreciated, thanks.
 
Old 12-18-2008, 07:37 PM   #25
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
Will have a look later.
 
Old 12-19-2008, 12:20 PM   #26
scheidel21
Senior Member
 
Registered: Feb 2003
Location: CT
Distribution: Debian 6+, CentOS 5+
Posts: 1,323

Rep: Reputation: 100Reputation: 100
It has been a while since I played with VPNs but if I recall the gateway for the network needs to be the ip of the VPN server because that is acting as the proxy for the remote computer. I am not entirely sure if you are getting bad settings. I had a pptp VPN setup and Irouted all network traffic over the regular internet connection on the machine except for LANtraffic that was for the remote LAN.
 
Old 12-19-2008, 02:59 PM   #27
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
I made a post to this yesterday that seems to have gotten lost. Damn.

Anyway, question was, what is the IP range of you physical network. Your VPN is on 10.1.1.*, but your physical one should be something else.

I don't use bridging, but shouldn't you client machine be getting 10.1.1.200-255 (that should be 254 max btw since 255 is broadcast).

Also, did you set up the bridge between tap and NIC?

Stil ldon't knowe where my other post went - it was better than this one.
 
Old 12-19-2008, 05:27 PM   #28
Red Squirrel
Senior Member
 
Registered: Dec 2003
Distribution: Mint 20.1 on workstation, Debian 11 on servers
Posts: 1,336

Original Poster
Rep: Reputation: 54
I setup a bridge as per instructions in the howto (using the bridge-start and bridge-stop scripts and editing).

My original plan was to make my vpn range 10.1.10.0/24 but from my understanding when I do bridge it has to match my real network, or am I wrong? My real network is 10.1.1.0/24 range. The DHCP range is 100-200 so I set vpn to 200-254 (I did put 255 I'll have to change that, my bad)
 
Old 12-19-2008, 05:43 PM   #29
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
I would think they need to be different, but I've never used a bridged vpn. I'll look at the howto later.
 
Old 12-19-2008, 06:05 PM   #30
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
Looks right.

When you connect, what can you ping? Can you ping the server but not other machines on the network?

What's the routing on the client say (ie output of route command) - are you hooking up from linux or windows?
 
  


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
Dynamic IP VPN between IpSec(OpenBSD) and Linux VPN software Peter_APIIT Linux - Server 2 04-09-2008 05:08 AM
Configure Linux VPN Server for a Windows VPN Client xbaez Linux - Networking 4 04-28-2006 03:29 PM
Linux VPN Software - How to Connect to a Windows VPN wfernley Linux - Software 2 02-07-2006 09:40 AM
VPN: linux VPN server behind Linksys router hamish Linux - Networking 14 08-25-2005 08:42 PM

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

All times are GMT -5. The time now is 01:28 PM.

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