Subversion Repositories ALCASAR

Rev

Rev 2325 | Rev 2379 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 2325 Rev 2326
Line 1... Line 1...
1
<?php
1
<?php
2
# $Id: network.php 2325 2017-07-10 12:13:57Z tom.houdayer $
2
# $Id: network.php 2326 2017-07-10 13:07:42Z tom.houdayer $
3
 
3
 
4
// written by steweb57, Rexy & Tom HOUDAYER
4
// written by steweb57, Rexy & Tom HOUDAYER
5
 
5
 
6
/********************
6
/********************
7
*  READ CONF FILES  *
7
*  READ CONF FILES  *
Line 71... Line 71...
71
	$l_default_cert		= "Revenir au certificat d'origine";
71
	$l_default_cert		= "Revenir au certificat d'origine";
72
	$l_import		= "Importer";
72
	$l_import		= "Importer";
73
	$l_current_certificate  = "Certificat actuel";
73
	$l_current_certificate  = "Certificat actuel";
74
	$l_validated		= "Validé par :";
74
	$l_validated		= "Validé par :";
75
	$l_empty		= "Vide";
75
	$l_empty		= "Vide";
-
 
76
	$l_yes			= "Oui";
-
 
77
	$l_no			= "Non";
-
 
78
	$l_allow_unsecured_login	= "Autoriser les utilisateurs à se connecter de manière non sécurisée (HTTP) :";
-
 
79
	$l_unsecured_login_warning	= "/!\\ Les identifiants de connexion seront envoyés en clair.";
-
 
80
	$l_cert_expiration	= "Date d'expiration :";
-
 
81
	$l_cert_commonname	= "Nom commun:";
-
 
82
	$l_cert_organization	= "Organisation:";
-
 
83
	$l_upload_certificate	= "Importer un certificat";
-
 
84
	$l_le_integration	= "Intégration Let's Encrypt";
-
 
85
	$l_le_status		= "Status :";
-
 
86
	$l_disabled		= "Inactif";
-
 
87
	$l_pending_validation	= "En attente de validation";
-
 
88
	$l_enabled		= "Actif";
-
 
89
	$l_le_email		= "Email :";
-
 
90
	$l_le_domain_name	= "Nom de domaine :";
-
 
91
	$l_send			= "Envoyer";
-
 
92
	$l_le_ask_on		= "Demandé le :";
-
 
93
	$l_le_dns_entry_txt	= "Entrée DNS TXT :";
-
 
94
	$l_le_challenge		= "Challenge :";
-
 
95
	$l_recheck		= "Revérifier";
-
 
96
	$l_cancel		= "Annuler";
-
 
97
	$l_le_api		= "API :";
-
 
98
	$l_le_next_renewal	= "Prochain renouvellement :";
-
 
99
	$l_renew		= "Renouveller";
-
 
100
	$l_renew_force		= "Renouveller (forcer)";
76
} else {			// English
101
} else {			// English
77
	$l_network_title	= "Network configuration";
102
	$l_network_title	= "Network configuration";
78
	$l_internet_legend	= "INTERNET";
103
	$l_internet_legend	= "INTERNET";
79
	$l_ip_mask		= "Mask";
104
	$l_ip_mask		= "Mask";
80
	$l_ip_router		= "Gateway";
105
	$l_ip_router		= "Gateway";
Line 101... Line 126...
101
	$l_default_cert		= "Back to default certificate";
126
	$l_default_cert		= "Back to default certificate";
102
	$l_import		= "Import";
127
	$l_import		= "Import";
103
	$l_current_certificate  = "Current certificate";
128
	$l_current_certificate  = "Current certificate";
104
	$l_validated		= "Validated by :";
129
	$l_validated		= "Validated by :";
105
	$l_empty		= "Empty";
130
	$l_empty		= "Empty";
-
 
131
	$l_yes			= "Yes";
-
 
132
	$l_no			= "No";
-
 
133
	$l_allow_unsecured_login	= "Allow users to login with insecure connection (HTTP):";
-
 
134
	$l_unsecured_login_warning	= "/!\\ Credentials will be sent in plain text.";
-
 
135
	$l_cert_expiration	= "Expiration date:";
-
 
136
	$l_cert_commonname	= "Common name:";
-
 
137
	$l_cert_organization	= "Organization:";
-
 
138
	$l_upload_certificate	= "Importer un certificat";
-
 
139
	$l_le_integration	= "Let's Encrypt integration";
-
 
140
	$l_le_status		= "Status:";
-
 
141
	$l_disabled		= "Disabled";
-
 
142
	$l_pending_validation	= "Pending validation";
-
 
143
	$l_enabled		= "Enabled";
-
 
144
	$l_le_email		= "Email:";
-
 
145
	$l_le_domain_name	= "Domain name:";
-
 
146
	$l_send			= "Send";
-
 
147
	$l_le_ask_on		= "Ask on:";
-
 
148
	$l_le_dns_entry_txt	= "DNS TXT entry:";
-
 
149
	$l_le_challenge		= "Challenge:";
-
 
150
	$l_recheck		= "Recheck";
-
 
151
	$l_cancel		= "Cancel";
-
 
152
	$l_le_api		= "API:";
-
 
153
	$l_le_next_renewal	= "Next renewal:";
-
 
154
	$l_renew		= "Renew";
-
 
155
	$l_renew_force		= "Renew (force)";
106
}
156
}
107
 
157
 
108
$reg_ip      = '/^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/';
158
$reg_ip      = '/^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/';
109
$reg_ip_cidr = '/^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\/([0-9]|[1-2][0-9]|3[0-2]))$/';
159
$reg_ip_cidr = '/^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\/([0-9]|[1-2][0-9]|3[0-2]))$/';
110
 
160
 
Line 714... Line 764...
714
<table width="100%" cellspacing="0" cellpadding="5" border="1">
764
<table width="100%" cellspacing="0" cellpadding="5" border="1">
715
	<tr>
765
	<tr>
716
		<td width="50%" valign="top">
766
		<td width="50%" valign="top">
717
			<form method="post" action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>">
767
			<form method="post" action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>">
718
				<input type="hidden" name="choix" value="https_login">
768
				<input type="hidden" name="choix" value="https_login">
719
				<span>Autoriser les utilisateurs à se connecter de manière non sécurisée :</span><br>
769
				<span><?= $l_allow_unsecured_login ?></span><br>
720
				<select name="https_login">
770
				<select name="https_login">
721
					<option value="on"<?=  (($conf['HTTPS_LOGIN'] === 'on')  ? ' selected' : '') ?>>Non</option>
771
					<option value="on"<?=  (($conf['HTTPS_LOGIN'] === 'on')  ? ' selected' : '') ?>><?= $l_no ?></option>
722
					<option value="off"<?= (($conf['HTTPS_LOGIN'] === 'off') ? ' selected' : '') ?>>Oui</option>
772
					<option value="off"<?= (($conf['HTTPS_LOGIN'] === 'off') ? ' selected' : '') ?>><?= $l_yes ?></option>
723
				</select>
773
				</select>
724
				<input type="submit" value="<?= $l_apply ?>"><br>
774
				<input type="submit" value="<?= $l_apply ?>"><br>
725
				<span>/!\ Les identifiants de connexion seront envoyés en clair.</span>
775
				<span><?= $l_unsecured_login_warning ?></span>
726
			</form>
776
			</form>
727
			<br>
777
			<br>
728
			<form method="post" action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>">
778
			<form method="post" action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>">
729
				<input type="hidden" name="choix" value="default_cert">
779
				<input type="hidden" name="choix" value="default_cert">
730
				<input type="submit" value="<?= $l_default_cert ?>" <?= (!file_exists('/etc/pki/tls/certs/alcasar.crt.old') || !file_exists('/etc/pki/tls/private/alcasar.key.old')) ? ' disabled' : '' ?>>
780
				<input type="submit" value="<?= $l_default_cert ?>" <?= (!file_exists('/etc/pki/tls/certs/alcasar.crt.old') || !file_exists('/etc/pki/tls/private/alcasar.key.old')) ? ' disabled' : '' ?>>
Line 739... Line 789...
739
			$organization         = (isset($certificateInfos['subject']['O'])) ? $certificateInfos['subject']['O'] : '';
789
			$organization         = (isset($certificateInfos['subject']['O'])) ? $certificateInfos['subject']['O'] : '';
740
			$CAdomain             = $certificateInfos['issuer']['CN'];
790
			$CAdomain             = $certificateInfos['issuer']['CN'];
741
			$CAorganization       = (isset($certificateInfos['issuer']['O'])) ? $certificateInfos['issuer']['O'] : '';
791
			$CAorganization       = (isset($certificateInfos['issuer']['O'])) ? $certificateInfos['issuer']['O'] : '';
742
			?>
792
			?>
743
			<h3><?= $l_current_certificate ?></h3>
793
			<h3><?= $l_current_certificate ?></h3>
744
			Expiration Date : <?= $cert_expiration_date ?><br>
794
			<?= $l_cert_expiration ?> <?= $cert_expiration_date ?><br>
745
			Common name : <?= $domain ?><br>
795
			<?= $l_cert_commonname ?> <?= $domain ?><br>
746
			Organization : <?= $organization ?><br/>
796
			<?= $l_cert_organization ?> <?= $organization ?><br/>
747
			<h4><?=  $l_validated ?></h4>
797
			<h4><?=  $l_validated ?></h4>
748
			Common name : <?= $CAdomain ?><br>
798
			<?= $l_cert_commonname ?> <?= $CAdomain ?><br>
749
			Organization : <?= $CAorganization ?><br>
799
			<?= $l_cert_organization ?> <?= $CAorganization ?><br>
750
		</td>
800
		</td>
751
	</tr>
801
	</tr>
752
	<tr>
802
	<tr>
753
		<td width="50%" valign="top">
803
		<td width="50%" valign="top">
754
			<h3>Importer un certificat</h3>
804
			<h3><?= $l_upload_certificate ?></h3>
755
			<form method="post" action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>" enctype="multipart/form-data">
805
			<form method="post" action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>" enctype="multipart/form-data">
756
				<?= $l_private_key;?> <input type="file" name="key"><br>
806
				<?= $l_private_key;?> <input type="file" name="key"><br>
757
				<?= $l_certificate;?> <input type="file" name="crt"><br>
807
				<?= $l_certificate;?> <input type="file" name="crt"><br>
758
				<?= $l_server_chain;?> <input type="file" name="sc"><br>
808
				<?= $l_server_chain;?> <input type="file" name="sc"><br>
759
				<input type="hidden" name="choix" value="import_cert">
809
				<input type="hidden" name="choix" value="import_cert">
Line 771... Line 821...
771
				$step = 3;
821
				$step = 3;
772
			} else {
822
			} else {
773
				$step = 1;
823
				$step = 1;
774
			}
824
			}
775
			?>
825
			?>
776
			<h3>Intégration Let's Encrypt</h3>
826
			<h3><?= $l_le_integration ?></h3>
777
			<?php if ($step === 1): ?>
827
			<?php if ($step === 1): ?>
778
				<form method="post" action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>">
828
				<form method="post" action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>">
779
					<input type="hidden" name="choix" value="le_issueCert">
829
					<input type="hidden" name="choix" value="le_issueCert">
780
					Status : Inactif<br>
830
					<?= $l_le_status ?> <?= $l_disabled ?><br>
781
					Email : <input type="text" name="email" placeholder="adresse@email.com"<?= ((!empty($LE_conf['email'])) ? ' value="'.$LE_conf['email'].'"' : '') ?>><br>
831
					<?= $l_le_email ?> <input type="text" name="email" placeholder="adresse@email.com"<?= ((!empty($LE_conf['email'])) ? ' value="'.$LE_conf['email'].'"' : '') ?>><br>
782
					Nom de domaine : <input type="text" name="domainname" placeholder="alcasar.domain.tld" required><br>
832
					<?= $l_le_domain_name ?> <input type="text" name="domainname" placeholder="alcasar.domain.tld" required><br>
783
					<input type="submit" name="issue" value="Envoyer"><br>
833
					<input type="submit" name="issue" value="<?= $l_send ?>"><br>
784
				</form>
834
				</form>
785
			<?php elseif ($step === 2): ?>
835
			<?php elseif ($step === 2): ?>
786
				<form method="post" action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>">
836
				<form method="post" action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>">
787
					<input type="hidden" name="choix" value="le_renewCert">
837
					<input type="hidden" name="choix" value="le_renewCert">
788
					Status : En attente de validation<br>
838
					<?= $l_le_status ?> <?= $l_pending_validation ?><br>
789
					Nom de domaine : <?= $LE_conf['domainRequest'] ?><br>
839
					<?= $l_le_domain_name ?> <?= $LE_conf['domainRequest'] ?><br>
790
					Demandé le : <?= date('d-m-Y H:i:s', $LE_conf['dateIssueRequest']) ?><br>
840
					<?= $l_le_ask_on ?> <?= date('d-m-Y H:i:s', $LE_conf['dateIssueRequest']) ?><br>
791
					Entrée DNS TXT : "<?= '_acme-challenge.'.$LE_conf['domainRequest'] ?>"<br>
841
					<?= $l_le_dns_entry_txt ?> "<?= '_acme-challenge.'.$LE_conf['domainRequest'] ?>"<br>
792
					Challenge : "<?= $LE_conf['challenge'] ?>"<br>
842
					<?= $l_le_challenge ?> "<?= $LE_conf['challenge'] ?>"<br>
793
					<input type="submit" name="recheck" value="Revérifier"> <input type="submit" name="cancel" value="Annuler"><br>
843
					<input type="submit" name="recheck" value="<?= $l_recheck ?>"> <input type="submit" name="cancel" value="<?= $l_cancel ?>"><br>
794
				</form>
844
				</form>
795
			<?php elseif ($step === 3): ?>
845
			<?php elseif ($step === 3): ?>
796
				<form method="post" action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>">
846
				<form method="post" action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>">
797
					<input type="hidden" name="choix" value="le_renewCert">
847
					<input type="hidden" name="choix" value="le_renewCert">
798
					Status : Actif<br>
848
					<?= $l_le_status ?> <?= $l_enabled ?><br>
799
					Nom de domaine : <?= $LE_conf['domainRequest'] ?><br>
849
					<?= $l_le_domain_name ?> <?= $LE_conf['domainRequest'] ?><br>
800
					API :  <?= $LE_conf['dnsapi'] ?><br>
850
					<?= $l_le_api ?>  <?= $LE_conf['dnsapi'] ?><br>
801
					Prochain renouvellement : <?= date('d-m-Y', $LE_conf['dateNextRenewal']) ?><br>
851
					<?= $l_le_next_renewal ?> <?= date('d-m-Y', $LE_conf['dateNextRenewal']) ?><br>
802
					<?php if ($LE_conf['dateNextRenewal'] <= date('U')): ?>
852
					<?php if ($LE_conf['dateNextRenewal'] <= date('U')): ?>
803
						<input type="submit" name="recheck" value="Renouveller"><br>
853
						<input type="submit" name="recheck" value="<?= $l_renew ?>"><br>
804
					<?php else: ?>
854
					<?php else: ?>
805
						<input type="submit" name="recheck_force" value="Renouveller (forcer)"><br>
855
						<input type="submit" name="recheck_force" value="<?= $l_renew_force ?>"><br>
806
					<?php endif; ?>
856
					<?php endif; ?>
807
				</form>
857
				</form>
808
			<?php endif; ?>
858
			<?php endif; ?>
809
			<?php if (isset($cmdResponse)): ?>
859
			<?php if (isset($cmdResponse)): ?>
810
				<p><?= $cmdResponse ?></p>
860
				<p><?= $cmdResponse ?></p>