Bug 1039655 - ipsec newhostkey generates false configuration
Summary: ipsec newhostkey generates false configuration
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libreswan
Version: 7.0
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: rc
: ---
Assignee: Paul Wouters
QA Contact: Aleš Mareček
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-12-09 17:11 UTC by Aleš Mareček
Modified: 2018-03-14 10:56 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-06-13 11:49:01 UTC
Target Upstream Version:


Attachments (Terms of Use)

Description Aleš Mareček 2013-12-09 17:11:41 UTC
Description of problem:


Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1. ipsec newhostkey --configdir /etc/ipsec.d --output /etc/ipsec.secrets --bits 4096
2. ipsec showhostkey --list
3. grep hostname /etc/ipsec.secrets 
hostname is 'praag.<- SNIP ->'

Actual results:
ipsec showhostkey "/etc/ipsec.secrets" line 2: premature end of RSA key
ipsec showhostkey ERROR "/etc/ipsec.secrets" line 2: index "hostname" does not look numeric and name lookup failed (no validation performed)
ipsec showhostkey ERROR "/etc/ipsec.secrets" line 2: index "is" does not look numeric and name lookup failed (no validation performed)
ipsec showhostkey ERROR "/etc/ipsec.secrets" line 2: index "'praag.brq.redhat.com'" illegal (non-DNS-name) character in name
ipsec showhostkey ERROR "/etc/ipsec.secrets" line 6: index "Modulus" does not look numeric and name lookup failed (no validation performed)
ipsec showhostkey "/etc/ipsec.secrets" line 6: unrecognized key format: 0xc7a7bf92482d92ea574a338c57997b0f4140550c6936d3529ebeb9be5624af1ec2e772c029bd56f1e713ca9bbafab226bf73a960432c96fdf4d2d2e09b9c4d7705a4fca4025f7215b223b2db19151f4cefa64a23019a15dd102fbfe11fe154daf5d5a09c29c9aea796f145d847ba99e4fcaf0d5668c80cb63c3268359a6c73e381460399b04c36130da933ecf013c7fd80119d5881a58907fbe77a3ed6783ce0b284b5d6e168e3eb58afb522f8a707d8e2b81ee0d82a9980b3509aabebd3fb6a94dc95d15653160c2812b3ed5153bcd5c8f2f6a558c2532d3986afba4e047b5a0ad93e2aefd095549d944a17a6a44b8ce4810fa3ed37e29f9f4d93f66dec1ddfd3fb2622d6e1ae52bbd4253556f4919e43fbd71a4d004a13e9a0b2ed584690812a5f563cfa3958e18d425d488646d51568fee5adabaa8dc7d76c49b2dd3bf02d38c24476fdbfb8fae6d085ac6cf2ddd3d06523e8171ad975738ac851e4c274aeb32db4594bf11f0abac74da0e3b160b3f377b580c4658deb1e5efbd1fb86fb505faee54621279a61e215a7250e3c8a9aae9338b1c668505753538102a3e97cc7dd111ff1b46705e3136afeca3e6db2a882bee7d3722299ab2515e1ceeaeeae39b88c4204643757539eb71a94da9c5f13335991016d905f2acb


Expected results:
1(1): RSA keyid: AQPHp7+SS with id: (none)
1(2): RSA keyid: AQPHp7+SS with id: (none)

Additional info:
[root@praag ~]# sed -i 's/^hostname/#hostname/g' /etc/ipsec.secrets 
[root@praag ~]# grep hostname /etc/ipsec.secrets 
#hostname is 'praag.<- SNIP ->'
[root@praag ~]# ipsec showhostkey --list
1(1): RSA keyid: AQPHp7+SS with id: (none)
1(2): RSA keyid: AQPHp7+SS with id: (none)

Comment 2 Paul Wouters 2013-12-09 17:28:02 UTC
I'm pretty sure this is what happened:

1) you installed a VM low on entropy
2) you can newhostkey
3) you waited for a while, and ctrl-c'ed it
4) you ran it again, now waiting longer
5) corrupt file

