I want to deploy the OpenVPN server to many PC, and I want to use the different Server key and certificate on each server. When I generate a key+cert I have to manually interact with the console, putting the information, answer to confirmation question, sort of that.
Is there a way to generate key and cert automatically by using a script or something with out human involve?
I design to use the same ca for every server but different server key and cert. And the authentication method that I use is user/pass only so the client cert is not concerned.
Regards
Generate key and Certificate automatically ?
Moderators: TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech
Forum rules
Please use the [oconf] BB tag for openvpn Configurations. See viewtopic.php?f=30&t=21589 for an example.
Please use the [oconf] BB tag for openvpn Configurations. See viewtopic.php?f=30&t=21589 for an example.
-
- OpenVpn Newbie
- Posts: 8
- Joined: Sat Feb 26, 2011 4:06 am
- maikcat
- Forum Team
- Posts: 4200
- Joined: Wed Jan 12, 2011 9:23 am
- Location: Athens,Greece
- Contact:
Re: Generate key and Certificate automatically ?
Amiga 500 , Zx +2 owner
Long live Dino Dini (Kick off 2 Creator)
Inflammable means flammable? (Dr Nick Riviera,Simsons Season13)
"objects in mirror are losing"
Long live Dino Dini (Kick off 2 Creator)
Inflammable means flammable? (Dr Nick Riviera,Simsons Season13)
"objects in mirror are losing"
- Bebop
- Forum Team
- Posts: 301
- Joined: Wed Dec 15, 2010 9:24 pm
Re: Generate key and Certificate automatically ?
[Edit] You want to deploy many servers. I mistook your intention for something else. The following code may still be of some use.
If Linux, here's the code for generating keys. As for anything else you need to do.. all the command line tools are in /etc/openvpn/easy-rsa/2.0
that will generate a .key and .crt.
it was designed for generating client key and crts. Not sure if it will work for server key and crts too.
If Linux, here's the code for generating keys. As for anything else you need to do.. all the command line tools are in /etc/openvpn/easy-rsa/2.0
Code: Select all
#!/bin/bash
#
#$1 hold the cmd line argument
#A unique server name is what you should pass here
#
server_name=$1
#
#if no cmd line, exit.
#
if [ x$server_name = x ]; then
echo "Usage: $0 servername"
exit 1
fi
#
#change to the working directory
#
cd /etc/openvpn/easy-rsa/2.0
#
#generate a new key in this dir
#
if [ ! -e ./keys/$server_name.key ]; then
echo "Generating keys..."
. vars
./pkitool $server_name
echo "...keys generated [1]."
fi
it was designed for generating client key and crts. Not sure if it will work for server key and crts too.
The cure for boredom is curiosity
- janjust
- Forum Team
- Posts: 2703
- Joined: Fri Aug 20, 2010 2:57 pm
- Location: Amsterdam
- Contact:
Re: Generate key and Certificate automatically ?
to follow up on BeBop's post: run
to see the list of available options. It's perfectly well possible to generate a server cert on the fly:
etc. However, auto-generating certificates _IS_ a security risk : how will you prevent abuse/misuse?
Code: Select all
pkitool --help
Code: Select all
pkitool --server $server_name
-
- OpenVpn Newbie
- Posts: 8
- Joined: Sat Feb 26, 2011 4:06 am
Re: Generate key and Certificate automatically ?
A lot of useful information. Thank you guys very much 
