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, []);
}