From 25b66ec5e31edc19a67e1dfb98977148c264f7aa Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Tue, 15 May 2007 00:36:02 +0000 Subject: Add stop / start / restart racoon (IPSEC VPN) service option. --- usr/local/www/status_services.php | 45 +++++++++++++++++++++++++++++++++++---- 1 file changed, 41 insertions(+), 4 deletions(-) (limited to 'usr/local/www/status_services.php') diff --git a/usr/local/www/status_services.php b/usr/local/www/status_services.php index 26c38eb..b4a8750 100755 --- a/usr/local/www/status_services.php +++ b/usr/local/www/status_services.php @@ -57,6 +57,9 @@ if($_GET['mode'] == "restartservice" and $_GET['service']) { if(file_exists('/usr/local/etc/rc.d/miniupnpd.sh')) mwexec('/usr/local/etc/rc.d/miniupnpd.sh restart'); break; + case 'racoon': + exec("killall -9 racoon"); + vpn_ipsec_configure(true); default: restart_service($_GET['service']); break; @@ -80,6 +83,9 @@ if($_GET['mode'] == "startservice" and $_GET['service']) { if(file_exists('/usr/local/etc/rc.d/miniupnpd.sh')) mwexec('/usr/local/etc/rc.d/miniupnpd.sh start'); break; + case 'racoon': + exec("killall -9 racoon"); + vpn_ipsec_configure(true); default: start_service($_GET['service']); break; @@ -88,18 +94,42 @@ if($_GET['mode'] == "startservice" and $_GET['service']) { sleep(5); } -if($_GET['mode'] == "stopservice" and $_GET['service']) { +/* stop service */ +if($_GET['mode'] == "stopservice" && $_GET['service']) { switch($_GET['service']) { + case 'bsnmpd': + killbypid("{$g['varrun_path']}/snmpd.pid"); + break; + case 'choparp': + killbyname("choparp"); + break; + case 'dhcpd': + killbyname("dhcpd"); + break; + case 'dhcrelay': + killbypid("{$g['varrun_path']}/dhcrelay.pid"); + break; + case 'dnsmasq': + killbypid("{$g['varrun_path']}/dnsmasq.pid"); + break; case 'miniupnpd': /* can't just killbyname since we need to clear pf rules */ if(file_exists('/usr/local/etc/rc.d/miniupnpd.sh')) mwexec('/usr/local/etc/rc.d/miniupnpd.sh stop'); - break; + break; + case 'ntpd': + killbyname("ntpd"); + break; + case 'sshd': + killbyname("sshd"); + break; + case 'racoon': + exec("killall -9 racoon"); default: - stop_service($_GET['service']); + stop_service($_GET['service']); break; } - $savemsg = "{$_GET['service']} has been stopped."; + $savemsg = "{$_GET['service']} " . gettext("has been stopped."); sleep(5); } @@ -207,6 +237,13 @@ if($config['installedpackages']['miniupnpd']['config'][0]['enable']) { unset($pconfig); } +if (isset($config['ipsec']['enable'])) { + $pconfig['name'] = "racoon"; + $pconfig['description'] = gettext("IPSEC VPN"); + $services[] = $pconfig; + unset($pconfig); +} + if($services) { foreach($services as $service) { if(!$service['name']) continue; -- cgit v1.1