Line 33... |
Line 33... |
33 |
$l_dnsmasq_whitelist = "Serveur DNS pour la Whitelist";
|
33 |
$l_dnsmasq_whitelist = "Serveur DNS pour la Whitelist";
|
34 |
$l_dnsmasq_blackhole = "Serveur DNS 'trou noir'";
|
34 |
$l_dnsmasq_blackhole = "Serveur DNS 'trou noir'";
|
35 |
$l_ulogd_ssh = "journalisation des accès par SSH";
|
35 |
$l_ulogd_ssh = "journalisation des accès par SSH";
|
36 |
$l_ulogd_ext_access = "journalisation des tentatives d'accès externes";
|
36 |
$l_ulogd_ext_access = "journalisation des tentatives d'accès externes";
|
37 |
$l_ulogd_traceability = "journalisation des connexions WEB filtrés";
|
37 |
$l_ulogd_traceability = "journalisation des connexions WEB filtrés";
|
- |
|
38 |
$l_execute = "Exécuter";
|
- |
|
39 |
$l_stop_restart = "Arret et redémarrage du système";
|
- |
|
40 |
$l_halt = "Arréter le système";
|
- |
|
41 |
$l_reboot = "Relancer le système";
|
38 |
} else {
|
42 |
} else {
|
39 |
$l_services_title = "Services configuration";
|
43 |
$l_services_title = "Services configuration";
|
40 |
$l_main_services = "Main services";
|
44 |
$l_main_services = "Main services";
|
41 |
$l_filter_services = "Filtering services";
|
45 |
$l_filter_services = "Filtering services";
|
42 |
$l_opt_services = "Optional services";
|
46 |
$l_opt_services = "Optional services";
|
Line 63... |
Line 67... |
63 |
$l_dnsmasq_whitelist = "DNS server for the Whitelist";
|
67 |
$l_dnsmasq_whitelist = "DNS server for the Whitelist";
|
64 |
$l_dnsmasq_blackhole = "DNS server (blackhole)";
|
68 |
$l_dnsmasq_blackhole = "DNS server (blackhole)";
|
65 |
$l_ulogd_ssh = "SSH access logging process";
|
69 |
$l_ulogd_ssh = "SSH access logging process";
|
66 |
$l_ulogd_ext_access = "Extern access attempts logging process";
|
70 |
$l_ulogd_ext_access = "Extern access attempts logging process";
|
67 |
$l_ulogd_traceability = "Filtering WEB access logging process";
|
71 |
$l_ulogd_traceability = "Filtering WEB access logging process";
|
- |
|
72 |
$l_execute = "Execute";
|
- |
|
73 |
$l_stop_restart = "Halt and restart the system";
|
- |
|
74 |
$l_halt = "Halt le system";
|
- |
|
75 |
$l_reboot = "Restart the system";
|
68 |
}
|
76 |
}
|
69 |
|
77 |
|
70 |
/****************************************************************
|
78 |
/****************************************************************
|
71 |
* CONSTANTES AVEC CHEMINS DES FICHIERS DE CONFIGURATION *
|
79 |
* CONSTANTES AVEC CHEMINS DES FICHIERS DE CONFIGURATION *
|
72 |
*****************************************************************/
|
80 |
*****************************************************************/
|
Line 84... |
Line 92... |
84 |
}
|
92 |
}
|
85 |
|
93 |
|
86 |
//fonction pour faire une action (start,stop,restart) sur un service
|
94 |
//fonction pour faire une action (start,stop,restart) sur un service
|
87 |
function serviceExec($service, $action){
|
95 |
function serviceExec($service, $action){
|
88 |
if (($action == "start")||($action == "stop")||($action == "restart")){
|
96 |
if (($action == "start")||($action == "stop")||($action == "restart")){
|
89 |
exec("sudo /bin/systemctl $action $service",$retval, $retstatus);
|
97 |
exec("sudo /usr/bin/systemctl $action $service",$retval, $retstatus);
|
90 |
if ($service == "sshd"){
|
98 |
if ($service == "sshd"){
|
91 |
if ($action == "start"){
|
99 |
if ($action == "start"){
|
92 |
exec("sudo /bin/systemctl enable $service");
|
100 |
exec("sudo /usr/bin/systemctl enable $service");
|
93 |
file_put_contents(CONF_FILE, str_replace('SSH=off', 'SSH=on', file_get_contents(CONF_FILE)));
|
101 |
file_put_contents(CONF_FILE, str_replace('SSH=off', 'SSH=on', file_get_contents(CONF_FILE)));
|
94 |
exec ("sudo /usr/local/bin/alcasar-iptables.sh");
|
102 |
exec ("sudo /usr/local/bin/alcasar-iptables.sh");
|
95 |
}
|
103 |
}
|
96 |
if ($action == "stop"){
|
104 |
if ($action == "stop"){
|
97 |
exec("sudo /sbin/systemctl disable $service");
|
105 |
exec("sudo /usr/bin/systemctl disable $service");
|
98 |
file_put_contents(CONF_FILE, str_replace('SSH=on', 'SSH=off', file_get_contents(CONF_FILE)));
|
106 |
file_put_contents(CONF_FILE, str_replace('SSH=on', 'SSH=off', file_get_contents(CONF_FILE)));
|
99 |
exec ("sudo /usr/local/bin/alcasar-iptables.sh");
|
107 |
exec ("sudo /usr/local/bin/alcasar-iptables.sh");
|
100 |
}
|
108 |
}
|
101 |
}
|
109 |
}
|
102 |
return $retstatus;
|
110 |
return $retstatus;
|
Line 106... |
Line 114... |
106 |
}
|
114 |
}
|
107 |
//fonction définissant le status d'un service
|
115 |
//fonction définissant le status d'un service
|
108 |
//(en fonction de la présence d'un mot clé dans la valeur de status)
|
116 |
//(en fonction de la présence d'un mot clé dans la valeur de status)
|
109 |
function checkServiceStatus($service){
|
117 |
function checkServiceStatus($service){
|
110 |
$response = false;
|
118 |
$response = false;
|
111 |
exec("/bin/systemctl is-active $service.service",$retval);
|
119 |
exec("/usr/bin/systemctl is-active $service.service",$retval);
|
112 |
foreach( $retval as $val ) {
|
120 |
foreach( $retval as $val ) {
|
113 |
if ($val == "active"){
|
121 |
if ($val == "active"){
|
114 |
$response = true;
|
122 |
$response = true;
|
115 |
break;
|
123 |
break;
|
116 |
}
|
124 |
}
|
117 |
}
|
125 |
}
|
118 |
return $response;
|
126 |
return $response;
|
119 |
}
|
127 |
}
|
120 |
|
128 |
|
121 |
//-------------------------------
|
129 |
//-------------------------------
|
122 |
// Les actions sur un service
|
130 |
// Actions on services
|
123 |
//-------------------------------
|
131 |
//-------------------------------
|
124 |
//sécurité sur les actions à réaliser
|
132 |
//sécurité sur les actions à réaliser
|
125 |
$autorizeService = array("radiusd","chilli","dansguardian","mysqld","httpd","sshd","freshclam","ntpd","havp","tinyproxy","dnsmasq","dnsmasq-blacklist","dnsmasq-whitelist","dnsmasq-blackhole");
|
133 |
$autorizeService = array("radiusd","chilli","dansguardian","mysqld","httpd","sshd","freshclam","ntpd","havp","tinyproxy","dnsmasq","dnsmasq-blacklist","dnsmasq-whitelist","dnsmasq-blackhole");
|
126 |
$autorizeAction = array("start","stop","restart");
|
134 |
$autorizeAction = array("start","stop","restart");
|
127 |
|
135 |
|
Line 130... |
Line 138... |
130 |
$execStatus = serviceExec($_GET['service'], $_GET['action']);
|
138 |
$execStatus = serviceExec($_GET['service'], $_GET['action']);
|
131 |
// execStatus non exploité
|
139 |
// execStatus non exploité
|
132 |
}
|
140 |
}
|
133 |
}
|
141 |
}
|
134 |
//-------------------------------
|
142 |
//-------------------------------
|
- |
|
143 |
// Actions on system
|
- |
|
144 |
//-------------------------------
|
- |
|
145 |
if (isset($_POST['choix'])){
|
- |
|
146 |
switch ($_POST['choix']){
|
- |
|
147 |
case 'reboot' :
|
- |
|
148 |
exec ("sudo /usr/local/sbin/alcasar-logout.sh all");
|
- |
|
149 |
exec ("sudo /usr/bin/systemctl reboot");
|
- |
|
150 |
break;
|
- |
|
151 |
case 'halt' :
|
- |
|
152 |
exec ("sudo /usr/local/sbin/alcasar-logout.sh all");
|
- |
|
153 |
exec ("sudo /usr/bin/systemctl halt");
|
- |
|
154 |
break;
|
- |
|
155 |
}
|
- |
|
156 |
}
|
- |
|
157 |
|
- |
|
158 |
|
- |
|
159 |
//-------------------------------
|
135 |
//recherche du status des services
|
160 |
//recherche du status des services
|
136 |
//-------------------------------
|
161 |
//-------------------------------
|
137 |
$MainServiceStatus = array();
|
162 |
$MainServiceStatus = array();
|
138 |
$MainServiceStatus['radiusd'] = checkServiceStatus("radiusd");
|
163 |
$MainServiceStatus['radiusd'] = checkServiceStatus("radiusd");
|
139 |
$MainServiceStatus['chilli'] = checkServiceStatus("chilli");
|
164 |
$MainServiceStatus['chilli'] = checkServiceStatus("chilli");
|
Line 181... |
Line 206... |
181 |
<tr>
|
206 |
<tr>
|
182 |
<?php if ($statusOK) { ?>
|
207 |
<?php if ($statusOK) { ?>
|
183 |
<td align="center"><img src="/images/state_ok.gif" width="15" height="15" alt="<?php echo $l_service_status_img_ok; ?>"></td>
|
208 |
<td align="center"><img src="/images/state_ok.gif" width="15" height="15" alt="<?php echo $l_service_status_img_ok; ?>"></td>
|
184 |
<td align="center"><?php $comment="l_$serviceName"; echo "<b>$serviceName</b></td><td>${$comment}" ;?> </td>
|
209 |
<td align="center"><?php $comment="l_$serviceName"; echo "<b>$serviceName</b></td><td>${$comment}" ;?> </td>
|
185 |
<td width="80" align="center">---</td>
|
210 |
<td width="80" align="center">---</td>
|
186 |
<td width="80" align="center"><?php if ($serviceName != "chilli") { echo "<a href=".$_SERVER['PHP_SELF']."?action=stop&service=$serviceName\"> $l_service_stop</a>"; } else echo "---";?></td>
|
211 |
<td width="80" align="center"><?php if ($serviceName != "chilli") { echo "<a href=\"".$_SERVER['PHP_SELF']."?action=stop&service=$serviceName\"> $l_service_stop</a>"; } else echo "---";?></td>
|
187 |
<td width="80" align="center"><a href="<?php echo $_SERVER['PHP_SELF']."?action=restart&service=$serviceName\"> $l_service_restart";?></a></td>
|
212 |
<td width="80" align="center"><a href="<?php echo $_SERVER['PHP_SELF']."?action=restart&service=$serviceName\"> $l_service_restart";?></a></td>
|
188 |
<?php } else { ?>
|
213 |
<?php } else { ?>
|
189 |
<td align="center"><img src="/images/state_error.gif" width="15" height="15" alt="<?php echo $l_service_status_img_ko ?>"></td>
|
214 |
<td align="center"><img src="/images/state_error.gif" width="15" height="15" alt="<?php echo $l_service_status_img_ko ?>"></td>
|
190 |
<td align="center"><?php $comment="l_$serviceName"; echo "<b>$serviceName</b></td><td>${$comment}" ;?> </td>
|
215 |
<td align="center"><?php $comment="l_$serviceName"; echo "<b>$serviceName</b></td><td>${$comment}" ;?> </td>
|
191 |
<td width="80" align="center"><a href="<?php echo $_SERVER['PHP_SELF']."?action=start&service=$serviceName\"> $l_service_start";?></a></td>
|
216 |
<td width="80" align="center"><a href="<?php echo $_SERVER['PHP_SELF']."?action=start&service=$serviceName\"> $l_service_start";?></a></td>
|
Line 245... |
Line 270... |
245 |
<td width="80" align="center">---</td>
|
270 |
<td width="80" align="center">---</td>
|
246 |
<?php } ?>
|
271 |
<?php } ?>
|
247 |
</tr>
|
272 |
</tr>
|
248 |
<?php } ?>
|
273 |
<?php } ?>
|
249 |
</td></tr>
|
274 |
</td></tr>
|
- |
|
275 |
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
|
- |
|
276 |
<tr><th><? echo $l_stop_restart;?></th></tr>
|
- |
|
277 |
<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
|
250 |
</table>
|
278 |
</TABLE>
|
- |
|
279 |
<TABLE width="100%" border=1 cellspacing=0 cellpadding=1>
|
- |
|
280 |
<tr><td valign="middle" align="left">
|
- |
|
281 |
<FORM action="services.php" method=POST><b>
|
- |
|
282 |
<select name='choix'></b>
|
- |
|
283 |
<option selected value="reboot"><?echo "$l_reboot";?>
|
- |
|
284 |
<option value="halt"><?echo "$l_halt";?>
|
- |
|
285 |
</select>
|
- |
|
286 |
<input type=submit value="<?echo "$l_execute";?>">
|
- |
|
287 |
</FORM>
|
- |
|
288 |
</td></tr>
|
- |
|
289 |
</TABLE>
|
251 |
</body>
|
290 |
</body>
|
252 |
</html>
|
291 |
</html>
|