25 lines
889 B
PHP
25 lines
889 B
PHP
<?php
|
|
require_once("config.inc");
|
|
require_once("filter.inc");
|
|
global $config;
|
|
init_config_arr(array('nat','outbound','rule'));
|
|
$rules =& $config['nat']['outbound']['rule'];
|
|
foreach ($rules as $r) {
|
|
if (($r['source']['network'] ?? '') === '172.16.3.20/32' && ($r['target'] ?? '') === '72.194.62.10') { echo "ALREADY_EXISTS\n"; exit(0); }
|
|
}
|
|
$new = array(
|
|
'source' => array('network' => '172.16.3.20/32'),
|
|
'sourceport' => '',
|
|
'descr' => 'NPM rmm-api server->agent reply source pin -> 72.194.62.10 (RMM cmd-delivery diag)',
|
|
'target' => '72.194.62.10',
|
|
'target_subnet' => '',
|
|
'interface' => 'wan',
|
|
'poolopts' => '',
|
|
'source_hash_key' => '',
|
|
'destination' => array('any' => ''),
|
|
);
|
|
array_unshift($rules, $new);
|
|
write_config("Add NPM (172.16.3.20) outbound SNAT pin -> 72.194.62.10");
|
|
$ret = filter_configure();
|
|
echo "ADDED ret=$ret total_outbound_rules=".count($rules)."\n";
|