Line 77... |
Line 77... |
77 |
*********************************************************************/
|
77 |
*********************************************************************/
|
78 |
|
78 |
|
79 |
define ("ALCASAR_CHILLI", "/etc/chilli.conf");
|
79 |
define ("ALCASAR_CHILLI", "/etc/chilli.conf");
|
80 |
define ("ALCASAR_ETH0", "/etc/sysconfig/network-scripts/default-ifcfg-eth0");
|
80 |
define ("ALCASAR_ETH0", "/etc/sysconfig/network-scripts/default-ifcfg-eth0");
|
81 |
define ("ALCASAR_ETH1", "/etc/sysconfig/network-scripts/ifcfg-eth1");
|
81 |
define ("ALCASAR_ETH1", "/etc/sysconfig/network-scripts/ifcfg-eth1");
|
82 |
define ("ALCASAR_NETWORK", "/usr/local/etc/alcasar-network");
|
82 |
define ("CONF_FILE", "/usr/local/etc/alcasar.conf");
|
83 |
/********************************************************************
|
83 |
/********************************************************************
|
84 |
* TEST DES FICHIERS DE CONFIGURATION *
|
84 |
* TEST DES FICHIERS DE CONFIGURATION *
|
85 |
*********************************************************************/
|
85 |
*********************************************************************/
|
86 |
|
86 |
|
87 |
//Test de présence et des droits en lecture des fichiers de configuration.
|
87 |
//Test de présence et des droits en lecture des fichiers de configuration.
|
Line 106... |
Line 106... |
106 |
if (($action == "start")||($action == "stop")||($action == "restart")){
|
106 |
if (($action == "start")||($action == "stop")||($action == "restart")){
|
107 |
exec("sudo /sbin/service $service $action",$retval, $retstatus);
|
107 |
exec("sudo /sbin/service $service $action",$retval, $retstatus);
|
108 |
if ($service == "sshd"){
|
108 |
if ($service == "sshd"){
|
109 |
if ($action == "start"){
|
109 |
if ($action == "start"){
|
110 |
exec("sudo /sbin/chkconfig --add $service");
|
110 |
exec("sudo /sbin/chkconfig --add $service");
|
111 |
file_put_contents(ALCASAR_NETWORK, str_replace('SSH=off', 'SSH=on', file_get_contents(ALCASAR_NETWORK)));
|
111 |
file_put_contents(CONF_FILE, str_replace('SSH=off', 'SSH=on', file_get_contents(CONF_FILE)));
|
112 |
exec ("sudo /usr/local/bin/alcasar-iptables.sh");
|
112 |
exec ("sudo /usr/local/bin/alcasar-iptables.sh");
|
113 |
}
|
113 |
}
|
114 |
if ($action == "stop"){
|
114 |
if ($action == "stop"){
|
115 |
exec("sudo /sbin/chkconfig --del $service");
|
115 |
exec("sudo /sbin/chkconfig --del $service");
|
116 |
file_put_contents(ALCASAR_NETWORK, str_replace('SSH=on', 'SSH=off', file_get_contents(ALCASAR_NETWORK)));
|
116 |
file_put_contents(CONF_FILE, str_replace('SSH=on', 'SSH=off', file_get_contents(CONF_FILE)));
|
117 |
exec ("sudo /usr/local/bin/alcasar-iptables.sh");
|
117 |
exec ("sudo /usr/local/bin/alcasar-iptables.sh");
|
118 |
}
|
118 |
}
|
119 |
}
|
119 |
}
|
120 |
return $retstatus;
|
120 |
return $retstatus;
|
121 |
} else {
|
121 |
} else {
|