mirror of
https://github.com/opnsense/plugins.git
synced 2026-05-28 04:34:15 -04:00
parent
d54f34673b
commit
c18f3b330a
16 changed files with 126 additions and 126 deletions
|
|
@ -85,7 +85,7 @@ read := "{$config['snmpd']['rocommunity']}"
|
|||
|
||||
EOD;
|
||||
|
||||
if (isset($config['snmpd']['trapenable']) && preg_match('/^\S+$/', $config['snmpd']['trapserver'])){
|
||||
if (isset($config['snmpd']['trapenable']) && preg_match('/^\S+$/', $config['snmpd']['trapserver'])) {
|
||||
$snmpdconf .= <<<EOD
|
||||
# SNMP Trap support.
|
||||
traphost := {$config['snmpd']['trapserver']}
|
||||
|
|
@ -112,7 +112,7 @@ begemotSnmpdCommunityString.0.1 = $(read)
|
|||
|
||||
EOD;
|
||||
|
||||
if (isset($config['snmpd']['trapenable']) && preg_match('/^\S+$/', $config['snmpd']['trapserver'])){
|
||||
if (isset($config['snmpd']['trapenable']) && preg_match('/^\S+$/', $config['snmpd']['trapserver'])) {
|
||||
$snmpdconf .= <<<EOD
|
||||
begemotTrapSinkStatus.[$(traphost)].$(trapport) = 4
|
||||
begemotTrapSinkVersion.[$(traphost)].$(trapport) = 2
|
||||
|
|
@ -138,12 +138,11 @@ EOD;
|
|||
}
|
||||
}
|
||||
|
||||
if (is_port( $config['snmpd']['pollport'] )) {
|
||||
if (is_port($config['snmpd']['pollport'])) {
|
||||
$snmpdconf .= <<<EOD
|
||||
begemotSnmpdPortStatus.{$bind_to_ip}.{$config['snmpd']['pollport']} = 1
|
||||
|
||||
EOD;
|
||||
|
||||
}
|
||||
|
||||
$snmpdconf .= <<<EOD
|
||||
|
|
@ -159,7 +158,7 @@ snmpEnableAuthenTraps = 2
|
|||
|
||||
EOD;
|
||||
|
||||
if (is_array( $config['snmpd']['modules'] )) {
|
||||
if (is_array($config['snmpd']['modules'])) {
|
||||
if (isset($config['snmpd']['modules']['mibii'])) {
|
||||
$snmpdconf .= <<<EOD
|
||||
begemotSnmpdModulePath."mibII" = "/usr/lib/snmp_mibII.so"
|
||||
|
|
|
|||
|
|
@ -40,106 +40,106 @@ class M2_0_0 extends BaseModelMigration
|
|||
case 'host_starts_with':
|
||||
$acl->expression = 'hdr_beg';
|
||||
$acl->hdr_beg = (string)$acl->value;
|
||||
$acl->value = NULL;
|
||||
$acl->value = null;
|
||||
break;
|
||||
case 'host_ends_with':
|
||||
$acl->expression = 'hdr_end';
|
||||
$acl->hdr_end = (string)$acl->value;
|
||||
$acl->value = NULL;
|
||||
$acl->value = null;
|
||||
break;
|
||||
case 'host_matches':
|
||||
$acl->expression = 'hdr';
|
||||
$acl->hdr = (string)$acl->value;
|
||||
$acl->value = NULL;
|
||||
$acl->value = null;
|
||||
break;
|
||||
case 'host_regex':
|
||||
$acl->expression = 'hdr_reg';
|
||||
$acl->hdr_reg = (string)$acl->value;
|
||||
$acl->value = NULL;
|
||||
$acl->value = null;
|
||||
break;
|
||||
case 'host_contains':
|
||||
$acl->expression = 'hdr_sub';
|
||||
$acl->hdr_sub = (string)$acl->value;
|
||||
$acl->value = NULL;
|
||||
$acl->value = null;
|
||||
break;
|
||||
case 'path_starts_with':
|
||||
$acl->expression = 'path_beg';
|
||||
$acl->path_beg = (string)$acl->value;
|
||||
$acl->value = NULL;
|
||||
$acl->value = null;
|
||||
break;
|
||||
case 'path_ends_with':
|
||||
$acl->expression = 'path_end';
|
||||
$acl->path_end = (string)$acl->value;
|
||||
$acl->value = NULL;
|
||||
$acl->value = null;
|
||||
break;
|
||||
case 'path_matches':
|
||||
$acl->expression = 'path';
|
||||
$acl->path = (string)$acl->value;
|
||||
$acl->value = NULL;
|
||||
$acl->value = null;
|
||||
break;
|
||||
case 'path_regex':
|
||||
$acl->expression = 'path_reg';
|
||||
$acl->path_reg = (string)$acl->value;
|
||||
$acl->value = NULL;
|
||||
$acl->value = null;
|
||||
break;
|
||||
case 'path_contains':
|
||||
$acl->expression = 'path_dir';
|
||||
$acl->path_dir = (string)$acl->value;
|
||||
$acl->value = NULL;
|
||||
$acl->value = null;
|
||||
break;
|
||||
case 'url_parameter':
|
||||
$acl->expression = 'url_param';
|
||||
$acl->url_param_value = (string)$acl->value;
|
||||
$acl->value = NULL;
|
||||
$acl->value = null;
|
||||
break;
|
||||
case 'ssl_c_verify_code':
|
||||
$acl->ssl_c_verify_code = (string)$acl->value;
|
||||
$acl->value = NULL;
|
||||
$acl->value = null;
|
||||
break;
|
||||
case 'ssl_c_ca_commonname':
|
||||
$acl->ssl_c_ca_commonname = (string)$acl->value;
|
||||
$acl->value = NULL;
|
||||
$acl->value = null;
|
||||
break;
|
||||
case 'source_ip':
|
||||
$acl->expression = 'src';
|
||||
$acl->src = (string)$acl->value;
|
||||
$acl->value = NULL;
|
||||
$acl->value = null;
|
||||
break;
|
||||
case 'backendservercount':
|
||||
$acl->expression = 'nbsrv';
|
||||
$acl->nbsrv = (string)$acl->value;
|
||||
$acl->nbsrv_backend = (string)$acl->queryBackend;
|
||||
$acl->value = NULL;
|
||||
$acl->queryBackend = NULL;
|
||||
$acl->value = null;
|
||||
$acl->queryBackend = null;
|
||||
break;
|
||||
case 'ssl_sni_matches':
|
||||
$acl->expression = 'ssl_sni';
|
||||
$acl->ssl_sni = (string)$acl->value;
|
||||
$acl->value = NULL;
|
||||
$acl->value = null;
|
||||
break;
|
||||
case 'ssl_sni_contains':
|
||||
$acl->expression = 'ssl_sni_sub';
|
||||
$acl->ssl_sni_sub = (string)$acl->value;
|
||||
$acl->value = NULL;
|
||||
$acl->value = null;
|
||||
break;
|
||||
case 'ssl_sni_starts_with':
|
||||
$acl->expression = 'ssl_sni_beg';
|
||||
$acl->ssl_sni_beg = (string)$acl->value;
|
||||
$acl->value = NULL;
|
||||
$acl->value = null;
|
||||
break;
|
||||
case 'ssl_sni_ends_with':
|
||||
$acl->expression = 'ssl_sni_end';
|
||||
$acl->ssl_sni_end = (string)$acl->value;
|
||||
$acl->value = NULL;
|
||||
$acl->value = null;
|
||||
break;
|
||||
case 'ssl_sni_regex':
|
||||
$acl->expression = 'ssl_sni_reg';
|
||||
$acl->ssl_sni_reg = (string)$acl->value;
|
||||
$acl->value = NULL;
|
||||
$acl->value = null;
|
||||
break;
|
||||
case 'custom_acl':
|
||||
$acl->custom_acl = (string)$acl->value;
|
||||
$acl->value = NULL;
|
||||
$acl->value = null;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -149,107 +149,107 @@ class M2_0_0 extends BaseModelMigration
|
|||
switch ((string)$action->type) {
|
||||
case 'use_backend':
|
||||
$action->use_backend = (string)$action->useBackend;
|
||||
$action->useBackend = NULL;
|
||||
$action->useBackend = null;
|
||||
break;
|
||||
case 'use_server':
|
||||
$action->use_server = (string)$action->useServer;
|
||||
$action->useServer = NULL;
|
||||
$action->useServer = null;
|
||||
break;
|
||||
case 'http-request_auth':
|
||||
$action->http_request_auth = (string)$action->actionValue;
|
||||
$action->actionValue = NULL;
|
||||
$action->actionValue = null;
|
||||
break;
|
||||
case 'http-request_redirect':
|
||||
$action->http_request_redirect = (string)$action->actionValue;
|
||||
$action->actionValue = NULL;
|
||||
$action->actionValue = null;
|
||||
break;
|
||||
case 'http-request_lua':
|
||||
$action->http_request_lua = (string)$action->actionValue;
|
||||
$action->actionValue = NULL;
|
||||
$action->actionValue = null;
|
||||
break;
|
||||
case 'http-request_use-service':
|
||||
$action->http_request_use_service = (string)$action->actionValue;
|
||||
$action->actionValue = NULL;
|
||||
$action->actionValue = null;
|
||||
break;
|
||||
case 'http-request_add-header':
|
||||
$action->http_request_add_header_name = (string)$action->actionName;
|
||||
$action->http_request_add_header_content = (string)$action->actionValue;
|
||||
$action->actionName = NULL;
|
||||
$action->actionValue = NULL;
|
||||
$action->actionName = null;
|
||||
$action->actionValue = null;
|
||||
break;
|
||||
case 'http-request_set-header':
|
||||
$action->http_request_set_header_name = (string)$action->actionName;
|
||||
$action->http_request_set_header_content = (string)$action->actionValue;
|
||||
$action->actionName = NULL;
|
||||
$action->actionValue = NULL;
|
||||
$action->actionName = null;
|
||||
$action->actionValue = null;
|
||||
break;
|
||||
case 'http-request_del-header':
|
||||
$action->http_request_del_header_name = (string)$action->actionName;
|
||||
$action->actionName = NULL;
|
||||
$action->actionName = null;
|
||||
break;
|
||||
case 'http-request_replace-header':
|
||||
$action->http_request_replace_header_name = (string)$action->actionName;
|
||||
$action->http_request_replace_header_regex = (string)$action->actionFind . ' ' . (string)$action->actionValue;
|
||||
$action->actionName = NULL;
|
||||
$action->actionFind = NULL;
|
||||
$action->actionValue = NULL;
|
||||
$action->actionName = null;
|
||||
$action->actionFind = null;
|
||||
$action->actionValue = null;
|
||||
break;
|
||||
case 'http-request_replace-value':
|
||||
$action->http_request_replace_value_name = (string)$action->actionName;
|
||||
$action->http_request_replace_value_regex = (string)$action->actionFind . ' ' . (string)$action->actionValue;
|
||||
$action->actionName = NULL;
|
||||
$action->actionFind = NULL;
|
||||
$action->actionValue = NULL;
|
||||
$action->actionName = null;
|
||||
$action->actionFind = null;
|
||||
$action->actionValue = null;
|
||||
break;
|
||||
case 'http-response_lua':
|
||||
$action->http_response_lua = (string)$action->actionValue;
|
||||
$action->actionValue = NULL;
|
||||
$action->actionValue = null;
|
||||
break;
|
||||
case 'http-response_add-header':
|
||||
$action->http_response_add_header_name = (string)$action->actionName;
|
||||
$action->http_response_add_header_content = (string)$action->actionValue;
|
||||
$action->actionName = NULL;
|
||||
$action->actionValue = NULL;
|
||||
$action->actionName = null;
|
||||
$action->actionValue = null;
|
||||
break;
|
||||
case 'http-response_set-header':
|
||||
$action->http_response_set_header_name = (string)$action->actionName;
|
||||
$action->http_response_set_header_content = (string)$action->actionValue;
|
||||
$action->actionName = NULL;
|
||||
$action->actionValue = NULL;
|
||||
$action->actionName = null;
|
||||
$action->actionValue = null;
|
||||
break;
|
||||
case 'http-response_del-header':
|
||||
$action->http_response_del_header_name = (string)$action->actionName;
|
||||
$action->actionName = NULL;
|
||||
$action->actionName = null;
|
||||
break;
|
||||
case 'http-response_replace-header':
|
||||
$action->http_response_replace_header_name = (string)$action->actionName;
|
||||
$action->http_response_replace_header_regex = (string)$action->actionFind . ' ' . (string)$action->actionValue;
|
||||
$action->actionName = NULL;
|
||||
$action->actionFind = NULL;
|
||||
$action->actionValue = NULL;
|
||||
$action->actionName = null;
|
||||
$action->actionFind = null;
|
||||
$action->actionValue = null;
|
||||
break;
|
||||
case 'http-response_replace-value':
|
||||
$action->http_response_replace_value_name = (string)$action->actionName;
|
||||
$action->http_response_replace_value_regex = (string)$action->actionFind . ' ' . (string)$action->actionValue;
|
||||
$action->actionName = NULL;
|
||||
$action->actionFind = NULL;
|
||||
$action->actionValue = NULL;
|
||||
$action->actionName = null;
|
||||
$action->actionFind = null;
|
||||
$action->actionValue = null;
|
||||
break;
|
||||
case 'tcp-request_content_lua':
|
||||
$action->tcp_request_content_lua = (string)$action->actionValue;
|
||||
$action->actionValue = NULL;
|
||||
$action->actionValue = null;
|
||||
break;
|
||||
case 'tcp-request_content_use-service':
|
||||
$action->tcp_request_content_use_service = (string)$action->actionValue;
|
||||
$action->actionValue = NULL;
|
||||
$action->actionValue = null;
|
||||
break;
|
||||
case 'tcp-response_content_lua':
|
||||
$action->tcp_response_content_lua = (string)$action->actionValue;
|
||||
$action->actionValue = NULL;
|
||||
$action->actionValue = null;
|
||||
break;
|
||||
case 'custom':
|
||||
$action->custom = (string)$action->actionValue;
|
||||
$action->actionValue = NULL;
|
||||
$action->actionValue = null;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -259,26 +259,25 @@ class M2_0_0 extends BaseModelMigration
|
|||
switch ((string)$hc->type) {
|
||||
case 'agent':
|
||||
$hc->agent_port = (string)$hc->agentPort;
|
||||
$hc->agentPort = NULL;
|
||||
$hc->agentPort = null;
|
||||
break;
|
||||
case 'mysql':
|
||||
$hc->mysql_user = (string)$hc->dbUser;
|
||||
$hc->dbUser = NULL;
|
||||
$hc->dbUser = null;
|
||||
break;
|
||||
case 'pgsql':
|
||||
$hc->pgsql_user = (string)$hc->dbUser;
|
||||
$hc->dbUser = NULL;
|
||||
$hc->dbUser = null;
|
||||
break;
|
||||
case 'smtp':
|
||||
$hc->smtp_domain = (string)$hc->smtpDomain;
|
||||
$hc->smtpDomain = NULL;
|
||||
$hc->smtpDomain = null;
|
||||
break;
|
||||
case 'esmtp':
|
||||
$hc->esmtp_domain = (string)$hc->smtpDomain;
|
||||
$hc->smtpDomain = NULL;
|
||||
$hc->smtpDomain = null;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -97,9 +97,11 @@ foreach ($configNodes as $key => $value) {
|
|||
}
|
||||
// generate crt-list file
|
||||
// (this makes only sense for frontends)
|
||||
if ( $key == 'frontends' ) {
|
||||
if ($key == 'frontends') {
|
||||
// ignore if crt-list is empty
|
||||
if (empty($crtlist)) { continue; }
|
||||
if (empty($crtlist)) {
|
||||
continue;
|
||||
}
|
||||
// check if a default certificate is configured
|
||||
if (isset($child->ssl_default_certificate) and (string)$child->ssl_default_certificate != "") {
|
||||
$default_cert = (string)$child->ssl_default_certificate;
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ class ServiceController extends ApiControllerBase
|
|||
$result = array('result' => 'failed');
|
||||
$res = $backend->configdRun('mdnsrepeater status');
|
||||
if (stripos($res, 'is running')) {
|
||||
$result['result'] = 'running';
|
||||
$result['result'] = 'running';
|
||||
} elseif (stripos($res, 'not running')) {
|
||||
$general = new MDNSRepeater();
|
||||
if ((string)$general->enabled == '1') {
|
||||
|
|
@ -48,8 +48,7 @@ class ServiceController extends ApiControllerBase
|
|||
} else {
|
||||
$result['result'] = 'disabled';
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$result['message'] = $res;
|
||||
}
|
||||
return $result;
|
||||
|
|
|
|||
|
|
@ -34,6 +34,6 @@ use \OPNsense\Base\ApiMutableModelControllerBase;
|
|||
|
||||
class SettingsController extends ApiMutableModelControllerBase
|
||||
{
|
||||
static protected $internalModelClass = '\OPNsense\MDNSRepeater\MDNSRepeater';
|
||||
static protected $internalModelName = 'mdnsrepeater';
|
||||
static protected $internalModelClass = '\OPNsense\MDNSRepeater\MDNSRepeater';
|
||||
static protected $internalModelName = 'mdnsrepeater';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -308,7 +308,7 @@ function if_pppoe_interfaces()
|
|||
|
||||
if (isset($config['pppoes']['pppoe'])) {
|
||||
$pppoeifs = array('networks' => array());
|
||||
foreach($config['pppoes']['pppoe'] as $pppoe) {
|
||||
foreach ($config['pppoes']['pppoe'] as $pppoe) {
|
||||
if ($pppoe['mode'] == "server") {
|
||||
$mask = !empty($pppoe['pppoe_subnet']) ? $pppoe['pppoe_subnet'] : 32;
|
||||
$pppoeifs['networks'][] = array("network" => gen_subnet($pppoe['remoteip'], $mask), "mask" => $mask);
|
||||
|
|
|
|||
|
|
@ -283,11 +283,15 @@ function if_pptp_interfaces()
|
|||
$oic['descr'] = 'pptp';
|
||||
$mask = !empty($config['pptpd']['pptp_subnet']) ? $config['pptpd']['pptp_subnet'] : 32;
|
||||
if (isset($config['pptpd']['n_pptp_units']) && is_numeric($config['pptpd']['n_pptp_units'])) {
|
||||
$pptp_subnets = ip_range_to_subnet_array($config['pptpd']['remoteip'],
|
||||
long2ip32(ip2long($config['pptpd']['remoteip'])+($config['pptpd']['n_pptp_units']-1)));
|
||||
$pptp_subnets = ip_range_to_subnet_array(
|
||||
$config['pptpd']['remoteip'],
|
||||
long2ip32(ip2long($config['pptpd']['remoteip'])+($config['pptpd']['n_pptp_units']-1))
|
||||
);
|
||||
} else {
|
||||
$pptp_subnets = ip_range_to_subnet_array($config['pptpd']['remoteip'],
|
||||
long2ip32(ip2long($config['pptpd']['remoteip'])));
|
||||
$pptp_subnets = ip_range_to_subnet_array(
|
||||
$config['pptpd']['remoteip'],
|
||||
long2ip32(ip2long($config['pptpd']['remoteip']))
|
||||
);
|
||||
}
|
||||
foreach ($pptp_subnets as $pptp_subnet) {
|
||||
$snparts = explode("/", $pptp_subnet);
|
||||
|
|
|
|||
|
|
@ -404,5 +404,4 @@ class OspfsettingsController extends ApiMutableModelControllerBase
|
|||
{
|
||||
return $this->toggle_handler($uuid, 'prefixlists', 'prefixlist');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -158,9 +158,9 @@ function relayd_configure_do($kill_first = false)
|
|||
break;
|
||||
case 'send':
|
||||
$check_a[$type['name']] = "check {$type['type']} ";
|
||||
$check_a[$type['name']] .= !empty($type['options']['send']) ? "\"{$type['options']['send']}\"" : "\"\"" ;
|
||||
$check_a[$type['name']] .= !empty($type['options']['send']) ? "\"{$type['options']['send']}\"" : "\"\"";
|
||||
$check_a[$type['name']] .= " expect ";
|
||||
$check_a[$type['name']] .= !empty($type['options']['expect']) ? "\"{$type['options']['expect']}\"" : "\"\"" ;
|
||||
$check_a[$type['name']] .= !empty($type['options']['expect']) ? "\"{$type['options']['expect']}\"" : "\"\"";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
@ -197,12 +197,12 @@ function relayd_configure_do($kill_first = false)
|
|||
$conf .= "table <{$pool_a[$i]['name']}> {\n";
|
||||
foreach ($pool_a[$i]['servers'] as $server) {
|
||||
if (is_subnetv4($server)) {
|
||||
foreach (relayd_subnetv4_expand($server) as $ip) {
|
||||
$conf .= "\t{$ip}{$retrytext}\n";
|
||||
}
|
||||
} else {
|
||||
$conf .= "\t{$server}{$retrytext}\n";
|
||||
}
|
||||
foreach (relayd_subnetv4_expand($server) as $ip) {
|
||||
$conf .= "\t{$ip}{$retrytext}\n";
|
||||
}
|
||||
} else {
|
||||
$conf .= "\t{$server}{$retrytext}\n";
|
||||
}
|
||||
}
|
||||
$conf .= "}\n";
|
||||
/* Index by name for easier fetching when we loop through the virtual servers */
|
||||
|
|
@ -292,7 +292,7 @@ function relayd_configure_do($kill_first = false)
|
|||
}
|
||||
|
||||
$conf .= "}\n";
|
||||
} else {
|
||||
} else {
|
||||
// redirect mode
|
||||
$conf .= "redirect \"{$name}\" {\n";
|
||||
$conf .= " listen on {$ip} port {$src_port}\n";
|
||||
|
|
@ -429,8 +429,8 @@ function relayd_get_lb_summary()
|
|||
{
|
||||
$relayctl = array();
|
||||
exec('/usr/local/sbin/relayctl show summary 2>&1', $relayctl);
|
||||
$relay_hosts=Array();
|
||||
foreach( (array) $relayctl as $line) {
|
||||
$relay_hosts=array();
|
||||
foreach ((array) $relayctl as $line) {
|
||||
$t = explode("\t", $line);
|
||||
if (isset($t[1])) {
|
||||
switch (trim($t[1])) {
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ function miniupnpd_uuid()
|
|||
/* md5 hash of wan mac */
|
||||
$uuid = md5(get_interface_mac(get_real_interface("wan")));
|
||||
/* put uuid in correct format 8-4-4-4-12 */
|
||||
return substr($uuid,0,8).'-'.substr($uuid,9,4).'-'.substr($uuid,13,4).'-'.substr($uuid,17,4).'-'.substr($uuid,21,12);
|
||||
return substr($uuid, 0, 8).'-'.substr($uuid, 9, 4).'-'.substr($uuid, 13, 4).'-'.substr($uuid, 17, 4).'-'.substr($uuid, 21, 12);
|
||||
}
|
||||
|
||||
function miniupnpd_configure_do($verbose = false)
|
||||
|
|
@ -128,7 +128,7 @@ function miniupnpd_configure_do($verbose = false)
|
|||
|
||||
/* since config is written before this file invoked we don't need to read post data */
|
||||
if (!empty($upnp_config['iface_array'])) {
|
||||
foreach(explode(',', $upnp_config['iface_array']) as $iface) {
|
||||
foreach (explode(',', $upnp_config['iface_array']) as $iface) {
|
||||
/* Setting the same internal and external interface is not allowed. */
|
||||
if ($iface == $upnp_config['ext_iface']) {
|
||||
continue;
|
||||
|
|
@ -140,13 +140,13 @@ function miniupnpd_configure_do($verbose = false)
|
|||
$bits = find_interface_subnet($if);
|
||||
/* check that the interface has an ip address before adding parameters */
|
||||
if (is_ipaddr($addr)) {
|
||||
$config_text .= "listening_ip={$if}\n";
|
||||
if (!$ifaces_active) {
|
||||
$webgui_ip = $addr;
|
||||
$ifaces_active = $iface;
|
||||
} else {
|
||||
$ifaces_active .= ", {$iface}";
|
||||
}
|
||||
$config_text .= "listening_ip={$if}\n";
|
||||
if (!$ifaces_active) {
|
||||
$webgui_ip = $addr;
|
||||
$ifaces_active = $iface;
|
||||
} else {
|
||||
$ifaces_active .= ", {$iface}";
|
||||
}
|
||||
} else {
|
||||
log_error("miniupnpd: Interface {$iface} has no ip address, ignoring");
|
||||
}
|
||||
|
|
@ -191,7 +191,7 @@ function miniupnpd_configure_do($verbose = false)
|
|||
|
||||
/* set uuid and serial */
|
||||
$config_text .= "uuid=".miniupnpd_uuid()."\n";
|
||||
$config_text .= "serial=".strtoupper(substr(miniupnpd_uuid(),0,8))."\n";
|
||||
$config_text .= "serial=".strtoupper(substr(miniupnpd_uuid(), 0, 8))."\n";
|
||||
|
||||
/* set model number */
|
||||
$config_text .= "model_number=".file_get_contents("/usr/local/opnsense/version/opnsense")."\n";
|
||||
|
|
|
|||
|
|
@ -90,10 +90,10 @@ class NetworkController extends ApiMutableModelControllerBase
|
|||
{
|
||||
$result = array("result" => "failed");
|
||||
if ($this->request->isPost() && $this->request->hasPost("network")) {
|
||||
if($uuid != null) {
|
||||
if ($uuid != null) {
|
||||
$mdlZerotier = $this->getModel();
|
||||
$network = $mdlZerotier->getNodeByReference('networks.network.' . $uuid);
|
||||
if($network != null) {
|
||||
if ($network != null) {
|
||||
$network->setNodes($this->request->getPost("network"));
|
||||
$validationMessages = $mdlZerotier->performValidation();
|
||||
foreach ($validationMessages as $field => $msg) {
|
||||
|
|
@ -202,12 +202,11 @@ class NetworkController extends ApiMutableModelControllerBase
|
|||
{
|
||||
$zerotierNetworks = trim((new Backend())->configdRun("zerotier listnetworks"));
|
||||
$zerotierNetworks = explode("200 listnetworks", $zerotierNetworks);
|
||||
foreach($zerotierNetworks as $zerotierNetwork) {
|
||||
if(strpos($zerotierNetwork, $networkId) !== false) {
|
||||
foreach ($zerotierNetworks as $zerotierNetwork) {
|
||||
if (strpos($zerotierNetwork, $networkId) !== false) {
|
||||
return $zerotierNetwork;
|
||||
}
|
||||
}
|
||||
return gettext("Unable to obtain Zerotier information for network") . " " . $networkId . "! " . gettext("Is the network enabled?");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ class SettingsController extends ApiMutableModelControllerBase
|
|||
$result = array();
|
||||
if ($this->request->isGet()) {
|
||||
$mdlZerotier = $this->getModel();
|
||||
if(empty($mdlZerotier->localconf->__toString())) {
|
||||
if (empty($mdlZerotier->localconf->__toString())) {
|
||||
$mdlZerotier->localconf = '{}';
|
||||
}
|
||||
$result = array("zerotier" => $mdlZerotier->getNodes());
|
||||
|
|
@ -59,7 +59,7 @@ class SettingsController extends ApiMutableModelControllerBase
|
|||
public function setAction()
|
||||
{
|
||||
$result = array("result" => "failed");
|
||||
if($this->request->isPost() && $this->request->hasPost("zerotier")) {
|
||||
if ($this->request->isPost() && $this->request->hasPost("zerotier")) {
|
||||
$mdlZerotier = $this->getModel();
|
||||
$mdlZerotier->setNodes($this->request->getPost("zerotier"));
|
||||
$mdlZerotier->serializeToConfig();
|
||||
|
|
@ -101,5 +101,4 @@ class SettingsController extends ApiMutableModelControllerBase
|
|||
$action = $enabled ? "start" : "stop";
|
||||
return trim($backend->configdRun("zerotier $action"));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ class OverviewController extends \OPNsense\Base\IndexController
|
|||
|
||||
private function invokeConfigdRun($action)
|
||||
{
|
||||
if(!zerotier_enabled()) {
|
||||
if (!zerotier_enabled()) {
|
||||
return (object)[];
|
||||
}
|
||||
$result = json_decode(trim((new Backend())->configdRun("zerotier $action")), true);
|
||||
|
|
|
|||
|
|
@ -1146,7 +1146,8 @@ function local_cert_get_cn($crt, $decode = true)
|
|||
}
|
||||
|
||||
// taken from system_camanager.php
|
||||
function local_ca_import(& $ca, $str, $key="", $serial=0) {
|
||||
function local_ca_import(& $ca, $str, $key = "", $serial = 0)
|
||||
{
|
||||
global $config;
|
||||
|
||||
$ca['crt'] = base64_encode($str);
|
||||
|
|
@ -1160,9 +1161,9 @@ function local_ca_import(& $ca, $str, $key="", $serial=0) {
|
|||
$issuer = cert_get_issuer($str, false);
|
||||
|
||||
// Find my issuer unless self-signed
|
||||
if($issuer <> $subject) {
|
||||
if ($issuer <> $subject) {
|
||||
$issuer_crt =& lookup_ca_by_subject($issuer);
|
||||
if($issuer_crt) {
|
||||
if ($issuer_crt) {
|
||||
$ca['caref'] = $issuer_crt['refid'];
|
||||
}
|
||||
}
|
||||
|
|
@ -1171,7 +1172,7 @@ function local_ca_import(& $ca, $str, $key="", $serial=0) {
|
|||
if (is_array($config['ca'])) {
|
||||
foreach ($config['ca'] as & $oca) {
|
||||
$issuer = cert_get_issuer($oca['crt']);
|
||||
if($ca['refid']<>$oca['refid'] && $issuer==$subject) {
|
||||
if ($ca['refid']<>$oca['refid'] && $issuer==$subject) {
|
||||
$oca['caref'] = $ca['refid'];
|
||||
}
|
||||
}
|
||||
|
|
@ -1179,7 +1180,7 @@ function local_ca_import(& $ca, $str, $key="", $serial=0) {
|
|||
if (is_array($config['cert'])) {
|
||||
foreach ($config['cert'] as & $cert) {
|
||||
$issuer = cert_get_issuer($cert['crt']);
|
||||
if($issuer==$subject) {
|
||||
if ($issuer==$subject) {
|
||||
$cert['caref'] = $ca['refid'];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ class SettingsController extends ApiMutableModelControllerBase
|
|||
return array("network" => $node->getNodes());
|
||||
}
|
||||
}
|
||||
return array() ;
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -76,7 +76,7 @@ class SettingsController extends ApiMutableModelControllerBase
|
|||
$node = $this->getModel()->networks->network->Add();
|
||||
}
|
||||
$node->setNodes($this->request->getPost("network"));
|
||||
if (empty((string)$node->pubkey) || empty((string)$node->privkey)){
|
||||
if (empty((string)$node->pubkey) || empty((string)$node->privkey)) {
|
||||
// generate new keypair
|
||||
$backend = new Backend();
|
||||
$keys = json_decode(trim($backend->configdRun("tinc gen-key")), true);
|
||||
|
|
@ -117,7 +117,7 @@ class SettingsController extends ApiMutableModelControllerBase
|
|||
$result = $this->validateAndSave();
|
||||
}
|
||||
}
|
||||
return $result ;
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -166,7 +166,7 @@ class SettingsController extends ApiMutableModelControllerBase
|
|||
return array("host" => $node->getNodes());
|
||||
}
|
||||
}
|
||||
return array() ;
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -217,7 +217,7 @@ class SettingsController extends ApiMutableModelControllerBase
|
|||
$result = $this->validateAndSave();
|
||||
}
|
||||
}
|
||||
return $result ;
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -44,14 +44,13 @@ $generalNode = $mdlMonit->getNodeByReference('general');
|
|||
|
||||
// generate password for local Monit plugin user
|
||||
if (empty($cfgObj->general->httpdUsername) && empty($cfgObj->general->httpdPassword)) {
|
||||
srand();
|
||||
$generalNode->setNodes(array(
|
||||
srand();
|
||||
$generalNode->setNodes(array(
|
||||
"httpdUsername" => "root",
|
||||
"httpdPassword" => substr(str_shuffle(str_repeat('0123456789AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz', 32)), rand(0, 16), rand(17, 32))
|
||||
)
|
||||
);
|
||||
$mdlMonit->serializeToConfig(false, true);
|
||||
$cfg->save();
|
||||
));
|
||||
$mdlMonit->serializeToConfig(false, true);
|
||||
$cfg->save();
|
||||
}
|
||||
|
||||
$nodes = $mdlMonit->getNodes();
|
||||
|
|
@ -91,7 +90,7 @@ if (!empty($cfgObj->notifications->smtp->notifyemailaddress)) {
|
|||
$alertSettings['recipient'] = $cfgObj->notifications->smtp->notifyemailaddress;
|
||||
}
|
||||
if (!empty($cfgObj->notifications->smtp->fromaddress)) {
|
||||
$alertSettings['format'] = 'from: ' . $cfgObj->notifications->smtp->fromaddress;
|
||||
$alertSettings['format'] = 'from: ' . $cfgObj->notifications->smtp->fromaddress;
|
||||
}
|
||||
|
||||
// define some tests
|
||||
|
|
|
|||
Loading…
Reference in a new issue