From c8e5a8aaf316638dc3223bd8109116b0dd94c861 Mon Sep 17 00:00:00 2001 From: John Crisp Date: Sat, 29 Feb 2020 19:55:11 +0100 Subject: [PATCH] Modify openvpn check. Add more vars to config --- setup.php-presetup | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/setup.php-presetup b/setup.php-presetup index 0a8c736..70a3ff4 100644 --- a/setup.php-presetup +++ b/setup.php-presetup @@ -22,7 +22,7 @@ function flush_exec($command, $line_length=200) { } } print $line."
\n"; - flush; + flush(); return; } @@ -86,12 +86,12 @@ $hidden_fields = ' - - - - - - + + + + + + @@ -104,7 +104,6 @@ switch ($stage) { case 'validate': $er = ''; - if (! $country) $er .= 'Missing Country
'; if (! $province) $er .= 'Missing State/Province
'; if (! $locality) $er .= 'Missing Locality
'; @@ -116,8 +115,7 @@ case 'validate': if (! $passwdv) $er .= 'Missing Certificate Password Verification "Again"
'; if (! $header_title) $er .= 'Missing Header Title
'; if (! $passwd_file) $er .= 'Missing User Password File Location'; - if (! $store_dir) $er .= 'Missing Storage Directory
'; - + if (! $store_dir) $er .= 'Missing Storage Directory
'; if ( $passwd && strlen($passwd) < 8 ) $er .= 'Certificate password is too short.
'; @@ -631,17 +629,21 @@ EOS; print "Saving to $store_dir/dhparam1024.pem.
"; $cmd = "openssl dhparam -rand '$config[random]' -out '$config[private_dir]/dhparam1024.pem' 1024"; print $cmd.'
'; + flush(); flush_exec($cmd,100); # - # Create a TLS auth key for OpenVPN. + # Create a TLS auth key for OpenVPN if openvpn is installed # - if (function_exists('openvpn')) { + $command = 'which openvpn'; + $command = escapeshellcmd($command); + + if (system ($command) == '/usr/sbin/openvpn') { print '

Creating a TLS authentication key used by OpenVPN.
'; print "Saving to $store_dir/takey.pem.

"; - $cmd = "openvpn --genkey --secret '$config[private_dir]/takey.pem'"; + $cmd = $command . " --genkey --secret '$config[private_dir]/takey.pem'"; print $cmd.'
'; flush(); flush_exec($cmd); @@ -812,7 +814,7 @@ E-mail: someone@somewhere.com &nbs