Hi,
I assume this question was already asked, but I haven't been able to find any topic yet ..
So here is what I'm trying to do.
I basically want to create a certificate for OpenVPN, but fully automatize this process. Right now, people log in to a webportal and generate their cert. It works, but I now want to integrate a passphrase.
Here is my script
exec("export EASY_RSA='/etc/openvpn/easy-rsa';
export OPENSSL=openssl;
export PKCS11TOOL=pkcs11-tool;
export GREP=grep;
export KEY_CONFIG=/etc/openvpn/easy-rsa/openssl.cnf;
export KEY_DIR=/etc/openvpn/easy-rsa/keys;
export PKCS11_MODULE_PATH=dummy;
export PKCS11_PIN=dummy;
export KEY_SIZE=1024;
export CA_EXPIRE=3650;
export KEY_EXPIRE=3650;
export KEY_COUNTRY=$_POST['C'];
export KEY_PROVINCE=$_POST['ST'];
export KEY_CITY=$_POST['C'];
export KEY_ORG=$_POST['CO'];
export KEY_EMAIL=$_POST['CN'];
export KEY_CN=xxxx;
export KEY_NAME=xx;
export KEY_OU=xxxx;
export PKCS11_MODULE_PATH=changeme;
export PKCS11_PIN=1234;
/etc/openvpn/easy-rsa/build-key $CN")
When I execute my script (php), here is what I get
Generating a 1024 bit RSA private key
...............................++++++
.............++++++
writing new private key to 'mykey.key'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [US]:problems making Certificate Request
So my exports are working fine [US], but my script got killed because it's waiting for an user input (press Enter..)
I wondering if there is a way to automatically force the certificate to be created with the default values I've passed with my $_POST?
As an addition, how can I specify a password automatically suing ./build-req-pass ?
Thanks 🙂