LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 01-24-2006, 10:31 PM   #1
megaspaz
Senior Member
 
Registered: Nov 2002
Location: Silly Con Valley
Distribution: Red Hat 7.3, Red Hat 9.0
Posts: 2,054

Rep: Reputation: 46
Automating openssl certificate generation


Anybody know how to automate the generation of server certificates without user interaction?

Some background:

We're in the process of upgrading our content servers to new hardware and with new OSes. The plan is to recompile webserver/app server/etc. on the new systems. So the plan is to do this once and to then take this configuration and use this for any other content server we want to create. So let's say we want to create 30 content servers, we need to generate 30 server certificates. Hence the question, is it possible to automate this process with no user interaction? These content servers aren't outside facing and are to be used for testing purposes only. I've googled 'automate certificate generation' and didn't see anything really relevent.

Thanks for your time and help.
 
Old 01-25-2006, 07:07 PM   #2
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 344Reputation: 344Reputation: 344Reputation: 344
I'm not sure I understand the problem. You can just create a shell script to create a new certificate. For example:

#!/bin/bash
# Pass the following information to the routine to generate the certificate:
#
# Country Name (2 letter code) [GB]:.
# State or Province Name (full name) [Berkshire]:.
# Locality Name (eg, city) [Newbury]:.
# Organization Name (eg, company) [My Company Ltd]:.
# Organizational Unit Name (eg, section) []:.
# Common Name (eg, your name or your server's hostname) []:.
# Email Address []:.

umask 77 ; echo "$COUNTRY
$STATE
$CITY
$ORG
$UNIT
$HOST
$IP
$IP
$EMAIL" | /usr/bin/openssl req -new -key /etc/httpd/conf/ssl.key/server.key -x509 -days 365 -out /etc/httpd/conf/ssl.crt/server.crt >/dev/null
 
Old 01-25-2006, 08:53 PM   #3
megaspaz
Senior Member
 
Registered: Nov 2002
Location: Silly Con Valley
Distribution: Red Hat 7.3, Red Hat 9.0
Posts: 2,054

Original Poster
Rep: Reputation: 46
yeah. I'm looking for something like that. I just don't know how to go about passing in the information. Is what you posted below what the script is supposed to look like? And can you explain how your script works?

Thanks.
 
Old 01-25-2006, 10:10 PM   #4
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 344Reputation: 344Reputation: 344Reputation: 344
All it does is "queue up" the responses that the openssl is going to be asking for. The $ variables are just placeholders for the information. Let's say you call the script "makenewcert" and change it to:

#!/bin/bash
# Pass the following information to the routine to generate the certificate:
#
# $1 = Country Name (2 letter code) [GB]:.
# $2 = State or Province Name (full name) [Berkshire]:.
# $3 = Locality Name (eg, city) [Newbury]:.
# $4 = Organization Name (eg, company) [My Company Ltd]:.
# $5 = Organizational Unit Name (eg, section) []:.
# $6 = Common Name (eg, your name or your server's hostname) []:.
# $7 = IP address
# $8 = Email Address []:.

umask 77 ; echo "$1
$2
$3
$4
$5
$6
$7
$7
$8" | /usr/bin/openssl req -new -key /etc/httpd/conf/ssl.key/server.key -x509 -days 365 -out /etc/httpd/conf/ssl.crt/server.crt >/dev/null


You can then call it and pass the information as parameters. For example:

makenewcert "US" "New Jersey" "Newark" "My Company" "IT" "myserver.com" "123.45.67.89" "webmaster@myserver.com"
 
Old 08-20-2012, 02:42 PM   #5
spkane
LQ Newbie
 
Registered: Feb 2011
Posts: 2

Rep: Reputation: 0
create cert with no prompting

something like this works well:

openssl req -config ssl.cnf -new -x509 -subj "/C=US/ST=Oregon/L=Portland/O=IT/CN=www.example.com" -days 3650 -key cert.key -out cert.crt -extensions v3_ca

The -subj being the important part here.
 
  


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
why can't i generate a new certificate with openssl? achouramira Linux - Security 3 04-18-2019 05:51 PM
OpenSSL + Apache certificate, how? The_Nerd Linux - Software 2 12-26-2004 09:18 PM
certificate generation and FreeRADIUS setup ahuebel Linux - Wireless Networking 1 12-19-2003 05:01 PM
Thawte Certificate and OpenSSL jqcaducifer Linux - Security 5 10-16-2003 06:43 PM
Certificate with OpenSSL gr33ndata Linux - Security 3 10-03-2003 07:39 AM

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

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