summaryrefslogtreecommitdiffstats
path: root/etc/inc/vpn.inc
diff options
context:
space:
mode:
Diffstat (limited to 'etc/inc/vpn.inc')
-rw-r--r--etc/inc/vpn.inc62
1 files changed, 31 insertions, 31 deletions
diff --git a/etc/inc/vpn.inc b/etc/inc/vpn.inc
index 10f2fc1..1e6780f 100644
--- a/etc/inc/vpn.inc
+++ b/etc/inc/vpn.inc
@@ -121,7 +121,7 @@ function vpn_ipsec_configure($ipchg = false)
mwexec("/sbin/sysctl net.inet.ip.ipsec_in_use=1");
if ($g['booting'])
- echo "Configuring IPsec VPN... ";
+ echo gettext("Configuring IPsec VPN... ");
/* fastforwarding is not compatible with ipsec tunnels */
mwexec("/sbin/sysctl net.inet.ip.fastforwarding=0");
@@ -228,18 +228,18 @@ function vpn_ipsec_configure($ipchg = false)
if (is_array($config['ca']) && count($config['ca'])) {
foreach ($config['ca'] as $ca) {
if (!isset($ca['crt'])) {
- log_error("Error: Invalid certificate info for {$ca['descr']}");
+ log_error(sprintf(gettext("Error: Invalid certificate info for %s"), $ca['descr']));
continue;
}
$cert = base64_decode($ca['crt']);
$x509cert = openssl_x509_parse(openssl_x509_read($cert));
if (!is_array($x509cert) || !isset($x509cert['hash'])) {
- log_error("Error: Invalid certificate hash info for {$ca['descr']}");
+ log_error(sprintf(gettext("Error: Invalid certificate hash info for %s"), $ca['descr']));
continue;
}
$fname = $g['varetc_path']."/".$x509cert['hash'].".0";
if (!file_put_contents($fname, $cert)) {
- log_error("Error: Cannot write IPsec CA file for {$ca['descr']}");
+ log_error(sprintf(gettext("Error: Cannot write IPsec CA file for %s"), $ca['descr']));
continue;
}
}
@@ -248,7 +248,7 @@ function vpn_ipsec_configure($ipchg = false)
/* generate psk.txt */
$fd = fopen("{$g['varetc_path']}/psk.txt", "w");
if (!$fd) {
- printf("Error: cannot open psk.txt in vpn_ipsec_configure().\n");
+ printf(gettext("Error: cannot open psk.txt in vpn_ipsec_configure().") . "\n");
return 1;
}
@@ -311,7 +311,7 @@ function vpn_ipsec_configure($ipchg = false)
$fd = fopen("{$g['varetc_path']}/racoon.conf", "w");
if (!$fd) {
- printf("Error: cannot open racoon.conf in vpn_ipsec_configure().\n");
+ printf(gettext("Error: cannot open racoon.conf in vpn_ipsec_configure().") . "\n");
return 1;
}
@@ -403,7 +403,7 @@ function vpn_ipsec_configure($ipchg = false)
$fn = "{$g['varetc_path']}/racoon.motd";
$fd1 = fopen($fn, "w");
if (!$fd1) {
- printf("Error: cannot open server{$fn} in vpn.\n");
+ printf(gettext("Error: cannot open server %s in vpn.%s"). $fn, "\n");
return 1;
}
@@ -534,7 +534,7 @@ function vpn_ipsec_configure($ipchg = false)
if (!$cert)
{
- log_error("Error: Invalid phase1 certificate reference for {$ph1ent['name']}");
+ log_error(sprintf(gettext("Error: Invalid phase1 certificate reference for %s"), $ph1ent['name']));
continue;
}
@@ -543,7 +543,7 @@ function vpn_ipsec_configure($ipchg = false)
if (!file_put_contents($certpath, base64_decode($cert['crt'])))
{
- log_error("Error: Cannot write phase1 certificate file for {$ph1ent['name']}");
+ log_error(sprintf(gettext("Error: Cannot write phase1 certificate file for %s"), $ph1ent['name']));
continue;
}
@@ -554,7 +554,7 @@ function vpn_ipsec_configure($ipchg = false)
if (!file_put_contents($keypath, base64_decode($cert['prv'])))
{
- log_error("Error: Cannot write phase1 key file for {$ph1ent['name']}");
+ log_error(sprintf(gettext("Error: Cannot write phase1 key file for %s"), $ph1ent['name']));
continue;
}
@@ -567,7 +567,7 @@ function vpn_ipsec_configure($ipchg = false)
if (!file_put_contents($capath, base64_decode($ca['crt'])))
{
- log_error("Error: Cannot write phase1 CA certificate file for {$ph1ent['name']}");
+ log_error(sprintf(gettext("Error: Cannot write phase1 CA certificate file for %s"), $ph1ent['name']));
continue;
}
@@ -800,7 +800,7 @@ EOD;
/* generate spd.conf */
$fd = fopen("{$g['varetc_path']}/spd.conf", "w");
if (!$fd) {
- printf("Error: cannot open spd.conf in vpn_ipsec_configure().\n");
+ printf(gettext("Error: cannot open spd.conf in vpn_ipsec_configure().") . "\n");
return 1;
}
@@ -985,7 +985,7 @@ function vpn_ipsec_force_reload() {
/* if ipsec is enabled, start up again */
if (isset($ipseccfg['enable'])) {
- log_error("Forcefully reloading IPsec racoon daemon");
+ log_error(gettext("Forcefully reloading IPsec racoon daemon"));
vpn_ipsec_configure();
}
@@ -1024,7 +1024,7 @@ function vpn_pptpd_configure() {
if (!$pptpdcfg['mode'] || ($pptpdcfg['mode'] == "off"))
return 0;
- echo "Configuring PPTP VPN service... ";
+ echo gettext("Configuring PPTP VPN service... ");
} else {
/* kill mpd */
killbypid("{$g['varrun_path']}/pptp-vpn.pid");
@@ -1034,7 +1034,7 @@ function vpn_pptpd_configure() {
if (is_process_running("mpd -b")) {
killbypid("{$g['varrun_path']}/pptp-vpn.pid");
- log_error("Could not kill mpd within 3 seconds. Trying again.");
+ log_error(gettext("Could not kill mpd within 3 seconds. Trying again."));
}
/* remove mpd.conf, if it exists */
@@ -1052,7 +1052,7 @@ function vpn_pptpd_configure() {
/* write mpd.conf */
$fd = fopen("{$g['varetc_path']}/pptp-vpn/mpd.conf", "w");
if (!$fd) {
- printf("Error: cannot open mpd.conf in vpn_pptpd_configure().\n");
+ printf(gettext("Error: cannot open mpd.conf in vpn_pptpd_configure().") . "\n");
return 1;
}
@@ -1165,7 +1165,7 @@ EOD;
/* write mpd.links */
$fd = fopen("{$g['varetc_path']}/pptp-vpn/mpd.links", "w");
if (!$fd) {
- printf("Error: cannot open mpd.links in vpn_pptpd_configure().\n");
+ printf(gettext("Error: cannot open mpd.links in vpn_pptpd_configure().") . "\n");
return 1;
}
@@ -1189,7 +1189,7 @@ EOD;
/* write mpd.secret */
$fd = fopen("{$g['varetc_path']}/pptp-vpn/mpd.secret", "w");
if (!$fd) {
- printf("Error: cannot open mpd.secret in vpn_pptpd_configure().\n");
+ printf(gettext("Error: cannot open mpd.secret in vpn_pptpd_configure().") . "\n");
return 1;
}
@@ -1243,7 +1243,7 @@ function vpn_pppoe_configure(&$pppoecfg) {
if (!$pppoecfg['mode'] || ($pppoecfg['mode'] == "off"))
return 0;
- echo "Configuring PPPoE VPN service... ";
+ echo gettext("Configuring PPPoE VPN service... ");
} else {
/* kill mpd */
killbypid("{$g['varrun_path']}/pppoe{$pppoecfg['pppoeid']}-vpn.pid");
@@ -1267,7 +1267,7 @@ function vpn_pppoe_configure(&$pppoecfg) {
/* write mpd.conf */
$fd = fopen("{$g['varetc_path']}/pppoe{$pppoecfg['pppoeid']}-vpn/mpd.conf", "w");
if (!$fd) {
- printf("Error: cannot open mpd.conf in vpn_pppoe_configure().\n");
+ printf(gettext("Error: cannot open mpd.conf in vpn_pppoe_configure().") . "\n");
return 1;
}
$mpdconf = "\n\n";
@@ -1370,7 +1370,7 @@ EOD;
/* write mpd.links */
$fd = fopen("{$g['varetc_path']}/pppoe{$pppoecfg['pppoeid']}-vpn/mpd.links", "w");
if (!$fd) {
- printf("Error: cannot open mpd.links in vpn_pppoe_configure().\n");
+ printf(gettext("Error: cannot open mpd.links in vpn_pppoe_configure().") . "\n");
return 1;
}
@@ -1396,7 +1396,7 @@ EOD;
/* write mpd.secret */
$fd = fopen("{$g['varetc_path']}/pppoe{$pppoecfg['pppoeid']}-vpn/mpd.secret", "w");
if (!$fd) {
- printf("Error: cannot open mpd.secret in vpn_pppoe_configure().\n");
+ printf(gettext("Error: cannot open mpd.secret in vpn_pppoe_configure().") . "\n");
return 1;
}
@@ -1424,7 +1424,7 @@ EOD;
}
if ($g['booting'])
- echo "done\n";
+ echo gettext("done") . "\n";
return 0;
}
@@ -1443,7 +1443,7 @@ function vpn_l2tp_configure() {
if (!$l2tpcfg['mode'] || ($l2tpcfg['mode'] == "off"))
return 0;
- echo "Configuring l2tp VPN service... ";
+ echo gettext("Configuring l2tp VPN service... ");
} else {
/* kill mpd */
killbypid("{$g['varrun_path']}/l2tp-vpn.pid");
@@ -1468,7 +1468,7 @@ function vpn_l2tp_configure() {
/* write mpd.conf */
$fd = fopen("{$g['varetc_path']}/l2tp-vpn/mpd.conf", "w");
if (!$fd) {
- printf("Error: cannot open mpd.conf in vpn_l2tp_configure().\n");
+ printf(gettext("Error: cannot open mpd.conf in vpn_l2tp_configure().") . "\n");
return 1;
}
$mpdconf = "\n\n";
@@ -1561,7 +1561,7 @@ EOD;
/* write mpd.links */
$fd = fopen("{$g['varetc_path']}/l2tp-vpn/mpd.links", "w");
if (!$fd) {
- printf("Error: cannot open mpd.links in vpn_l2tp_configure().\n");
+ printf(gettext("Error: cannot open mpd.links in vpn_l2tp_configure().") . "\n");
return 1;
}
@@ -1586,7 +1586,7 @@ EOD;
/* write mpd.secret */
$fd = fopen("{$g['varetc_path']}/l2tp-vpn/mpd.secret", "w");
if (!$fd) {
- printf("Error: cannot open mpd.secret in vpn_l2tp_configure().\n");
+ printf(gettext("Error: cannot open mpd.secret in vpn_l2tp_configure().") . "\n");
return 1;
}
@@ -1733,15 +1733,15 @@ function reload_tunnel_spd_policy($phase1, $phase2, $old_phase1, $old_phase2) {
$rgip = $phase1['remote-gateway'];
}
if (!$ep) {
- log_error("Could not determine VPN endpoint for '{$phase1['descr']}'");
+ log_error(sprintf(gettext("Could not determine VPN endpoint for '%s'"), $phase1['descr']));
return false;
}
if((!is_ipaddr($old_ep)) || (! is_ipaddr($ep))) {
- log_error("IPSEC: ERROR: One of the endpoints is not a IP address. Old EP '{$old_ep}' new EP '{$ep}'");
+ log_error(sprintf(gettext("IPSEC: ERROR: One of the endpoints is not a IP address. Old EP '%1\$s' new EP '%2\$s'"), $old_ep, $ep));
}
if((! is_ipaddr($rgip)) || (! is_ipaddr($old_gw))) {
- log_error("IPSEC: ERROR: One of the remote endpoints is not a IP address. Old RG '{$old_gw}' new RG '{$rgip}'");
+ log_error(sprintf(gettext("IPSEC: ERROR: One of the remote endpoints is not a IP address. Old RG '%1\$s' new RG '%2\$s'"), $old_gw, $rgip));
}
$spdconf = "";
@@ -1797,7 +1797,7 @@ function reload_tunnel_spd_policy($phase1, $phase2, $old_phase1, $old_phase2) {
"{$phase2['protocol']}/tunnel/{$rgip}-" .
"{$ep}/unique;\n";
- log_error("Reloading IPsec tunnel '{$phase1['descr']}'. Previous IP '{$old_gw}', current IP '{$rgip}'. Reloading policy");
+ log_error(sprintf(gettext("Reloading IPsec tunnel '%1\$s'. Previous IP '%2\$s', current IP '%3\$s'. Reloading policy"), $phase1['descr'], $old_gw, $rgip));
$now = time();
$spdfile = tempnam("{$g['tmp_path']}", "spd.conf.reload.{$now}.");
OpenPOWER on IntegriCloud