LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 05-22-2012, 11:32 PM   #1
Thakowbbery
Member
 
Registered: Mar 2005
Posts: 138

Rep: Reputation: 17
CentOS 64-bits + OpenSwan - Just won´t work


This is starting to piss me off. I´ve trying now for a long time to implement a VPN between two sites using OpenSwan and CentOS and I just can´t make it work. In the past I remember being so easy using Debian

Here´s the setup: two offices remotely connected, running same CentOS version

First problem was the absence of the RSA key. Not a problem, let´s create it:

# ipsec newhostkey --output /etc/ipsec.d/hostkeys.secrets --bits 2048
ipsec rsasigkey: configdir is required

Kay, that´s a new one. Fine, done some search and found a configdb at /etc/pki/nssdb/. Again:

# ipsec newhostkey --configdir /etc/pki/nssdb/ --output /etc/ipsec.d/hostkeys.secrets --bits 2048

After a loooooong time, it was ready. Okay, now let´s just create ipsec.conf, as always. Keys were copied from the output of ipsec showhostkey --left/right

# cat /etc/ipsec.conf

version 2.0
config setup
plutodebug="control parsing"
plutostderrlog=/var/log/ipsec.log
protostack=netkey
nat_traversal=no
virtual_private=
oe=off

conn <myConn>
left=X.X.X.X
leftsubnet=Y.Y.Y.Y/YY
leftnexthop=Z.Z.Z.Z
leftrsasigkey=sdniuaheiua...
right=A.A.A.A
rightsubnet=B.B.B.B/BB
rightnexthop=C.C.C.C
rightrsasigkey=msnaibaiufb...
auto=start

The file is the exactly the same at both ends and I´M 100% SURE THE KEYS WERE COPIED CORRECTLY. The thing is:

# service ipsec start
# tail -f /var/log/ipsec.conf
ipsec_setup: Starting Openswan IPsec U2.6.32/K2.6.32-220.7.1.el6.x86_64...
ipsec_setup: multiple ip addresses, using X.X.X.X on eth1
...
And then I start getting a huge amount of:

"myConn" #11: Signature check (on A.A.A.A) failed (wrong key?); tried *AQPbuQvlQ
public key for A.A.A.A failed: decrypted SIG payload into a malformed ECB (3NSS error: Not able to decrypt)
"myConn" #11: sending encrypted notification INVALID_KEY_INFORMATION to A.A.A.A:500
...

And the thing goes into a loop.

1) I´ve already lost count of how many times I did recreate those keys
2) I´ve already n_checked for typos and I can guarantee the keys are correct

I tried recreating them by following this link (going back to basics): http://www.linuxhomenetworking.com/w...enswan_Started

# ipsec rsasigkey --verbose 2048 > keys.tmp
(once again the error about configdir... okay)
# ipsec --configdir /etc/pki/nssdb rsasigkey --verbose 2048 > keys.tmp

Again, after a long time, I get a new error: "ipsec rsasigkey: key pair generation failed: "-8037""

I followed till this link (https://lists.openswan.org/pipermail...er/017845.html), installed nss-tools and tried the commands as they were:

# certutil -N -d /etc/ipsec.d (typed in a password when prompted)
# ipsec newhostkey --configdir /etc/ipsec.d --output /etc/ipsec.d/hostkeys.secrets --bits 2048 --password <password_ive_typed>

Again, after a long time it ended, but when I checked the new keys with ipsec showhostkey, I got this:

premature end of RSA key

Which seemed reasonable, since one box had a 2 line key and the other had 3.

As expected, those keys didn´t work (same error about INVALID_KEY)

Tried with a smaller, 1024 bit key. I didn´t get the error on premature end, but the INVALID_KEY messages still persist.

I just don´t know what to do anymore. Anyway I can try to solve this without having to change distributions?
 
Old 05-24-2012, 07:18 AM   #2
lithos
Senior Member
 
Registered: Jan 2010
Location: SI : 45.9531, 15.4894
Distribution: CentOS, OpenNA/Trustix, testing desktop openSuse 12.1 /Cinnamon/KDE4.8
Posts: 1,144

Rep: Reputation: 217Reputation: 217Reputation: 217
Hi,

I must say that I don't know VPN openswan, but something about keys triggered me to look at the thread,

out of this I think about:
- have you tried creating RSA or DSA keys (different type)
- generated keys not encrypted with password ?

I hope you get it working.

good luck
 
Old 06-04-2012, 09:26 AM   #3
Thakowbbery
Member
 
Registered: Mar 2005
Posts: 138

Original Poster
Rep: Reputation: 17
Okay, the issue is now solved (actually solved it two weeks ago, but now I´m putting the answer to anyone that gets the same thing):

Apparently there was a problem with the NSS database I was using (strange for a newly installed distribution, but okay)

I followed the instructions here:

http://www.accountingenhancements.co.../openswan.html
 
  


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
OpenSWAN, L2TP/IPSEC on CentOS 5.5 bderry71 Linux - Server 1 10-05-2010 09:33 PM
is openswan 2.4.8 can run on centos 5.3 hari85 Linux - Networking 1 07-02-2010 09:21 AM
One Way Communication in CentOS/OpenSwan to Sonicwall VPN pacmantravis Linux - Networking 0 02-21-2010 02:31 AM
L2TP/OpenSWAN Installation on Centos 5 blackmetal Linux - Networking 0 05-18-2009 11:54 AM
CentOS 5.1 with Openswan 2.6 problem aikie Linux - Networking 1 08-05-2008 01:38 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:13 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