cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Creating a script in MOSAIC Device Manager to disable WAN HTTP/HTTPS access on your CPE Devices

Creating a script in MOSAIC Device Manager to disable WAN HTTP/HTTPS access on your CPE Devices

  1. Log into your instance of MOSAIC Device Manager.
  2. Go to Administration->Scripts. Click the green + to create a new script.

    ehudson1_0-1619543174858.png

  3. Set the Name and Code fields to Disable WAN HTTP/HTTPS Access.
  4. Select the Bulk Operations check box.
  5. Enter the following code:

    useLibrary("settings", "sync", "tr069");
    
    settings = CA.Core.getSettings();
    
    log.info("Explicitly disabling WAN Access.");
    settings.AccessControl = settings.AccessControl || {};
    settings.AccessControl.HTTP = settings.AccessControl.HTTP || {};
    settings.AccessControl.HTTPS = settings.AccessControl.HTTPS || {};
    settings.AccessControl.HTTP.WAN = "false";
    settings.AccessControl.HTTPS.WAN = "false";
    
    var toPush = [],
        root = CA.Core.getRoot();
    
    
    if(settings.ClickThrough && settings.ClickThrough.IsEnabled == "true") { // If clickthrough is currently enabled, expire its link & sync.
        var currDate = new Date(new Date() - 60000); // current time - 1 min
        settings.ClickThrough.ExpirationDate = currDate.toGMTString();
        toPush.push("ClickThrough");
    } else { // if clickthrough is not currently enabled, we don't need to go through it.
        toPush.push("AccessControl");
    }
    
    CA.Core.setSettings(settings);
    if (root === "Device") { // tr181 devices may be having difficulty pulling AccessControl params, but will still let us set them, which may also knock their senses back
        tr069.set("Device.UserInterface.RemoteAccess.Enable", eB(false));
    } else {
        sync.syncApps(toPush, []);
    }
    

    DisableWANAccessv3PNG.PNG

  6. Click Save and the script should now be available to use in Bulk Operations.
Version history
Last update:
‎04-27-2021 04:16 PM
Updated by: