LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-22-2014, 02:28 AM   #1
jojanmpaul
Member
 
Registered: Sep 2012
Location: Bangalore
Posts: 80

Rep: Reputation: Disabled
system library:fopen:No such file or directory


Hello,

The following command not allowing to create ca.key and ca.cer files,
openssl req -config ./openssl.cnf -newkey rsa:2048 -nodes -keyform PEM -keyout ca.key -x509 -days 3650 -extensions certauth -outform PEM -out ca.cer
error on line -1 of ./openssl.cnf
17695:error:02001002:system library:fopen:No such file or directory:bss_file.c:122:fopen('./openssl.cnf','rb')
17695:error:2006D080:BIO routines:BIO_new_file:no such file:bss_file.c:125:
17695:error:0E078072:configuration file routinesEF_LOAD:no such file:conf_def.c:197:

ls /var/www/html/CA
index.txt newcerts openssl.cnf private serial

Could you help me how to create a certificate authority in-order to achieve two way SSL.

Last edited by jojanmpaul; 09-22-2014 at 06:21 AM.
 
Old 09-22-2014, 03:52 AM   #2
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 8,536

Rep: Reputation: 2441Reputation: 2441Reputation: 2441Reputation: 2441Reputation: 2441Reputation: 2441Reputation: 2441Reputation: 2441Reputation: 2441Reputation: 2441Reputation: 2441
the error message is: No such file or directory. I think you need to cd /var/www/html/CA before executing this command.
 
Old 09-22-2014, 04:52 AM   #3
jojanmpaul
Member
 
Registered: Sep 2012
Location: Bangalore
Posts: 80

Original Poster
Rep: Reputation: Disabled
Hi,

The command executed from the path /var/www/html/CA.
 
Old 09-22-2014, 05:38 AM   #4
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 8,536

Rep: Reputation: 2441Reputation: 2441Reputation: 2441Reputation: 2441Reputation: 2441Reputation: 2441Reputation: 2441Reputation: 2441Reputation: 2441Reputation: 2441Reputation: 2441
you need to run it as root...
 
Old 09-25-2014, 12:25 AM   #5
jojanmpaul
Member
 
Registered: Sep 2012
Location: Bangalore
Posts: 80

Original Poster
Rep: Reputation: Disabled
Hello,

I have done this, with Centos 6.4 and it works fine.

Now am trying in Ubuntu 12.04. Now I am facing issue with the P12 certificate which created using SSL Client.
The P12 Certificate with I created is not working with any of the browser, it shows imported successfully also.
Please help me with some tips.

cat OpenSSL_Client

#!/bin/bash

# #
# This script produces ssl client certificate for the SIS server #
# Arguments required: Client_ID,Serial Number(This should be in double quotes),#
# export password, Validity and Certificate path #
# #
#################################################################################
if [ $# -ne 4 ]
then
echo "Usage: `basename $0` Client_ID Validity Export-Password Certificate_Path "
exit 0
fi

CERT_PATH=$4
CONF_PATH=/var/www/CA

IFS=$'\012'
openssl genrsa -out $CERT_PATH/$1.key 1024
if [ $? -ne 0 ]
then
printf "Command Failure: $? \n"
exit 1
fi
openssl req -subj '/C=IN/ST=cedunetwork.com' -config $CONF_PATH/openssl.cnf -new -key $CERT_PATH/$1.key -out $CERT_PATH/$1.req
if [ $? -ne 0 ]
then
printf "Command Failure: $? \n"
exit 1
fi
#Create random serial number for each client

STRING=`dd if=/dev/urandom count=288 bs=1 2>/dev/null|tr -d -c '[:xdigit:]'|tr "[:upper:]" "[:lower:]"`
STRING=${STRING:0:17}

openssl x509 -req -in $CERT_PATH/$1.req -CA $CONF_PATH/ca.cer -CAkey $CONF_PATH/ca.key -set_serial 0x${STRING} -extfile $CONF_PATH/openssl.cnf -extensions client -days $2 -outform PEM -out $CERT_PATH/$1.cer
if [ $? -ne 0 ]
then
printf "Command Failure: $? \n"
exit 1
fi
openssl pkcs12 -export -inkey $CERT_PATH/$1.key -in $CERT_PATH/$1.cer -out $CERT_PATH/$1.p12 -passout pass:$3 -name "$1_certificate"
if [ $? -ne 0 ]
then
printf "Command Failure: $? \n"
exit 1
fi

ls -l

ca.cer
ca.key
client.p12
index.txt
newcerts
OpenSSL_Client
openssl.cnf
private
serial
server.cer
server.key

Last edited by jojanmpaul; 09-25-2014 at 12:29 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
library missing:No such file or directory error(all files and paths are set properly venky.kv Linux - Newbie 3 03-09-2009 11:49 AM
fopen 2 gb file schneidz Programming 5 10-26-2007 11:24 AM
Is there a C library for searching file system in Linux? fjkum Programming 3 10-03-2007 06:49 AM
fopen a file in home directory Four Programming 2 04-07-2007 05:52 PM
fopen: No such file or directory CatBreath Linux - Software 4 03-27-2005 07:33 AM


All times are GMT -5. The time now is 12:23 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration