Subversion Repositories ALCASAR

Rev

Rev 3320 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 3320 Rev 3321
Line 71... Line 71...
71
	$l_error_details	= "Détails des erreurs";
71
	$l_error_details	= "Détails des erreurs";
72
	$l_field		= "Champ";
72
	$l_field		= "Champ";
73
	$l_go_network_conf_page	= "Allez sur la page de configuration réseau.";
73
	$l_go_network_conf_page	= "Allez sur la page de configuration réseau.";
74
	$l_host_name		= "Nom d'hôte";
74
	$l_host_name		= "Nom d'hôte";
75
	$l_hosts_settings	= "Paramètres de réplication des hôtes distants";
75
	$l_hosts_settings	= "Paramètres de réplication des hôtes distants";
76
	$l_import_ssh_key	= "Si cet ALCASAR est primaire, importez ici les clés publiques des secondaires";
76
	$l_import_ssh_key	= "Importez ici les clés publiques des secondaires";
77
	$l_install_repl		= "Installer la fédération";
77
	$l_install_repl		= "Installer la fédération";
78
	$l_remote_hosts		= "Hôtes distants";
78
	$l_remote_hosts		= "Hôtes distants";
79
	$l_ip_address		= "Adresse IP";
79
	$l_ip_address		= "Adresse IP";
80
	$l_no_host_connected = "Aucun hote connecté";
80
	$l_no_host_connected = "Aucun hote connecté";
81
	$l_no_ssh_key		= "Aucune clé SSH importée.";
81
	$l_no_ssh_key		= "Aucune clé SSH importée.";
Line 116... Line 116...
116
	$l_error_details	= "Detalles de los errores";
116
	$l_error_details	= "Detalles de los errores";
117
	$l_field		= "campo";
117
	$l_field		= "campo";
118
	$l_go_network_conf_page	= "Vaya a la página de configuración de red";
118
	$l_go_network_conf_page	= "Vaya a la página de configuración de red";
119
	$l_host_name		= "Nombre de host";
119
	$l_host_name		= "Nombre de host";
120
	$l_hosts_settings	= "Configuración de replicación de hosts remotos";
120
	$l_hosts_settings	= "Configuración de replicación de hosts remotos";
121
	$l_import_ssh_key	= "Importar una clave SSH";
121
	$l_import_ssh_key	= "Importe aquí las claves públicas de los servidores secundarios";
122
	$l_install_repl		= "Creación de la federación";
122
	$l_install_repl		= "Creación de la federación";
123
	$l_remote_hosts		= "Hosts remotos";
123
	$l_remote_hosts		= "Hosts remotos";
124
	$l_ip_address		= "dirección IP";
124
	$l_ip_address		= "dirección IP";
125
	$l_no_host_connected = "No hay ningún host conectado.";
125
	$l_no_host_connected = "No hay ningún host conectado.";
126
	$l_no_ssh_key		= "No se ha importado ninguna clave SSH.";
126
	$l_no_ssh_key		= "No se ha importado ninguna clave SSH.";
Line 161... Line 161...
161
	$l_error_details	= "Error details";
161
	$l_error_details	= "Error details";
162
	$l_field		= "Field";
162
	$l_field		= "Field";
163
	$l_go_network_conf_page	= "Go to network config page.";
163
	$l_go_network_conf_page	= "Go to network config page.";
164
	$l_host_name		= "Host name";
164
	$l_host_name		= "Host name";
165
	$l_hosts_settings	= "Remote replicated hosts settings";
165
	$l_hosts_settings	= "Remote replicated hosts settings";
166
	$l_import_ssh_key	= "Import a SSH key";
166
	$l_import_ssh_key	= "Import here the public keys of the secondary servers";
167
	$l_install_repl		= "Setting up the federation";
167
	$l_install_repl		= "Setting up the federation";
168
	$l_remote_hosts		= "Remote hosts";
168
	$l_remote_hosts		= "Remote hosts";
169
	$l_ip_address		= "IP address";
169
	$l_ip_address		= "IP address";
170
	$l_no_host_connected = "No host connected";
170
	$l_no_host_connected = "No host connected";
171
	$l_no_ssh_key		= "No SSH key imported.";
171
	$l_no_ssh_key		= "No SSH key imported.";
Line 662... Line 662...
662
</div>
662
</div>
663
<div>
663
<div>
664
<table width="100%" cellspacing="0" cellpadding="5" border="1">
664
<table width="100%" cellspacing="0" cellpadding="5" border="1">
665
	<tr>
665
	<tr>
666
		<td width="50%" align="center">
666
		<td width="50%" align="center">
667
			<p><?= $l_ssh_keys_for_primary ?></p>
667
			<center><?= $l_ssh_keys_for_primary ?></center>
668
			<?php $section = "delete_ssh_key" ?>
668
			<?php $section = "delete_ssh_key" ?>
669
			<form action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>" method="POST">
669
			<form action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>" method="POST">
670
			<input type="hidden" name="choice" value="<?= $section ?>">
670
			<input type="hidden" name="choice" value="<?= $section ?>">
671
			<table cellspacing="2" cellpadding="3" border="1" style="table-layout: auto; min-width: 10em;">
671
			<table cellspacing="2" cellpadding="3" border="1" style="table-layout: auto; min-width: 10em;">
672
				<tr>
672
				<tr>
Line 675... Line 675...
675
					<th><?= $l_delete ?></th>
675
					<th><?= $l_delete ?></th>
676
				</tr>
676
				</tr>
677
				<?php
677
				<?php
678
				$stdout = [];
678
				$stdout = [];
679
				$return = 0;
