Versionen im Vergleich

Schlüssel

  • Diese Zeile wurde hinzugefügt.
  • Diese Zeile wurde entfernt.
  • Formatierung wurde geändert.
Seiteneigenschaften



Mit diesem Add-in-Skript können Sie IP-Adressen, Bereiche oder Netzwerke konfigurieren, auf welche nicht zugegriffen werden darf.

Add-in Code:

Deutsch

Beschreibung:

Liste der verwendeten Variablen:

VariableBeschreibung

/**
 * @param {Config} config
 * @param {Context} context
 * Do not edit this comment or parameter types. Required for code suggestions
*/
exports.main = function (config, context) {
   

// Function to create VRRP Entry

var fwVersion = context.device.firmwareVersionObject;
    var

addVRRPEntry

ufApi =

function (routerID, routerIP, mainPrio, backupPrio, remoteSite, comment) {

config.getUfApi();
   

    var table1_2_8_21_2 = config.getTableByOid("1.2.8.21.2");

var blockAddresses = function () {
       

var table_1_2_8_21_2_row_1 = table1_2_8_21_2.createNewRow();

ufApi.raw({
       

table_1_2_8_21_2_row_1.setByOid(1, routerID);
        table_1_2_8_21_2_row_1.setByOid(2, routerIP);
        table_1_2_8_21_2_row_1.setByOid(3, mainPrio);
        table_1_2_8_21_2_row_1.setByOid(4, backupPrio);
        table_1_2_8_21_2_row_1.setByOid(5, remoteSite);
        table_1_2_8_21_2_row_1.setByOid(6, comment);
        table1_2_8_21_2.addOrMerge(table_1_2_8_21_2_row_1);

    method: 'PUT',
            uri: '/model/blocked-ips-settings/',
            body:
            {
                "blockedAddresses": [ // Fill with ip-addresses, ip-networks or ip-ranges as the example below
                    "2.2.2.2",
                    "2.2.2.0/24",
                    "2.2.2.2-2.2.2.3"
                ]
            },
            failOnError: false
        })



    };

   

// If Statement to only create VRRP Entry, if device has the variable VRRP_Prio
    if (context.vars.VRRP_PRIO != "") {
"1.2.8.21.1", "1");
        // Function Call to create a new Entry

if (fwVersion.major < 11) {
        if (fwVersion.major == 10 && fwVersion.minor >= 13 && fwVersion.patch >= 6915) {
            blockAddresses();
        }
        else {
            config.

setScalarByOid(

warnLog("The current installed FirmwareVersion does not support the BlockedAddresses Script.")
        }
    }
    else {


       

addVRRPEntry("1", "10.10.10.254", context.vars.VRRP_PRIO, "0", "INTERNET", ""

blockAddresses();
    }
};

Add-in als JSON-Datei:

View file
nameblocked-addresses.json
height150


You can use this add-in script to configure IP addresses, areas or networks that must not be accessed.

Add-in code:

Englisch

Description:

List of used variables:

VariableDescription

/**
 * @param {Config} config
 * @param {Context} context
 * Do not edit this comment or parameter types. Required for code suggestions
*/
exports.main = function (config, context) {
   

// Function to create VRRP Entry

var fwVersion = context.device.firmwareVersionObject;
    var

addVRRPEntry

ufApi =

function (routerID, routerIP, mainPrio, backupPrio, remoteSite, comment) {

config.getUfApi();
   

    var table1_2_8_21_2 = config.getTableByOid("1.2.8.21.2");

var blockAddresses = function () {
       

var table_1_2_8_21_2_row_1 = table1_2_8_21_2.createNewRow();
        table_1_2_8_21_2_row_1.setByOid(1, routerID);
        table_1_2_8_21_2_row_1.setByOid(2, routerIP);
        table_1_2_8_21_2_row_1.setByOid(3, mainPrio);
        table_1_2_8_21_2_row_1.setByOid(4, backupPrio);
        table_1_2_8_21_2_row_1.setByOid(5, remoteSite);
        table_1_2_8_21_2_row_1.setByOid(6, comment);
        table1_2_8_21_2.addOrMerge(table_1_2_8_21_2_row_1);

ufApi.raw({
            method: 'PUT',
            uri: '/model/blocked-ips-settings/',
            body:
            {
                "blockedAddresses": [ // Fill with ip-addresses, ip-networks or ip-ranges as the example below
                    "2.2.2.2",
                    "2.2.2.0/24",
                    "2.2.2.2-2.2.2.3"
                ]
            },
            failOnError: false
        })



    };

   

// If Statement to only create VRRP Entry, if device has the variable VRRP_Prio

if (fwVersion.major < 11) {
        if (

context.vars.VRRP_PRIO != "")

fwVersion.major == 10 && fwVersion.minor >= 13 && fwVersion.patch >= 6915) {
            blockAddresses();
        }
        else {
            config.

setScalarByOid, "1");
        // Function Call to create a new Entry

warnLog("

1.2.8.21.1"

The current installed FirmwareVersion does not support the BlockedAddresses Script.")
        }
    }
    else {


       

addVRRPEntry("1", "10.10.10.254", context.vars.VRRP_PRIO, "0", "INTERNET", ""

blockAddresses();
    }
};

Add-in as JSON file:

View file
nameblocked-addresses.json
height150