0-complexity / openvcloud

OpenvCloud
Other
2 stars 4 forks source link

FR: close socks proxy on ROS upon ROS creation #1834

Closed dinosn closed 5 years ago

dinosn commented 5 years ago

Hi we don't need the service and it's abused.

I made a simple script to close the service on a running environment but this should be per default on new ROS

from JumpScale import j

descr = """
Upgrade script
Updates ROS configuration - disable socks proxy
"""

category = "libvirt"
organization = "greenitglobe"
author = "none"
license = "bsd"
version = "2.0"
roles = ["master"]
async = True

def action():
    acl = j.clients.agentcontroller.get()
    vcl = j.clients.osis.getNamespace("vfw")
    vfws = vcl.virtualfirewall.search({}, size=0)[1:]

    args = dict()
    args["script"] = "/ip socks set enabled=no"
    for vfw in vfws:
        args["fwobject"] = vfw
        try:
            acl.executeJumpscript(
                "jumpscale",
                "vfs_runscript_routeros",
                args=args,
                nid=vfw["nid"],
                gid=vfw["gid"],
                timeout=5,
            )
        except:
            j.errorconditionhandler.raiseOperationalWarning(
                "Can't connect to routeros {}".format(vfw["guid"])
            )

if __name__ == "__main__":
    action()
FastGeert commented 5 years ago