Do this on a clean VM instead:

ipsec newhostkey --configdir /etc/ipsec.d --output /etc/ipsec.secrets --bits 4096 --random /dev/urandom

Comment 3 Aleš Mareček 2013-12-09 18:08:15 UTC
Nope, different machine and same "hostname" string:
[0 root@auto-ppcp-005 ~]# cat /etc/ipsec.secrets
include /etc/ipsec.d/*.secrets
: PSK "secret123"
[0 root@auto-ppcp-005 ~]# ipsec newhostkey --configdir /etc/ipsec.d --output /etc/ipsec.secrets --bits 4096 --random /dev/urandom
Generated RSA key pair using the NSS database
[0 root@auto-ppcp-005 ~]# ipsec showhostkey --list
ipsec showhostkey "/etc/ipsec.secrets" line 2: premature end of RSA key
ipsec showhostkey "/etc/ipsec.secrets" line 3: premature end of RSA key
ipsec showhostkey ERROR "/etc/ipsec.secrets" line 3: index "hostname" does not look numeric and name lookup failed (no validation performed)
ipsec showhostkey ERROR "/etc/ipsec.secrets" line 3: index "is" does not look numeric and name lookup failed (no validation performed)
ipsec showhostkey ERROR "/etc/ipsec.secrets" line 3: index "'auto-ppcp-005.<- SNIP ->'" illegal (non-DNS-name) character in name
ipsec showhostkey ERROR "/etc/ipsec.secrets" line 7: index "Modulus" does not look numeric and name lookup failed (no validation performed)
ipsec showhostkey "/etc/ipsec.secrets" line 7: unrecognized key format: 0xe55e2c8d437d99a7b0b986b4e3f9f25b679caf872a9aabd63c7cf01c7bd9d626a0cac85c328d5630552a99a90e6a77be0a14845d9f9dc0be2cd6b1246ce8edb267b7279396a632294aafbe2e542ce992c9a862178a55f72d87ef0af235a1f37c3c2ac1c9e2eb495d05c07fa27e679ac01460cbd4d9aefcbcd42f59e9cebd97a0965d21be89e17b8c88af0e41c9123fde20e959584bd4d0024cb828cb25f1113d8a3c21d527bd5f1d71ff976b6662615d17644faa647383ecbc87396ca889933c7f4e794a3dbd282bf273b6061a0778f8964855b246fbd47fe1ca23bcd30fbb74b2afe9eeff35800b86c565b45845c77c80d503eb838c7295e9b94d302b4fd13fb7a64a4730c422639e054cf288f18c4caf7c28b0e0fb7e728f5ad5c3a9e9f14a6409c3096d61e7f7dc5ab1c01c65cf62872cced51e522e3b7ec42df3dd0b037f89b449d442be46315bbe77a633fd5ea39bc9899c5a6bcea4abb2c4395a0cb2f969aa0a05a


Btw: my box and the ppc aren't VMs.

Comment 4 Paul Wouters 2013-12-09 21:05:49 UTC
Odd. I just reproduced this. Looking into it now......

Comment 5 Paul Wouters 2013-12-09 21:16:36 UTC
diff --git a/programs/rsasigkey/rsasigkey.c b/programs/rsasigkey/rsasigkey.c
index 46d34bd..a1349fa 100644
--- a/programs/rsasigkey/rsasigkey.c
+++ b/programs/rsasigkey/rsasigkey.c
@@ -351,7 +351,6 @@ int main(int argc, char *argv[])
                                strerror(errno));
                        exit(1);
                }
-               fprintf(stdout,"hostname is '%s'\n",outputhostname);
        }
 
        if (!configdir) {


This fix will be in libreswan-3.7 that I'm releasing today - you should have a new build later today as well.

Comment 11 Ludek Smid 2014-06-13 11:49:01 UTC
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.


Note You need to log in before you can comment on or make changes to this bug.