Subversion Repositories ALCASAR

Rev

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

Rev 2613 Rev 2688
Line 1... Line 1...
1
<?php
1
<?php
2
# $Id: network.php 2613 2018-08-22 21:26:27Z tom.houdayer $
2
# $Id: network.php 2688 2019-01-18 23:15:49Z lucas.echard $
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 224... Line 224...
224
				foreach ($tab as $line) { // verify that host or IP address doesn't exist
224
				foreach ($tab as $line) { // verify that host or IP address doesn't exist
225
					if (preg_match('/^\d+/', $line)) {
225
					if (preg_match('/^\d+/', $line)) {
226
						$field = preg_split("/\s+/",$line);
226
						$field = preg_split("/\s+/",$line);
227
						$ip_addr = $field[0];
227
						$ip_addr = $field[0];
228
						$host_name = trim($field[1]);
228
						$host_name = trim($field[1]);
229
						if (strcmp($add_ip, $ip_addr) === 0) {
-
 
230
							$insert = false;
-
 
231
							break;
-
 
232
						}
-
 
233
						if (strcasecmp($add_host, $host_name) === 0) {
229
						if (strcasecmp($add_host, $host_name) === 0) {
234
							$insert = false;
230
							$insert = false;
235
							break;
231
							break;
236
						}
232
						}
237
					}
233
					}
238
				}
234
				}
239
				if ($insert) {
235
				if ($insert) {
240
					exec("sudo /usr/local/bin/alcasar-dns-local.sh -add $add_ip $add_host");
236
					exec("sudo /usr/local/bin/alcasar-dns-local.sh --add $add_ip $add_host");
241
				}
237
				}
242
			}
238
			}
243
		}
239
		}
244
		break;
240
		break;
245
	case 'del_host':
241
	case 'del_host':
Line 270... Line 266...
270
					$keypath = $dest.'alcasar.key';
266
					$keypath = $dest.'alcasar.key';
271
					$crtpath = $dest.'alcasar.crt';
267
					$crtpath = $dest.'alcasar.crt';
272
					move_uploaded_file($_FILES['key']['tmp_name'], $keypath);
268
					move_uploaded_file($_FILES['key']['tmp_name'], $keypath);
273
					move_uploaded_file($_FILES['crt']['tmp_name'], $crtpath);
269
					move_uploaded_file($_FILES['crt']['tmp_name'], $crtpath);
274
					exec("sudo alcasar-importcert.sh -i $crtpath -k $keypath -c $scpath");
270
					exec("sudo alcasar-importcert.sh -i $crtpath -k $keypath -c $scpath");
275
					if (file_exists($crtpath)) unlink($crtpath); 
271
					if (file_exists($crtpath)) unlink($crtpath);
276
					if (file_exists($keypath)) unlink($keypath); 
272
					if (file_exists($keypath)) unlink($keypath);
277
					if (file_exists($scpath))  unlink($scpath);
273
					if (file_exists($scpath))  unlink($scpath);
278
				}
274
				}
279
			}
275
			}
280
		}
276
		}
281
		break;
277
		break;
Line 340... Line 336...
340
 
336
 
341
	$email      = $_POST['email'];
337
	$email      = $_POST['email'];
342
	$domainName = $_POST['domainname'];
338
	$domainName = $_POST['domainname'];
343
 
339
 
344
	exec('sudo /usr/local/bin/alcasar-letsencrypt.sh --issue --email '.escapeshellarg($email).' --domain '.escapeshellarg($domainName), $output, $exitCode);
340
	exec('sudo /usr/local/bin/alcasar-letsencrypt.sh --issue --email '.escapeshellarg($email).' --domain '.escapeshellarg($domainName), $output, $exitCode);
345
	
341
 
346
	$cmdResponse = implode("<br>\n", $output);
342
	$cmdResponse = implode("<br>\n", $output);
347
}
343
}
348
if ($choix === 'le_renewCert') {
344
if ($choix === 'le_renewCert') {
349
	if ((isset($_POST['recheck'])) && ((!empty($_POST['recheck'])) || (!empty($_POST['recheck_force'])))) {
345
	if ((isset($_POST['recheck'])) && ((!empty($_POST['recheck'])) || (!empty($_POST['recheck_force'])))) {
350
		$forceOpt = (!empty($_POST['recheck_force'])) ? ' --force' : '';
346
		$forceOpt = (!empty($_POST['recheck_force'])) ? ' --force' : '';