3 * This page is used to setup https access to OpenEMR with client certificate authentication.
4 * If enabled, the browser must connect to OpenEMR using a client SSL certificate that is
5 * generated by OpenEMR. This page is used to create the Certificate Authority and
6 * Apache SSL server certificate.
9 * @link http://www.open-emr.org
10 * @author Visolve (vicareplus_engg@visolve.com)
11 * @author Brady Miller <brady.g.miller@gmail.com>
12 * @copyright Copyright (c) Visolve (vicareplus_engg@visolve.com)
13 * @copyright Copyright (c) 2018 Brady Miller <brady.g.miller@gmail.com>
14 * @license https://github.com/openemr/openemr/blob/master/LICENSE CNU General Public License 3
18 require_once("../globals.php");
19 require_once("../../library/create_ssl_certificate.php");
22 if (!verifyCsrfToken($_POST["csrf_token_form"])) {
27 /* This string contains any error messages if generating
32 /* This function is called when the "Save Certificate Settings" button is clicked.
33 * Save the certificate settings to the file globals.php.
34 * The following form inputs are used:
35 * cakey_location - The path to the CA key file
36 * cacrt_location - The path to the CA certificate file
37 * clientCertValidity_hidden - Number of days client certificates are valid.
38 * isClientAuthenticationEnabled - Enable/disable client certificate authentication.
40 * Save these values to the following variables in globals.php:
41 * $certificate_authority_key
42 * $certificate_authority_crt
43 * $client_certificate_valid_in_days
44 * $is_client_ssl_enabled
46 * If an error occurs, set $error_msg to the appropriate string,
47 * which will be displayed later on below.
49 /*function save_certificate_settings() {
50 if($_POST['cakey_location']) { $Authority_key = trim($_POST['cakey_location']); }
51 if($_POST['cacrt_location']) { $Authority_crt = trim($_POST['cacrt_location']); }
52 if($_POST['clientCertValidity_hidden']) { $clientCertValidity = trim($_POST['clientCertValidity_hidden']); }
53 if($_POST['isClientAuthenticationEnabled']) { $isClientAuthenticationEnabled = trim($_POST['isClientAuthenticationEnabled']); }
55 if ($isClientAuthenticationEnabled == "Yes") {
56 $isClientAuthenticationEnabled = "true";
58 $isClientAuthenticationEnabled = "false";
63 if ($Authority_key != "" && !file_exists($Authority_key)) {
64 $error_msg .= xl('Error: the file does not exist') . ' ' . $Authority_key . '<br>';
67 if ($Authority_crt != "" && !file_exists($Authority_crt)) {
68 $error_msg .= xl('Error, the file does not exist') . ' ' . $Authority_crt . '<br>';
71 if ($error_msg != "") {
75 $Authority_key = str_replace('\\\\', '/', $Authority_key);
76 $Authority_key = str_replace('\\', '/', $Authority_key);
77 $Authority_crt = str_replace('\\\\', '/', $Authority_crt);
78 $Authority_crt = str_replace('\\', '/', $Authority_crt);
80 // Read in the globals.php file
81 $globals_file = $GLOBALS['fileroot'] . "/interface/globals.php";
82 $inputdata = file($globals_file) or die( xlt('Could not read file')." ". text($globals_file));
87 $wrote_enable = false;
88 $wrote_validity = false;
90 // Loop through each line in globals.php, replacing any certificate variables with the new settings.
92 foreach ($inputdata as $line) {
93 if ((strpos($line,"\$certificate_authority_key = \"")) !== false) {
95 $outputdata .= "\$certificate_authority_key = \"$Authority_key\";\n";
97 else if ((strpos($line,"\$certificate_authority_crt = \"")) !== false) {
99 $outputdata .= "\$certificate_authority_crt = \"$Authority_crt\";\n";
101 else if ((strpos($line,"\$is_client_ssl_enabled = ")) !== false) {
102 $wrote_enable = true;
103 $outputdata .= "\$is_client_ssl_enabled = $isClientAuthenticationEnabled;\n";
105 else if ((strpos($line,"\$client_certificate_valid_in_days = \"")) !== false) {
106 $wrote_validity = true;
107 $outputdata .= "\$client_certificate_valid_in_days = \"$clientCertValidity\";\n";
110 $outputdata .= $line;
113 if ($wrote_key === false || $wrote_crt === false ||
114 $wrote_enable === false || $wrote_validity === false) {
116 $outputdata .= "<?php\n";
118 if ($wrote_key === false) {
119 $outputdata .= "\$certificate_authority_key = \"$Authority_key\";\n";
121 if ($wrote_crt == false) {
122 $outputdata .= "\$certificate_authority_crt = \"$Authority_crt\";\n";
124 if ($wrote_enable === false) {
125 $outputdata .= "\$is_client_ssl_enabled = $isClientAuthenticationEnabled;\n";
127 if ($wrote_validity === false) {
128 $outputdata .= "\$client_certificate_valid_in_days = \"$clientCertValidity\";\n";
130 $outputdata .= "\n?>\n";
133 // Write the modified globals.php back to disk
134 $fd = @fopen($globals_file, 'w');
136 $error_msg .= xl('Error, unable to open file') . ' ' . $globals_file;
139 fwrite($fd, $outputdata);
142 $GLOBALS['is_client_ssl_enabled'] = ($isClientAuthenticationEnabled == "true");
143 $GLOBALS['certificate_authority_crt'] = $Authority_crt;
144 $GLOBALS['certificate_authority_key'] = $Authority_key;
149 * Send an http reply so that the browser downloads the given file.
150 * Delete the file once the download is completed.
151 * @param $filename - The file to download.
152 * @param $filetype - The type of file.
154 function download_file($filename, $filetype)
157 header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
158 header("Cache-Control: private");
159 header("Content-Type: application/" . $filetype);
160 header("Content-Disposition: attachment; filename=" . basename($filename) . ";");
161 header("Content-Transfer-Encoding: binary");
162 header("Content-Length: " . filesize($filename));
169 /* This function is called when the "Create Client Certificate" button is clicked.
170 * Create and download a client certificate, given the following form inputs:
171 * client_cert_user - The username to store in the certificate
172 * client_cert_email - The email to store in the certificate
173 * A temporary certificate will be written to /tmp/openemr_client_cert.p12.
174 * If an error occurs, set the $error_msg (which is displayed later below).
176 function create_client_cert()
180 if (!$GLOBALS['is_client_ssl_enabled']) {
181 $error_msg .= xl('Error, User Certificate Authentication is not enabled in OpenEMR');
184 if (!file_exists($GLOBALS['certificate_authority_crt'])) {
185 $error_msg .= xl('Error, the CA Certificate File doesn\'t exist');
188 if (!file_exists($GLOBALS['certificate_authority_key'])) {
189 $error_msg .= xl('Error, the CA Key File doesn\'t exist');
193 if ($_POST["client_cert_user"]) {
194 $user = trim($_POST['client_cert_user']);
197 if ($_POST["client_cert_email"]) {
198 $email = trim($_POST['client_cert_email']);
201 $opensslconf = $GLOBALS['fileroot'] . "/library/openssl.cnf";
203 $data = create_user_certificate(
207 $GLOBALS['certificate_authority_crt'],
208 $GLOBALS['certificate_authority_key'],
209 $GLOBALS['client_certificate_valid_in_days']
211 if ($data === false) {
212 $error_msg .= xl('Error, unable to create client certificate.');
216 $filename = $GLOBALS['temporary_files_dir'] . "/openemr_client_cert.p12";
217 $handle = fopen($filename, 'w');
218 fwrite($handle, $data);
221 download_file($filename, "p12");
224 /* Delete the following temporary certificate files, if they exist:
225 * /tmp/CertificateAuthority.key
226 * /tmp/CertificateAuthority.crt
232 function delete_certificates()
234 $tempDir = $GLOBALS['temporary_files_dir'];
235 $files = array("CertificateAuthority.key", "CertificateAuthority.crt",
236 "Server.key", "Server.crt", "admin.p12", "ssl.zip");
238 foreach ($files as $file) {
239 if (file_exists($file)) {
246 * Create and download the following certificates:
247 * - CertificateAuthority.key
248 * - CertificateAuthority.crt
252 * The following form inputs are used:
254 function create_and_download_certificates()
257 $tempDir = $GLOBALS['temporary_files_dir'];
259 $zipName = $tempDir . "/ssl.zip";
260 if (file_exists($zipName)) {
265 $emailAddress = false;
266 $countryName = false;
267 $stateOrProvinceName = false;
268 $localityName = false;
269 $organizationName = false;
270 $organizationalUnitName = false;
271 $clientCertValidity = false;
273 /* Retrieve the certificate name settings from the form input */
274 if ($_POST["commonName"]) {
275 $commonName = trim($_POST['commonName']);
278 if ($_POST["emailAddress"]) {
279 $emailAddress = trim($_POST['emailAddress']);
282 if ($_POST["countryName"]) {
283 $countryName = trim($_POST['countryName']);
286 if ($_POST["stateOrProvinceName"]) {
287 $stateOrProvinceName = trim($_POST['stateOrProvinceName']);
290 if ($_POST["localityName"]) {
291 $localityName = trim($_POST['localityName']);
294 if ($_POST["organizationName"]) {
295 $organizationName = trim($_POST['organizationName']);
298 if ($_POST["organizationalUnitName"]) {
299 $organizationName = trim($_POST['organizationalUnitName']);
302 if ($_POST["clientCertValidity"]) {
303 $clientCertValidity = trim($_POST['clientCertValidity']);
307 /* Create the Certficate Authority (CA) */
309 "OpenEMR CA for " . $commonName,
312 $stateOrProvinceName,
315 $organizationalUnitName
318 if ($arr === false) {
319 $error_msg .= xl('Error, unable to create the Certificate Authority certificate.');
320 delete_certificates();
327 $ca_crt = create_crt($ca_csr, null, $ca_key);
328 if ($ca_crt === false) {
329 $error_msg .= xl('Error, unable to create the Certificate Authority certificate.');
330 delete_certificates();
334 openssl_pkey_export_to_file($ca_key, $tempDir . "/CertificateAuthority.key", null, $config);
335 openssl_x509_export_to_file($ca_crt, $tempDir . "/CertificateAuthority.crt");
337 /* Create the Server certificate */
342 $stateOrProvinceName,
345 $organizationalUnitName
347 if ($arr === false) {
348 $error_msg .= xl('Error, unable to create the Server certificate.');
349 delete_certificates();
353 $server_csr = $arr[0];
354 $server_key = $arr[1];
356 $server_crt = create_crt($server_csr, $ca_crt, $ca_key);
358 if ($server_crt === false) {
359 $error_msg .= xl('Error, unable to create the Server certificate.');
360 delete_certificates();
364 openssl_pkey_export_to_file($server_key, $tempDir . "/Server.key", null, $config);
365 openssl_x509_export_to_file($server_crt, $tempDir . "/Server.crt");
367 /* Create the client certificate for the 'admin' user */
369 $res = sqlStatement("select id from users where username='admin'");
370 if ($row = sqlFetchArray($res)) {
371 $serial = $row['id'];
374 $user_cert = create_user_certificate(
378 $tempDir . "/CertificateAuthority.crt",
379 $tempDir . "/CertificateAuthority.key",
382 if ($user_cert === false) {
383 $error_msg .= xl('Error, unable to create the admin.p12 certificate.');
384 delete_certificates();
388 $adminFile = $tempDir . "/admin.p12";
389 $handle = fopen($adminFile, 'w');
390 fwrite($handle, $user_cert);
393 /* Create a zip file containing the CertificateAuthority, Server, and admin files */
395 if (! (class_exists('ZipArchive'))) {
396 $_SESSION["zip_error"]="Error, Class ZipArchive does not exist";
400 $zip = new ZipArchive
;
402 $_SESSION["zip_error"]="Error, Could not create file archive";
406 if ($zip->open($zipName, ZIPARCHIVE
::CREATE
)) {
407 $files = array("CertificateAuthority.key", "CertificateAuthority.crt",
408 "Server.key", "Server.crt", "admin.p12");
409 foreach ($files as $file) {
410 $zip->addFile($tempDir . "/" . $file, $file);
413 $_SESSION["zip_error"]="Error, unable to create zip file with all the certificates";
419 if (ini_get('zlib.output_compression')) {
420 ini_set('zlib.output_compression', 'Off');
422 } catch (Exception
$e) {
423 $_SESSION["zip_error"]="Error, Could not create file archive";
427 download_file($zipName, "zip");
432 if (!acl_check('admin', 'users')) {
436 /*if ($_POST["mode"] == "save_ssl_settings") {
437 save_certificate_settings();
440 if ($_POST["mode"] == "create_client_certificate") {
441 create_client_cert();
442 } else if ($_POST["mode"] == "download_certificates") {
443 create_and_download_certificates();
450 <script language
="Javascript">
453 /* If Enable User Certificate Authentication is set to "Yes", check the following:
454 * - The Client certificate validation period is > 0
455 * - The CertificateAuthority.key path is not empty
456 * - The CertificateAuthority.crt path is not empty
458 /*function save_click() {
459 if (document.ssl_frm.isClientAuthenticationEnabled[0].checked) {
460 if(document.ssl_certificate_frm.clientCertValidity.value > 0) {
461 document.ssl_frm.clientCertValidity_hidden.value = document.ssl_certificate_frm.clientCertValidity.value;
464 alert (<?php xlj('Client certificate validity should be a valid number.'); ?>);
465 document.ssl_certificate_frm.clientCertValidity.focus();
468 if (document.ssl_frm.cakey_location.value == "") {
469 alert (<?php xlj('Certificate Authority key file location cannot be empty'); ?>);
470 document.ssl_frm.cakey_location.focus();
474 if (document.ssl_frm.cacrt_location.value == "") {
475 alert (<?php xlj('Certificate Authority crt file location cannot be empty'); ?>);
476 document.ssl_frm.cacrt_location.focus();
483 //check whether email id is valid or not
484 function checkEmail(email
) {
488 var lat
=str
.indexOf(at
);
490 var ldot
=str
.indexOf(dot
);
491 if (str
.indexOf(at
)==-1){
495 if (str
.indexOf(at
)==-1 || str
.indexOf(at
)==0 || str
.indexOf(at
)==lstr
){
499 if (str
.indexOf(dot
)==-1 || str
.indexOf(dot
)==0 || str
.indexOf(dot
)==lstr
){
503 if (str
.indexOf(at
,(lat+
1))!=-1){
507 if (str
.substring(lat
-1,lat
)==dot || str
.substring(lat+
1,lat+
2)==dot
){
511 if (str
.indexOf(dot
,(lat+
2))==-1){
515 if (str
.indexOf(" ")!=-1){
521 function download_click(){
522 if (document
.ssl_certificate_frm
.commonName
.value
== "") {
523 alert (<?php
xlj('Host Name cannot be empty'); ?
>);
524 document
.ssl_certificate_frm
.commonName
.focus();
528 if (document
.ssl_certificate_frm
.emailAddress
.value
) {
529 //call checkEmail function
530 if(checkEmail(document
.ssl_certificate_frm
.emailAddress
.value
) == false){
531 alert (<?php
xlj('Provide valid Email Address'); ?
>);
536 if (document
.ssl_certificate_frm
.countryName
.value
.length
> 2) {
537 alert (<?php
xlj('Country Name should be represent in two letters. (Example: United States is US)'); ?
>);
538 document
.ssl_certificate_frm
.countryName
.focus();
541 if (document
.ssl_certificate_frm
.clientCertValidity
.value
< 1) {
542 alert (<?php
xlj('Client certificate validity should be a valid number.'); ?
>);
543 document
.ssl_certificate_frm
.clientCertValidity
.focus();
547 function create_client_certificate_click(){
549 /*if(document.ssl_frm.isClientAuthenticationEnabled[1].checked == true)
551 alert (<?php xlj('User Certificate Authentication is disabled'); ?>);
555 if (document
.client_cert_frm
.client_cert_user
.value
== "") {
556 alert (<?php
xlj('User name or Host name cannot be empty'); ?
>);
557 document
.ssl_certificate_frm
.commonName
.focus();
560 if (document
.client_cert_frm
.client_cert_email
.value
) {
561 //call checkEmail function
562 if(checkEmail(document
.client_cert_frm
.client_cert_email
.value
) == false){
563 alert (<?php
xlj('Provide valid Email Address'); ?
>);
569 function isNumberKey(evt
) {
570 var charCode
= (evt
.which
) ? evt
.which
: evt
.keyCode
571 if (charCode
> 31 && (charCode
< 48 || charCode
> 57))
579 <link rel
="stylesheet" href
="<?php echo $css_header;?>" type
="text/css">
580 <style type
="text/css">
590 <body
class="body_top">
591 <span
class='title'><b
><?php
echo xlt('SSL Certificate Administration'); ?
></b
></span
>
593 <?php
if ($_SESSION["zip_error"]) { ?
>
594 <div
> <table align
="center" >
595 <tr valign
="top"> <td rowspan
="3"> <?php
echo "<font class='redtext'>" . xlt($_SESSION["zip_error"]) ?
> </td
> </tr
>
597 unset($_SESSION["zip_error"]); ?
></div
>
601 if ($error_msg != "") {
602 echo "<font class='redtext'>" . text($error_msg) . "</font><br><br>";
605 <?php
echo xlt('To setup https access with client certificate authentication, do the following'); ?
>
607 <li
><?php
echo xlt('Create the SSL Certificate Authority and Server certificates.'); ?
>
608 <li
><?php
echo xlt('Configure Apache to use HTTPS.'); ?
>
609 <li
><?php
echo xlt('Configure Apache and OpenEMR to use Client side SSL certificates.'); ?
>
610 <li
><?php
echo xlt('Import certificate to the browser.'); ?
>
611 <li
><?php
echo xlt('Create a Client side SSL certificate for each user or client machine.'); ?
>
615 if ($GLOBALS['certificate_authority_crt'] != "" && $GLOBALS['is_client_ssl_enabled']) {
616 echo xlt('OpenEMR already has a Certificate Authority configured.');
619 <form method
='post' name
=ssl_certificate_frm action
='ssl_certificates_admin.php'>
620 <input type
="hidden" name
="csrf_token_form" value
="<?php echo attr(collectCsrfToken()); ?>" />
621 <input type
='hidden' name
='mode' value
='download_certificates'>
622 <div
class='borderbox'>
623 <b
><?php
echo xlt('Create the SSL Certificate Authority and Server certificates.'); ?
></b
><br
>
625 1. <?php
echo xlt('Fill in the values below'); ?
><br
>
626 2. <?php
echo xlt('Click Download Certificate to download the certificates in the file ssl.zip'); ?
> <br
>
627 3. <?php
echo xlt('Extract the zip file');
628 echo ": ssl.zip "; ?
><br
></br
>
629 <?php
echo xlt('The zip file will contain the following items'); ?
> <br
>
631 <li
>Server
.crt
: <?php
echo xlt('The Apache SSL server certificate and public key'); ?
>
632 <li
>Server
.key
: <?php
echo xlt('The corresponding private key'); ?
>
633 <li
>CertificateAuthority
.crt
: <?php
echo xlt('The Certificate Authority certificate'); ?
>
634 <li
>CertificateAuthority
.key
: <?php
echo xlt('The corresponding private key'); ?
>
635 <li
>admin
.p12
: <?php
echo xlt('A client certificate for the admin user'); ?
>
639 <td
><?php
echo xlt('Host Name'); ?
> *:</td
>
640 <td
><input name
='commonName' type
='text' value
=''></td
>
641 <td
><?php
echo xlt('Example') ;
642 echo ': hostname.domain.com'; ?
></td
>
645 <td
><?php
echo xlt('Email Address'); ?
>:</td
>
646 <td
><input name
='emailAddress' type
='text' value
=''></td
>
647 <td
><?php
echo xlt('Example') ;
648 echo ': web_admin@domain.com'; ?
></td
>
651 <td
><?php
echo xlt('Organization Name'); ?
>:</td
>
652 <td
><input name
='organizationName' type
='text' value
=''></td
>
653 <td
><?php
echo xlt('Example');
654 echo ': My Company Ltd'; ?
></td
>
657 <td
><?php
echo xlt('Organizational Unit Name'); ?
>:</td
>
658 <td
><input name
='organizationalUnitName' type
='text' value
=''></td
>
659 <td
><?php
echo xlt('Example');
660 echo ': OpenEMR'; ?
></td
>
663 <td
><?php
echo xlt('Locality'); ?
>:</td
>
664 <td
><input name
='localityName' type
='text' value
=''></td
>
665 <td
><?php
echo xlt('Example') ;
666 echo ': City'; ?
></td
>
669 <td
><?php
echo xlt('State Or Province'); ?
>:</td
>
670 <td
><input name
='stateOrProvinceName' type
='text' value
=''></td
>
671 <td
><?php
echo xlt('Example') ;
672 echo ': California'; ?
></td
>
675 <td
><?php
echo xlt('Country'); ?
>:</td
>
676 <td
><input name
='countryName' type
='text' value
='' maxlength
='2'></td
>
677 <td
><?php
echo xlt('Example');
680 echo xlt('Should be two letters');
684 <td
><?php
echo xlt('Client certificate validation period'); ?
>:</td
>
685 <td
><input name
='clientCertValidity' type
='text' onkeypress
='return isNumberKey(event)' value
='365'></td
>
686 <td
><?php
echo xlt('days'); ?
></td
>
689 <td colspan
=3 align
='center'>
690 <input name
='sslcrt' type
='submit' onclick
='return download_click();' value
='<?php echo xla('Download Certificates
'); ?>'>
698 <div
class="borderbox">
699 <b
><?php
echo xlt('Configure Apache to use HTTPS.'); ?
></b
><br
>
701 <?php
echo xlt('Add new certificates to the Apache configuration file'); ?
>:<br
>
704 SSLCertificateFile
/path
/to
/Server
.crt
<br
>
705 SSLCertificateKeyFile
/path
/to
/Server
.key
<br
>
706 SSLCACertificateFile
/path
/to
/CertificateAuthority
.crt
<br
>
708 <?php
echo xlt('Note'); ?
>:
710 <li
><?php
echo xlt('To Enable only HTTPS, perform the above changes and restart Apache server. If you want to configure client side certificates also, please configure them in the next section.'); ?
></br
>
711 <li
> <?php
echo xlt('To Disable HTTPS, comment the above lines in Apache configuration file and restart Apache server.'); ?
>
716 <div
class="borderbox">
717 <form name
='ssl_frm' method
='post'>
718 <input type
="hidden" name
="csrf_token_form" value
="<?php echo attr(collectCsrfToken()); ?>" />
719 <b
><?php
echo xlt('Configure Apache to use Client side SSL certificates'); ?
> </b
>
721 <?php
echo xlt('Add following lines to the Apache configuration file'); ?
>:<br
>
723 SSLVerifyClient
require<br
>
725 SSLOptions +StdEnvVars
<br
>
726 <!--/br
> <b
><?php
echo xlt('Configure Openemr to use Client side SSL certificates'); ?
> </b
></br
>
727 <input type
='hidden' name
='clientCertValidity_hidden' value
=''>
728 <input type
='hidden' name
='mode' value
='save_ssl_settings'></br
>
729 <table cellpadding
=0 cellspacing
=0>
731 <td
><?php
echo xlt('Enable User Certificate Authentication'); ?
>:</td
>
733 <input name
='isClientAuthenticationEnabled' type
='radio' value
='Yes'
734 <?php
echo ($GLOBALS['is_client_ssl_enabled']) ?
"checked" : ""; ?
> > <?php
echo xlt('Yes'); ?
>
735 <input name
='isClientAuthenticationEnabled' type
='radio' value
='No' <?php
echo (!$GLOBALS['is_client_ssl_enabled']) ?
"checked" : ""; ?
> > <?php
echo xlt('No'); ?
>
738 <tr
><td
> 
;</td
></tr
>
740 <td
>CertificateAuthority
.key
<?php
echo xlt('file location'); ?
>: </td
>
742 <input type
='hidden' name
='hiden_cakey' />
743 <input name
='cakey_location' type
='text' size
=20 value
='<?php echo attr($GLOBALS['certificate_authority_key
']); ?>' /> (<?php
echo xlt('Provide absolute path'); ?
>)
747 <td
>CertificateAuthority
.crt
<?php
echo xlt('file location'); ?
>: </td
>
749 <input type
='hidden' name
='hiden_cacrt' />
750 <input name
='cacrt_location' type
=text size
=20 value
='<?php echo attr($GLOBALS['certificate_authority_crt
']); ?>'/> (<?php
echo xlt('Provide absolute path'); ?
>)
755 <input type
='submit' value
='<?php echo xla('Save Certificate Settings
'); ?>' onclick
='return save_click();'-->
756 </br
> <b
><?php
echo xlt('Configure Openemr to use Client side SSL certificates'); ?
> </b
></br
>
757 <input type
='hidden' name
='clientCertValidity_hidden' value
=''>
760 <?php
echo xlt('Update the following variables in file'); ?
>: globals
.php
</br
></br
>
761 <?php
echo xlt('To enable Client side ssl certificates'); ?
></br
>
762 <?php
echo xlt('Set'); ?
> 'is_client_ssl_enabled' <?php
echo xlt('to'); ?
> 'true' </br
></br
>
763 <?php
echo xlt('Provide absolute path of file'); ?
> CertificateAuthority
.key
</br
>
764 <?php
echo xlt('Set'); ?
> 'certificate_authority_key' <?php
echo xlt('to absolute path of file'); ?
> 'CertificateAuthority.key'</br
></br
>
765 <?php
echo xlt('Provide absolute path of file'); ?
> CertificateAuthority
.crt
</br
>
766 <?php
echo xlt('Set'); ?
> 'certificate_authority_crt' <?php
echo xlt('to absolute path of file'); ?
> 'CertificateAuthority.crt'</br
>
768 </br
><?php
echo xlt('Note'); ?
>:
770 <li
><?php
echo xlt('To Enable Client side SSL certificates authentication, HTTPS should be enabled.'); ?
>
771 <li
><?php
echo xlt('After performing above configurations, import the admin client certificate to the browser and restart Apache server (empty password).'); ?
>
772 <li
><?php
echo xlt('To Disable client side SSL certificates, comment above lines in Apache configuration file and set'); ?
> 'false' <?php
echo xlt('for variable'); ?
> 'is_client_ssl_enabled' (globals
.php
) <?php
echo xlt('and restart Apache server.'); ?
>
776 <div
class="borderbox">
777 <b
><?php
echo xlt('Create Client side SSL certificates'); ?
></b
><br
>
779 <?php
echo xlt('Create a client side SSL certificate for either a user or a client hostname.'); ?
>
782 if (!$GLOBALS['is_client_ssl_enabled'] ||
783 $GLOBALS['certificate_authority_crt'] == "") {
784 echo "<font class='redtext'>" . xlt('OpenEMR must be configured to use certificates before it can create client certificates.') . "</font><br>";
787 <form name
='client_cert_frm' method
='post' action
='ssl_certificates_admin.php'>
788 <input type
="hidden" name
="csrf_token_form" value
="<?php echo attr(collectCsrfToken()); ?>" />
789 <input type
='hidden' name
='mode' value
='create_client_certificate'>
792 <td
><?php
echo xlt('User or Host name'); ?
>*:</td
>
793 <td
><input type
='text' name
='client_cert_user' size
=20 />
796 <td
><?php
echo xlt('Email'); ?
>:</td
>
797 <td
><input type
='text' name
='client_cert_email' size
=20 />
800 </br
> <input type
='submit' onclick
='return create_client_certificate_click();' value
='<?php echo xla('Create Client Certificate
'); ?>'>