679
				$return = 0;
-
 
680
				$public_key_exist=False;
680
				exec("sudo /usr/local/bin/alcasar-replication-ssh-keys-management.sh --list 2>&1", $stdout, $return);
681
				exec("sudo /usr/local/bin/alcasar-replication-ssh-keys-management.sh --list 2>&1", $stdout, $return);
681
				// If script went wrong
682
				// If script went wrong
682
				if ($return) {
683
				if ($return) {
683
					// Print error message
684
					// Print error message
684
					$errors_msg[$section."_error"] = implode(PHP_EOL, $stdout);
685
					$errors_msg[$section."_error"] = implode(PHP_EOL, $stdout);
Line 689... Line 690...
689
						// Skip empty lines
690
						// Skip empty lines
690
						if (str_starts_with($line, ' ')) {
691
						if (str_starts_with($line, ' ')) {
691
							continue;
692
							continue;
692
						}
693
						}
693
						// Split args
694
						// Split args
-
 
695
						$public_key_exist=True;
694
						$exploded = explode(' ', $line);
696
						$exploded = explode(' ', $line);
695
						$algo = $exploded[0] ?? "";
697
						$algo = $exploded[0] ?? "";
696
						$full_hostname = explode('@', $exploded[2] ?? "");
698
						$full_hostname = explode('@', $exploded[2] ?? "");
697
						$hostname = $full_hostname[1];
699
						$hostname = $full_hostname[1];
698
						?>
700
						?>
Line 720... Line 722...
720
					<summary><?= $l_error_details ?></summary>
722
					<summary><?= $l_error_details ?></summary>
721
					<textarea readonly cols=50 rows=10><?= $errors_msg[$section."_error"] ?></textarea>
723
					<textarea readonly cols=50 rows=10><?= $errors_msg[$section."_error"] ?></textarea>
722
				</details>
724
				</details>
723
			<?php } ?>
725
			<?php } ?>
724
		</td>
726
		</td>
725
		<td width="25%" valign="middle" align="center">
727
		<td width="<?php if ($public_key_exist) { echo "50"; } else { echo "25";} ?>%" valign="middle" align="center">
726
			<?php $section = "add_ssh_key" ?>
728
			<?php $section = "add_ssh_key" ?>
727
			<form action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>" method="POST" enctype="multipart/form-data">
729
			<form action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>" method="POST" enctype="multipart/form-data">
728
			<input type="hidden" name="choice" value="<?= $section ?>">
730
			<input type="hidden" name="choice" value="<?= $section ?>">
729
				<input type="hidden" name="MAX_FILE_SIZE" value="<?= $max_ssh_file_size ?>" />
731
				<input type="hidden" name="MAX_FILE_SIZE" value="<?= $max_ssh_file_size ?>" />
730
				<label for="new_ssh_key_input"><?= $l_import_ssh_key ?><br></label>
732
				<center><?= $l_import_ssh_key ?><br></center>
731
				<br>
733
				<br>
732
				<input type="file" name="new_ssh_key_input" id="new_ssh_key_input" accept=".pub">
734
				<input type="file" name="new_ssh_key_input" id="new_ssh_key_input" accept=".pub">
733
				<br>
735
				<br>
734
				<input type="submit" class="button" value="<?= $l_add_to_list ?>" onClick="document.getElementById('ldoverlay').style.display='block';">
736
				<input type="submit" class="button" value="<?= $l_add_to_list ?>" onClick="document.getElementById('ldoverlay').style.display='block';">
735
			</form>
737
			</form>
Line 738... Line 740...
738
					<summary><?= $l_error_details ?></summary>
740
					<summary><?= $l_error_details ?></summary>
739
					<textarea readonly cols=50 rows=10><?= $errors_msg[$section."_error"] ?></textarea>
741
					<textarea readonly cols=50 rows=10><?= $errors_msg[$section."_error"] ?></textarea>
740
				</details>
742
				</details>
741
			<?php } ?>
743
			<?php } ?>
742
		</td>
744
		</td>
-
 
745
		<?php if (! $public_key_exist) { ?>
743
		<td width="25%" valign="middle" align="center">
746
			<td width="25%" valign="middle" align="center">
744
				<label for="pubkey_stdout"><?= $l_pubkey_to_deploy ?><br></label>
747
				<center><?= $l_pubkey_to_deploy ?><br></center>
745
				<br>
748
				<br>
746
				<?php
749
				<?php
747
				$stdout = [];
750
				$stdout = [];
748
				$return = 0;
751
				$return = 0;
749
				exec("sudo /usr/local/bin/alcasar-replication-ssh-keys-management.sh --show-pubkey 2>&1", $stdout, $return);
752
				exec("sudo /usr/local/bin/alcasar-replication-ssh-keys-management.sh --show-pubkey 2>&1", $stdout, $return);
Line 751... Line 754...
751
				if ($return != 0) {
754
				if ($return != 0) {
752
					echo "<p>$l_cant_read_pubkey</p>";
755
					echo "<p>$l_cant_read_pubkey</p>";
753
				} else { ?>
756
				} else { ?>
754
					<input type="text" id="pubkey_stdout" readonly value="<?= implode(PHP_EOL, $stdout) ?>">
757
					<input type="text" id="pubkey_stdout" readonly value="<?= implode(PHP_EOL, $stdout) ?>">
755
				<?php } ?>
758
				<?php } ?>
756
		</td>
759
		</td> <?php } ?>
757
	</tr>
760
	</tr>
758
</table>
761
</table>
759
</div>
762
</div>
760
<br>
763
<br>
761
<?php } ?>
764
<?php } ?>