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 11-15-2016, 10:29 AM   #1
zvivered
Member
 
Registered: Sep 2007
Posts: 294

Rep: Reputation: 23
OpenSSL client: verify that client is valid


Hello,

I found the attached sample code for client side and server side in:
http://h41379.www4.hpe.com/doc/83fin...C2%A0%EF%BF%BD

client side uses the files:
client_ca.crt
client.key
client.crt

server side uses the files:
server.crt
server.key
server_ca.crt

client_ca.crt = server_ca.crt
client_ca.key = server_ca.key

How the server can make sure that a valid client is sending a request ?

In the client side, if "verify_client == ON", the routine:
SSL_CTX_check_private_key ask for a password.
How can avoid it ? I want the client verification to be automatic, without user response.

Thank you,
Z.V
Attached Files
File Type: txt client.c.txt (8.7 KB, 20 views)
File Type: txt server.c.txt (8.7 KB, 12 views)

Last edited by zvivered; 11-15-2016 at 03:18 PM.
 
Old 11-16-2016, 03:32 PM   #2
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,140

Rep: Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263
If you don't want to be prompted for a password, then use certs with no password.
 
Old 11-17-2016, 07:36 AM   #3
zvivered
Member
 
Registered: Sep 2007
Posts: 294

Original Poster
Rep: Reputation: 23
Why SSL_connect fails ?

Hello,

Attached client, server code.
The server code is copied from OpenSSL wiki.
In this code I did some minor changes in order to turn it to a client code.

In the client side, SSL_connect fails with rc=0. SSL_get_error returns 5.

Can you please tell what is wrong in my client side ?

Upon SSL_connect, SSL_acceopt returns with rc=0. SSL_get_error returns 5.

Thank you in advance,
Z.V
Attached Files
File Type: txt client.c.txt (2.5 KB, 11 views)
File Type: txt server.c.txt (2.8 KB, 8 views)
 
Old 11-17-2016, 09:08 AM   #4
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659
Blog Entries: 4

Rep: Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941
As has been said:
  1. Make sure that verification is set to use only a certificate; to not fall back by any means to a password prompt.
  2. Make sure that the certificates themselves are not encrypted with a password. (If they are, you will be required to enter it.)
  3. You should not use "challenge password," either.
 
Old 11-17-2016, 09:19 AM   #5
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
Code:
openssl rsa -in server.key -out server-no-pass.key
should ask for server.key first, Enter it at
Enter password: <key file password>

Next it (-out...) it will ask you to create a password for server-no-pass.key and upon
Enter password: <press enter twice>

use crt and no-pass.key in ssl conf.
Something like this:
Code:
SSLCertificateFile /you/must/edit/me/domain_com_ee.crt
SSLCertificateKeyFile  /etc/pki/tls/private/server-no-pass.key
SSLCACertificateFile /you/must/edit/me/domain_com_apache.crt
Hope that helps.
 
Old 11-18-2016, 02:39 AM   #6
zvivered
Member
 
Registered: Sep 2007
Posts: 294

Original Poster
Rep: Reputation: 23
Where is ssl conf ?

Hello,

Thank you very much for your help !

Attached my current code for client+server.
I created cert.pem with:

openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365
Then I copied cert.pem to the server side.

what key should I use for creating server-no-pass.key ?

Is there a way not to change openssl.cnf ?

Best regards,
Z.V
Attached Files
File Type: txt client.c.txt (2.0 KB, 10 views)
File Type: txt server.c.txt (1.6 KB, 9 views)

Last edited by zvivered; 11-18-2016 at 03:10 AM.
 
Old 11-18-2016, 04:42 AM   #7
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
Quote:
Originally Posted by zvivered View Post
openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365
Then I copied cert.pem to the server side.

what key should I use for creating server-no-pass.key ?

Is there a way not to change openssl.cnf ?

Best regards,
Z.V
You identified them earlier as:
Quote:
Originally Posted by zvivered View Post
server side uses the files:
server.crt
server.key
server_ca.crt

client_ca.crt = server_ca.crt
client_ca.key = server_ca.key
openssl.cnf?
Did you mean /etc/ssl/openssl.cnf ?

I think I should butt out now. Sorry, nothing personal.

Last edited by Habitual; 11-18-2016 at 04:54 AM.
 
  


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
[SOLVED] openssl client test help please aus9 Linux - Security 6 11-30-2015 12:18 AM
Openssl client through proxy thirumalesh Programming 1 05-23-2011 12:36 PM
openssl ssl error code 14090086 verify the CA cert is ok / certificate verify failed acummings Slackware 14 02-27-2009 01:51 AM
Server and Client process using Openssl: Error: no client certificate available lokesh_c2004 Linux - Security 2 11-10-2008 08:30 AM
Is ctorrent still a valid BitTorrent client ? karhu Linux - Software 2 07-12-2005 01:18 AM

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

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