@@ -170,30 +170,34 @@ function ssl($event_name, $data) {
170170
171171 $ rand_file = escapeshellcmd ($ rand_file );
172172 $ key_file = escapeshellcmd ($ key_file );
173+ $ openssl_cmd_key_file = $ key_file ;
173174 if (substr ($ domain , 0 , 2 ) == '*. ' && strpos ($ key_file , '/ssl/\*. ' ) !== false ) $ key_file = str_replace ('/ssl/\*. ' , '/ssl/*. ' , $ key_file ); // wildcard certificate
174175 $ key_file2 = escapeshellcmd ($ key_file2 );
176+ $ openssl_cmd_key_file2 = $ key_file2 ;
175177 if (substr ($ domain , 0 , 2 ) == '*. ' && strpos ($ key_file2 , '/ssl/\*. ' ) !== false ) $ key_file2 = str_replace ('/ssl/\*. ' , '/ssl/*. ' , $ key_file2 ); // wildcard certificate
176178 $ ssl_days = 3650 ;
177179 $ csr_file = escapeshellcmd ($ csr_file );
180+ $ openssl_cmd_csr_file = $ csr_file ;
178181 if (substr ($ domain , 0 , 2 ) == '*. ' && strpos ($ csr_file , '/ssl/\*. ' ) !== false ) $ csr_file = str_replace ('/ssl/\*. ' , '/ssl/*. ' , $ csr_file ); // wildcard certificate
179182 $ config_file = escapeshellcmd ($ ssl_cnf_file );
180183 $ crt_file = escapeshellcmd ($ crt_file );
184+ $ openssl_cmd_crt_file = $ crt_file ;
181185 if (substr ($ domain , 0 , 2 ) == '*. ' && strpos ($ crt_file , '/ssl/\*. ' ) !== false ) $ crt_file = str_replace ('/ssl/\*. ' , '/ssl/*. ' , $ crt_file ); // wildcard certificate
182186
183187 if (is_file ($ ssl_cnf_file ) && !is_link ($ ssl_cnf_file )) {
184188
185- exec ("openssl genrsa -des3 -rand $ rand_file -passout pass: $ ssl_password -out $ key_file 2048 " );
186- exec ("openssl req -new -passin pass: $ ssl_password -passout pass: $ ssl_password -key $ key_file -out $ csr_file -days $ ssl_days -config $ config_file " );
187- exec ("openssl rsa -passin pass: $ ssl_password -in $ key_file -out $ key_file2 " );
189+ exec ("openssl genrsa -des3 -rand $ rand_file -passout pass: $ ssl_password -out $ openssl_cmd_key_file 2048 " );
190+ exec ("openssl req -new -passin pass: $ ssl_password -passout pass: $ ssl_password -key $ openssl_cmd_key_file -out $ openssl_cmd_csr_file -days $ ssl_days -config $ config_file " );
191+ exec ("openssl rsa -passin pass: $ ssl_password -in $ openssl_cmd_key_file -out $ openssl_cmd_key_file2 " );
188192
189193 if (file_exists ($ web_config ['CA_path ' ].'/openssl.cnf ' ))
190194 {
191- exec ("openssl ca -batch -out $ crt_file -config " .$ web_config ['CA_path ' ]."/openssl.cnf -passin pass: " .$ web_config ['CA_pass ' ]." -in $ csr_file " );
195+ exec ("openssl ca -batch -out $ openssl_cmd_crt_file -config " .$ web_config ['CA_path ' ]."/openssl.cnf -passin pass: " .$ web_config ['CA_pass ' ]." -in $ openssl_cmd_csr_file " );
192196 $ app ->log ("Creating CA-signed SSL Cert for: $ domain " , LOGLEVEL_DEBUG );
193- if (filesize ($ crt_file )==0 || !file_exists ($ crt_file )) $ app ->log ("CA-Certificate signing failed. openssl ca -out $ crt_file -config " .$ web_config ['CA_path ' ]."/openssl.cnf -passin pass: " .$ web_config ['CA_pass ' ]." -in $ csr_file " , LOGLEVEL_ERROR );
197+ if (filesize ($ crt_file )==0 || !file_exists ($ crt_file )) $ app ->log ("CA-Certificate signing failed. openssl ca -out $ openssl_cmd_crt_file -config " .$ web_config ['CA_path ' ]."/openssl.cnf -passin pass: " .$ web_config ['CA_pass ' ]." -in $ openssl_cmd_csr_file " , LOGLEVEL_ERROR );
194198 };
195199 if (@filesize ($ crt_file )==0 || !file_exists ($ crt_file )){
196- exec ("openssl req -x509 -passin pass: $ ssl_password -passout pass: $ ssl_password -key $ key_file -in $ csr_file -out $ crt_file -days $ ssl_days -config $ config_file " );
200+ exec ("openssl req -x509 -passin pass: $ ssl_password -passout pass: $ ssl_password -key $ openssl_cmd_key_file -in $ openssl_cmd_csr_file -out $ openssl_cmd_crt_file -days $ ssl_days -config $ config_file " );
197201 $ app ->log ("Creating self-signed SSL Cert for: $ domain " , LOGLEVEL_DEBUG );
198202 };
199203
@@ -274,7 +278,7 @@ function ssl($event_name, $data) {
274278 //$bundle_file = $ssl_dir.'/'.$domain.'.bundle';
275279 if (file_exists ($ web_config ['CA_path ' ].'/openssl.cnf ' ) && !is_link ($ web_config ['CA_path ' ].'/openssl.cnf ' ))
276280 {
277- exec ("openssl ca -batch -config " .$ web_config ['CA_path ' ]."/openssl.cnf -passin pass: " .$ web_config ['CA_pass ' ]." -revoke $ crt_file" );
281+ exec ("openssl ca -batch -config " .$ web_config ['CA_path ' ]."/openssl.cnf -passin pass: " .$ web_config ['CA_pass ' ]." -revoke " . escapeshellcmd ( $ crt_file) );
278282 $ app ->log ("Revoking CA-signed SSL Cert for: $ domain " , LOGLEVEL_DEBUG );
279283 };
280284 $ app ->system ->unlink ($ csr_file );
0 commit comments