Subversion Repositories ALCASAR

Compare Revisions

Ignore whitespace Rev 2933 → Rev 2934

/web/acc/admin/services.php
153,12 → 153,7
// Doing an action on a service (start,stop or restart)
function serviceExec($service, $action){
if (($action == "start")||($action == "stop")||($action == "restart")){
if ($service != "wifi4eu") { exec("sudo /usr/bin/systemctl $action ".escapeshellarg($service), $retval, $retstatus); }
if ($service == "wifi4eu"){
if ($action == "stop"){ // see POST fonction (below) to start this service
exec("sudo /usr/local/bin/alcasar-wifi4eu.sh -off");
}
}
exec("sudo /usr/bin/systemctl $action ".escapeshellarg($service), $retval, $retstatus);
if ($service == "sshd"){
if ($action == "start"){
//exec("sudo /usr/bin/systemctl enable ".escapeshellarg($service));
191,30 → 186,26
}
 
//-------------------------------
// Actions on services
//-------------------------------
$autorizeService = array("radiusd","chilli","mysqld","lighttpd","unbound-forward","ulogd-ssh","ulogd-ext-access","ulogd-traceability","unbound-blacklist","unbound-whitelist","dnsmasq-whitelist","unbound-blackhole","e2guardian","clamav-daemon","clamav-freshclam","sshd","ntpd","fail2ban","nfcapd","vnstat");
$autorizeAction = array("start","stop","restart");
 
if (isset($_GET['service'])&&(in_array($_GET['service'], $autorizeService))) {
if (isset($_GET['action'])&&(in_array($_GET['action'], $autorizeAction))) {
$execStatus = serviceExec($_GET['service'], $_GET['action']);
// execStatus non exploité
}
}
//-------------------------------
// WIFI4EU
//-------------------------------
if (isset($_POST['wifi4eu'])){
//file_put_contents(CONF_FILE, preg_replace('/^WIFI4EU_CODE=*/', 'WIFI4EU_CODE='.$_POST['wifi4eu'], file_get_contents(CONF_FILE)));
file_put_contents(CONF_FILE, preg_replace('/^WIFI4EU_CODE=.*/', 'WIFI4EU_CODE=REXY', file_get_contents(CONF_FILE)));
exec("sudo /usr/local/bin/alcasar-wifi4eu.sh -on");
switch ($_POST['wifi4eu']){
case 'on' :
file_put_contents(CONF_FILE, preg_replace('/WIFI4EU_CODE=.*/', 'WIFI4EU_CODE='.trim($_POST['wifi4eu_code']), file_get_contents(CONF_FILE)));
exec("sudo /usr/local/bin/alcasar-wifi4eu.sh -on");
break;
case 'off' :
exec("sudo /usr/local/bin/alcasar-wifi4eu.sh -off");
break;
}
header('Location: '.$_SERVER['PHP_SELF']);
}
 
//-------------------------------
// Actions on system
// Stop/restart system
//-------------------------------
if (isset($_POST['choix'])){
switch ($_POST['choix']){
if (isset($_POST['system'])){
switch ($_POST['system']){
case 'reboot' :
exec ("sudo /usr/local/bin/alcasar-logout.sh all");
exec ("sudo /usr/sbin/shutdown -r now");
227,6 → 218,19
}
 
//-------------------------------
// Actions on services
//-------------------------------
$autorizeService = array("radiusd","chilli","mysqld","lighttpd","unbound-forward","ulogd-ssh","ulogd-ext-access","ulogd-traceability","unbound-blacklist","unbound-whitelist","dnsmasq-whitelist","unbound-blackhole","e2guardian","clamav-daemon","clamav-freshclam","sshd","ntpd","fail2ban","nfcapd","vnstat");
$autorizeAction = array("start","stop","restart");
 
if (isset($_GET['service'])&&(in_array($_GET['service'], $autorizeService))) {
if (isset($_GET['action'])&&(in_array($_GET['action'], $autorizeAction))) {
$execStatus = serviceExec($_GET['service'], $_GET['action']);
// execStatus non exploité
}
}
 
//-------------------------------
// Check services status
//-------------------------------
$MainServiceStatus = array();
327,12 → 331,12
<td align="center"><img src="/images/state_ok.gif" width="15" height="15" alt="<?php echo $l_service_status_img_ok; ?>"></td>
<td align="center"><b>WIFI4EU</b></td><td><?php echo "network ID : $wifi4eu_code"; ?></td>
<td width="80" align="center">---</td>
<td width="80" align="center"><a href="<?php echo $_SERVER['PHP_SELF']."?action=stop&service=wifi4eu\"> $l_service_stop";?></a></td>
<td width="80" align="center"><input type=submit value="<?echo $l_service_stop;?>"><input type=hidden name="wifi4eu" value="off"></td>
<td width="80" align="center">---</td>
<?php } else { ?>
<td align="center"><img src="/images/state_error.gif" width="15" height="15" alt="<?php echo $l_service_status_img_ko; ?>"></td>
<td align="center">WIFI4EU</td><td><?php echo $l_wifi4eu_id; ?> : <input type ="text" name="wifi4eu" value="<?php echo $wifi4eu_code; ?>" size="40"></td>
<td width="80" align="center"><input type=submit value="<?echo $l_service_start;?>"></td>
<td align="center">WIFI4EU</td><td><?php echo $l_wifi4eu_id; ?> : <input type ="text" name="wifi4eu_code" value="<?php echo $wifi4eu_code; ?>" size="40"></td>
<td width="80" align="center"><input type=submit value="<?echo $l_service_start;?>"><input type=hidden name="wifi4eu" value="on"></td>
<td width="80" align="center">---</td>
<td width="80" align="center">---</td>
<?php } ?>
347,7 → 351,7
<table width="100%" border=0 cellspacing=0 cellpadding=1>
<tr><td valign="middle" align="left">
<form action="<?php echo $_SERVER['PHP_SELF']?>" method=POST>
<select name='choix'>
<select name='system'>
<option selected value="reboot"><?echo "$l_reboot";?>
<option value="halt"><?echo "$l_halt";?>
</select>
/web/index.php
45,11 → 45,11
 
$organisme = $conf["ORGANISM"];
$hostname = $conf["HOSTNAME"].'.'.$conf["DOMAIN"];
$ssl_enable = ($conf['HTTPS_LOGIN'] === 'on');
$protocol = ($ssl_enable) ? 'https://' : 'http://';
$ssl_status = ($conf['HTTPS_LOGIN'] === 'on');
$protocol = ($ssl_status) ? 'https://' : 'http://';
$useHTTPS = ((isset($_SERVER['HTTPS'])) && (!empty($_SERVER['HTTPS'])) && ($_SERVER['HTTPS'] !== 'off'));
$network_pb = false; // "alcasar-watchdog.sh" changes this value if a network issue is detected
$diagnostic = "can't contact the default router"; // "alcasar-watchdog.sh" changes this value if a network issue is detected
$network_pb = false;
$diagnostic = "can't contact the default router";
$certCa_link = (($useHTTPS) ? 'https' : 'http')."://$hostname/certs/certificat_alcasar_ca.crt";
$logout_link = ((($conf['HTTPS_CHILLI'] === 'on') && $useHTTPS) ? 'https://'.$hostname.':3991' : 'http://'.$hostname.':3990').'/logoff';
$direct_access = false;
56,9 → 56,9
$remote_ip = preg_match('#^([0-9]{1,3}\.){3}[0-9]{1,3}$#', $_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '';
$connection_history = '';
$nb_connection_history = 3;
$redirect_link = 'www.euronews.com'; // Default redirection for HTTPS interception (beware, this website must run in HTTP)
 
// Check if the SMS service is enable
$redirect_link = 'www.euronews.com'; // Default redirection for HTTP interception (beware, this website must run in HTTP)
$service_wifi4eu_status = ($conf['WIFI4EU'] === 'on');
$service_wifi4eu_code = $conf['WIFI4EU_CODE'];
$service_SMS_status = ($conf['SMS'] === 'on');
 
// Retrieve the user info behind the remote ip
534,6 → 534,8
<link rel="stylesheet" type="text/css" href="<?= ((!$direct_access) ? "//$hostname" : '') ?>/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="/css/index.css">
<link rel="icon" href="/images/favicon-48.ico" type="image/ico">
<?
?>
</head>
<body>
<div class="col-xs-12 col-md-10 col-md-offset-1">