diff --git a/setup.php-presetup b/setup.php-presetup
index a864aec..b26ca01 100644
--- a/setup.php-presetup
+++ b/setup.php-presetup
@@ -117,6 +117,12 @@ case 'validate':
if (! $passwd_file) $er .= 'Missing User Password File Location';
if (! $store_dir) $er .= 'Missing Storage Directory
';
+ $countrycode = strtoupper($country);
+
+ if (! preg_match("/\b[A-Z][A-Z]\b/", $countrycode, $match) ) {
+ $er .= 'Country Code must be ISO 3166 two letters
';
+ }
+
if ( $passwd && strlen($passwd) < 8 )
$er .= 'Certificate password is too short.
';
@@ -286,7 +292,8 @@ define('PKCS12', "RANDFILE='\$config[random]' " . OPENSSL . ' pkcs12 ');
define('CA', OPENSSL . ' ca ');
define('REQ', OPENSSL . ' req ');
define('CRL', OPENSSL . ' crl ');
-
+define('DH', OPENSSL . ' dhparam ');
+# define('DH', OPENSSL . ' dhparam ' . "RANDFILE='$config[random]' ");
?>
EOS;
@@ -596,7 +603,7 @@ EOS;
#
print 'Creating root certificate...
';
flush();
-
+ // .rnd created here
exec(REQ . " -x509 -config $tmp_cnf -extensions root_ext -newkey rsa:$keysize -keyout $config[cakey] -out $config[cacert_pem] -passout pass:'$config[ca_pwd]' -days $days 2>&1");
# **** DISABLED *****
@@ -626,13 +633,17 @@ EOS;
# Create dhparam files for OpenVPN and others.
#
print '
Creating 1024 bit Diffie-Hellman parameters used by OpenVPN.
';
- print "Saving to $store_dir/dhparam1024.pem.
";
- $cmd = "openssl dhparam -rand '$config[random]' -out '$config[private_dir]/dhparam1024.pem' 1024";
- print $cmd.'
';
+ print "Saving to $config[private_dir]/dhparam1024.pem.
";
+// $cmd = "openssl dhparam -rand '$config[random]' -out '$config[private_dir]/dhparam1024.pem' 1024";
+// print $cmd.'
';
+ // This works but still the error
+ exec(DH . "-rand '$config[random]' -out '$config[private_dir]/dhparam1024.pem' 1024");
+ // exec(DH . " -out '$config[private_dir]/dhparam1024.pem' 1024");
flush();
- flush_exec($cmd,100);
- print "Please ignore warnings about \"unable to write 'random state'\"
";
+ //flush_exec($cmd,100);
+
+ print "Please ignore warnings about \"unable to write 'random state\'
";
#
# Create a TLS auth key for OpenVPN if openvpn is installed
@@ -794,7 +805,7 @@ E-mail: someone@somewhere.com &nbs