Fix /dev/urandom usage on unprivileged LXC containers

Fixes https://github.com/angristan/openvpn-install/issues/280
This commit is contained in:
angristan 2018-09-02 22:32:58 +02:00
parent c923ad1ea2
commit ea40b45b52
1 changed files with 2 additions and 2 deletions

View File

@ -539,8 +539,8 @@ WantedBy=multi-user.target" > /etc/systemd/system/iptables.service
rm -f ~/EasyRSA-3.0.4.tgz
cd /etc/openvpn/easy-rsa/ || return
# Generate a random, alphanumeric identifier of 16 characters for CN and one for server name
SERVER_CN="cn_$(tr -dc 'a-zA-Z0-9' < /dev/urandom | fold -w 16 | head -n 1)"
SERVER_NAME="server_$(tr -dc 'a-zA-Z0-9' < /dev/urandom | fold -w 16 | head -n 1)"
SERVER_CN="cn_$(head /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 16 | head -n 1)"
SERVER_NAME="server_$(head /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 16 | head -n 1)"
echo "set_var EASYRSA_KEY_SIZE $RSA_KEY_SIZE" > vars
echo "set_var EASYRSA_REQ_CN $SERVER_CN" >> vars
# Create the PKI, set up the CA, the DH params and the server + client certificates