Ejemplo n.º 1
0
    def form_addTime(self, data):
        acls = []

        for ip, i in self.sysconf.ProxyConfig.get('srcacls', []):
            acls.append((i,i))

        for n, i in self.sysconf.ProxyConfig.get('aclusers', []):
            acls.append((i,i))

        for n, i in self.sysconf.ProxyConfig.get('domacls', []):
            acls.append((i,i))

        form = formal.Form(self.submitTime)[        
            formal.Field('allow', formal.Boolean(), label = "Allow",
                description = "Allow traffic at these times"),
            formal.Field('from', formal.Time(required=True), label = "From time", 
                description = "Starting time (24 hour format)"),
            formal.Field('to', formal.Time(required=True), label = "To time", 
                description = "Ending time (24 hour format), must be later than the starting time and must not overlap midnight"),

            formal.Field('domain', formal.String(), label = "Domain", 
                description = "Apply this rule to a specific domain"), 

            formal.Field('exacl', formal.String(), formal.widgetFactory(formal.SelectChoice, options = acls), label = "Extra ACL", 
                description = "Apply this rule to a specific other ACL"),
            
            formal.Group('Days')[
                [ formal.Field(i, formal.Boolean(), label = i) for i in PageHelpers.days ]
            ]
        ]
        form.data['from'] = datetime.time(0,0)
        form.data['to'] = datetime.time(23,59)
        form.addAction(self.submitTime)
        return form
Ejemplo n.º 2
0
Archivo: VPN.py Proyecto: calston/tums
    def form_vpnForm(self, data):
        """ OpenVPN (Vulani VPN) form""" 
        form = formal.Form()

        form.addField('openvpn', formal.Boolean(), label = self.text.vpnLabelOpenvpn, description=self.text.vpnDescripOpenvpn)

        form.addField('iprange1', formal.String(required=True), label = self.text.vpnRangeStart)
        form.addField('iprange2', formal.String(required=True), label = self.text.vpnRangeTo)

        form.addField('mtu', formal.String(), label = self.text.vpnMTU)

        form.addField('WINS', formal.String(strip=True, validators=[PageHelpers.IPValidator()]), label = self.text.vpnWINSServer)
        form.addField('DNS', formal.String(), label = self.text.vpnDNSServer)
        form.addField('DOMAIN', formal.String(), label = self.text.vpnDomain)

        form.addField('tcp', formal.Boolean(), label = "Use TCP", description = "Use TCP instead of UDP for connections. Not recommended, but helps with connection issues from high packet-loss sites like GPRS or 3G, at the expense of performance. TCP port 1194 needs to be opened in the firewall for this to be successful")
        
        def returnForm(result):
            print result
            conf, routes = result 
            form.addField(
                'routes', formal.Sequence(formal.String()),
                formal.widgetFactory(formal.CheckboxMultiChoice, [(i,i) for i in routes]), 
                label = self.text.vpnRoutesPush
            )

            form.data = conf
            form.addAction(self.submitForm)
            return form
                
        return VPN.get_openvpn_settings(self.sysconf).addBoth(returnForm)
Ejemplo n.º 3
0
    def form_authentication(self, data):
        form = formal.Form()

        form.addField('ldapauth',
                      formal.Boolean(),
                      label="Default local authentication")

        form.addField('adauth',
                      formal.Boolean(),
                      label="Active Directory authentication")

        form.addField('adserv',
                      formal.String(),
                      label="Active Directory Server")
        form.addField('addom',
                      formal.String(),
                      label="Active Directory Domain")

        form.addAction(self.submitAuth)

        k = self.sysconf.ProxyConfig
        data = {}
        if k.get('adauth', ''):
            data['ldapauth'] = False
            data['adauth'] = True
        else:
            data['ldapauth'] = True
            data['adauth'] = False

        data['adserv'] = k.get('adserver', u'').encode()
        data['addom'] = k.get('addom', u'').encode()

        form.data = data

        return form
Ejemplo n.º 4
0
 def _create_user_list_entry(self, index):
     g = formalutils.CollapsibleGroup(str(index), label='')
     g.setCollapsed(False)
     g.add(
         formalutils.Field('username',
                           formal.String(required=True),
                           label='Username'))
     g.add(
         formalutils.Field('password',
                           formal.String(required=False),
                           formal.widgetFactory(
                               formalutils.SemiHiddenPassword),
                           label='Set password'))
     g.add(
         formalutils.Field('fixed_ip',
                           dt.FormIPv4Address(required=False),
                           label='Fixed IP address'))
     g.add(
         formalutils.Field('admin_rights',
                           formal.Boolean(required=True),
                           label='Allow VPNease administration'))
     g.add(
         formalutils.Field('vpn_rights',
                           formal.Boolean(required=True),
                           label='Allow VPN access'))
     return g
Ejemplo n.º 5
0
    def form_configSamba(self, data):
        form = formal.Form()

        form.addField('pdc', formal.Boolean(), label="Domain controller")
        form.addField('profileroam',
                      formal.Boolean(),
                      label="Roaming profiles")
        form.addField(
            'logscript',
            formal.Boolean(),
            label="Login script",
            description="Enable the kixstart login script for drive mapping")

        form.addAction(self.submitConfForm)

        smbcfg = self.sysconf.SambaConfig

        if smbcfg.get('logon script'):
            form.data['logscript'] = True

        if smbcfg.get('logon path', None):
            if smbcfg['logon path']:
                form.data['profileroam'] = True
        if smbcfg.get('domain logons', None):
            if smbcfg['domain logons'] == 'yes':
                form.data['pdc'] = True
        return form
Ejemplo n.º 6
0
Archivo: DNS.py Proyecto: calston/tums
    def form_editZone(self, data):
        form = formal.Form()

        form.addField('master', formal.Boolean(), label="Master")
        form.addField('notify', formal.Boolean(), label="Notify slaves")
        form.addField(
            'update',
            formal.String(),
            label="Update",
            description=
            "Comma sepparated list of hosts allowed to update this zone")

        form.addField(
            'ns',
            formal.String(),
            label="Nameservers",
            description=
            "Comma sepparated list of authoritive servers for this zone")

        # populate form
        Z = self.sysconf.General['zones'][self.domain]

        form.data['ns'] = ', '.join(Z['ns'])
        form.data['update'] = ', '.join(Z['update'])

        form.data['master'] = "type master" in Z['options']
        form.data['notify'] = "notify no" not in Z['options']

        form.addAction(self.submitZone)
        return form
Ejemplo n.º 7
0
    def form_inetPol(self, data):
        form = formal.Form()
        if os.path.exists('/lib/iptables/libipt_ipp2p.so'):
            form.addField('blockp2p', formal.Boolean(), label="Block P2P")

        form.addField('transProxy',
                      formal.Boolean(),
                      label="Web transparent proxy",
                      description="Transparently proxy all web traffic")
        form.addField(
            'blockAll',
            formal.Boolean(),
            label="Block LAN -> Internet",
            description=
            "Block the LAN from accessing the internet directly. Web proxy access will still be permitted, as well as SMTP"
        )

        try:
            lanpolicy = self.sysconf.Shorewall['zones']['loc']['policy']
            if lanpolicy != "ACCEPT":
                form.data['blockAll'] = True
        except:
            form.data['blockAll'] = False

        if self.testProxy():
            form.data['transProxy'] = True

        if self.sysconf.Shorewall.get('blockp2p', False):
            form.data['blockp2p'] = True

        form.addAction(self.submitPolicyForm)
        return form
Ejemplo n.º 8
0
Archivo: Exim.py Proyecto: calston/tums
    def form_mailRewrite(self, data):
        form = formal.Form()
        form.addField('ffrom',
                      formal.String(required=True),
                      label="Domain",
                      description="Domain to modify")

        form.addField('tto',
                      formal.String(required=True),
                      label="Rewrite to",
                      description="Domain to rewrite to")

        form.addField('tos',
                      formal.Boolean(),
                      label="To header",
                      description="Rewrite email To header")
        form.addField('froms',
                      formal.Boolean(),
                      label="From header",
                      description="Rewrite email From header")
        form.addField('bcr',
                      formal.Boolean(),
                      label="BCC, CC and Recipient",
                      description="Rewrite all other headers")
        form.addAction(self.submitRewrite)
        return form
Ejemplo n.º 9
0
    def form_addShare(self, data):
        form = formal.Form()

        form.addField('share',
                      formal.String(required=True),
                      label="Shared Folder")
        form.addField('path',
                      formal.String(required=True),
                      label="Shared Path",
                      description="Path to be shared")
        form.addField('comment', formal.String(required=True), label="Comment")

        form.addField('public', formal.Boolean(), label="Public")
        form.addField('writable', formal.Boolean(), label="Writable")

        l = LDAP.createLDAPConnection(Settings.LDAPServer,
                                      'o=' + Settings.LDAPBase,
                                      Settings.LDAPManager, Settings.LDAPPass)
        dc = "%s,o=%s" % (LDAP.domainToDC(
            Settings.defaultDomain), Settings.LDAPBase)

        groups = LDAP.getGroups(l, dc)
        groups.sort()

        form.addField('group',
                      formal.String(),
                      formal.widgetFactory(formal.SelectChoice,
                                           options=[(i[1], i[1])
                                                    for i in groups]),
                      label="Required Group")

        form.addAction(self.submitForm)

        return form
Ejemplo n.º 10
0
    def form_addSNAT(self, data):
        form = formal.Form()

        ifs = []
        for i in Utils.getInterfaces():
            if 'eth' in i or 'tap' in i: # Only allow tap and eth binds...
                ifs.append((i, i))

        form.addField('dstif', formal.String(required=True), formal.widgetFactory(formal.SelectChoice, options = ifs), label = "External Interface",
            description = "The interface to which this traffic will be NATed. (Generaly the outside/internet interface)")

        form.addField('dstip', formal.String(required=True, validators=[PageHelpers.IPValidator()]), label = "External IP",
            description = "The IP to which this traffic will be NATed")

        form.addField('srcip', formal.String(required=True, strip=True, validators=[PageHelpers.IPValidator()]), label = "Source IP", description = ["The source IP you would like to NAT to and from."])

        form.addField('all', formal.Boolean(), label = "Any Interface", 
            description = "Tick this if the rule should apply to all interfaces and not just the External Interface.")

        form.addField('local', formal.Boolean(), label = "Use Internal", description = "Apply this NAT rule to this servers traffic as well.")

        form.data['local'] = False
        form.data['all'] = False

        form.addAction(self.submitSNAT)

        return form
Ejemplo n.º 11
0
    def addForm(self, form):
        ifaces = [(i,i) for i in Utils.getInterfaces()]

        form.addField('iface', formal.String(required=True), formal.widgetFactory(formal.SelectChoice, options = ifaces), label = "Interface")
        form.addField('dhcp', formal.Boolean(), label = "DHCP", description="Check this if DHCP is performed on this interface")
        form.addField('routeback', formal.Boolean(), label = "Check this if route reflection is allowed on this interface")

        form.data['iface'] = ifaces[0][0]
Ejemplo n.º 12
0
    def form_advanced(self, data):
        form = formal.Form()
        form.addField('selack',
                      formal.Boolean(),
                      label="Selective ACK",
                      description="Enable selective ACK windowing")
        form.addField('maxwin',
                      formal.Integer(),
                      label="Window Max",
                      description="Maximum TCP Window")
        form.addField('backlog',
                      formal.String(),
                      label="Backlog",
                      description="Maximum Device Backlog")

        form.addField(
            'gige',
            formal.Boolean(),
            label="Auto-Tune GigE",
            description=
            "Apply automatic tuning for GigE (overrides the settings above)")

        form.addField(
            'cookies',
            formal.Boolean(),
            label="SYN Cookies",
            description=
            "Enable SYN-Cookies. This is handy if you're at risk of DDoS SYN floods."
        )
        form.addField('proxyarp',
                      formal.Boolean(),
                      label="Proxy ARP",
                      description="Enable Proxy ARP.")

        form.data['cookies'] = self.sysconf.General.get('tuning', {}).get(
            'syn-cookies', False)
        form.data['proxyarp'] = self.sysconf.General.get('tuning', {}).get(
            'proxyarp', False)

        gen = self.sysconf.General.get('tuning', {}).get('tcp-hp', False)
        if gen:
            form.data['maxwin'] = gen.get('max-window', '16777216')
            form.data['backlog'] = gen.get('backlog', '250000')
            form.data['selack'] = gen.get('selective-ack', True)
            # Test the settings against our defaults
            if gen.get('backlog', False) == '250000' and gen.get(
                    'max-window', False) == '16777216':
                # if they are default we assume auto-tune mode is active
                form.data['gige'] = True
        else:
            form.data['selack'] = True
            form.data['maxwin'] = 110592
            form.data['backlog'] = 1000
            form.data['gige'] = False

        form.addAction(self.submitAdvForm)
        return form
Ejemplo n.º 13
0
    def form_mailConfig(self, data):
        form = formal.Form()

        form.addField('maxsize', formal.String(), label = self.text.eximMaxMailSize, 
            description = self.text.eximMaxSizeDescription)

        form.addField('blockedFiles', formal.String(), label = self.text.eximBlockedAttachment,
            description = self.text.eximBlockedDescription)

        form.addField('blockMovies', formal.Boolean(), label = self.text.eximBlockedMovies, 
            description = self.text.eximBlockedMovieDescription)

        form.addField('blockHarm', formal.Boolean(), label = self.text.eximBlockHarmful,
            description = self.text.eximBlockHarmfulDescription)

        form.addField('greylisting', formal.Boolean(), label = self.text.eximGreylisting,
            description = self.text.eximGreylistingDescription)

        form.addField('spamscore', formal.Integer(), label = self.text.eximSpamScore,
            description = self.text.eximSpamScoreDescription)

        form.addField('smtprelay', formal.String(), label = self.text.eximSMTPRelay, 
            description = self.text.eximSMTPRelayDescription)

        form.addField('smtpinterface', formal.String(), label = "External IP", 
            description = "Specify an external IP for outgoing SMTP")

        form.addField('relayfrom', formal.String(), label = "Relay From",
            description = "Comma separated list of networks from which we will accept mail (IP bound to LAN is included by default)")

        form.addField('copyall', formal.String(), label = self.text.eximMailCopy, 
            description = self.text.eximMailCopyDescription)

        form.addField('rpfilter', formal.Boolean(), label = "Send Filter", 
            description = "Enable local sender filtering. This will enforce a rule such that any relay host or local host is forced to send as a known local domain or authorised sender")


        form.addField('ratelimit', formal.Boolean(), label = "Rate Limiter", 
            description = "Enable local rate limiting. This will enforce a rate limit on the number of mails that can be sent in an hour from any address that is not local.")

        mailConf = self.sysconf.Mail
        form.data['maxsize'] = mailConf['mailsize']
        form.data['blockedFiles'] = ', '.join(mailConf['blockedfiles'])
        form.data['greylisting']  = mailConf.get('greylisting', True)
        form.data['smtprelay'] = self.sysconf.SMTPRelay
        form.data['smtpinterface'] = mailConf.get('smtpinterface', '')
        form.data['copyall'] = mailConf.get('copytoall', "")
        form.data['spamscore'] = int(mailConf.get('spamscore', "70"))
        form.data['relayfrom'] = ','.join(mailConf.get('relay-from', []))

        form.data['rpfilter'] = not mailConf.get('disablerpfilter', False)
        form.data['ratelimit'] = not mailConf.get('disableratelimit', False)

        form.addAction(self.submitForm)
        return form
Ejemplo n.º 14
0
    def form_addInterface(self, data):
        form = formal.Form()

        form.addField('interface',
                      formal.String(required=True),
                      formal.widgetFactory(formal.SelectChoice,
                                           options=[
                                               (i, i)
                                               for i in Utils.getInterfaces()
                                               if not i == "lo"
                                           ]),
                      label="Interface")

        form.addField(
            'dhcp',
            formal.Boolean(),
            label="DHCP",
            description="Use DHCP to discover an IP address for this interface"
        )

        form.addField('ip',
                      formal.String(strip=True,
                                    validators=[PageHelpers.IPValidator()]),
                      label="IP Address")
        try:
            if Settings.capabilities.get('ipv6', False):
                form.addField('ipv6',
                              formal.String(),
                              label="IPv6 Address",
                              description="IPv6 address for this interface")
                form.addField('ipv6adv',
                              formal.Boolean(),
                              label="Announce prefix",
                              description="Announce prefix on this interface")
        except:
            pass

        form.addField('netmask',
                      formal.String(),
                      label="Netmask",
                      description="Netmask or CIDR bitmask for this range")
        form.addField(
            'mtu',
            formal.Integer(),
            label="MTU",
            description=
            "Set this interfaces MTU. Value must be between 1200 and 1500.")
        form.addField('dhcpserver',
                      formal.Boolean(),
                      label="DHCP Server",
                      description="Serve DHCP on this interface")

        form.addAction(self.submitForm)
        return form
Ejemplo n.º 15
0
    def form_mailConfig(self, data):
        form = formal.Form()

        form.addField('maxsize',
                      formal.String(),
                      label=self.text.eximMaxMailSize,
                      description=self.text.eximMaxSizeDescription)

        form.addField('blockedFiles',
                      formal.String(),
                      label=self.text.eximBlockedAttachment,
                      description=self.text.eximBlockedDescription)

        form.addField('blockMovies',
                      formal.Boolean(),
                      label=self.text.eximBlockedMovies,
                      description=self.text.eximBlockedMovieDescription)

        form.addField('blockHarm',
                      formal.Boolean(),
                      label=self.text.eximBlockHarmful,
                      description=self.text.eximBlockHarmfulDescription)

        form.addField('greylisting',
                      formal.Boolean(),
                      label=self.text.eximGreylisting,
                      description=self.text.eximGreylistingDescription)

        form.addField('spamscore',
                      formal.Integer(),
                      label=self.text.eximSpamScore,
                      description=self.text.eximSpamScoreDescription)

        form.addField('smtprelay',
                      formal.String(),
                      label=self.text.eximSMTPRelay,
                      description=self.text.eximSMTPRelayDescription)

        form.addField('copyall',
                      formal.String(),
                      label=self.text.eximMailCopy,
                      description=self.text.eximMailCopyDescription)

        mailConf = self.sysconf.Mail
        form.data['maxsize'] = mailConf['mailsize']
        form.data['blockedFiles'] = ', '.join(mailConf['blockedfiles'])
        form.data['greylisting'] = mailConf.get('greylisting', True)
        form.data['smtprelay'] = self.sysconf.SMTPRelay
        form.data['copyall'] = mailConf.get('copytoall', "")
        form.data['spamscore'] = int(mailConf.get('spamscore', "70"))

        form.addAction(self.submitForm)
        return form
Ejemplo n.º 16
0
    def form_squidConf(self, data):
        form = formal.Form()
        form.addField('contentfilter',
                      formal.Boolean(),
                      label="Content filter")

        form.addField('advanced',
                      formal.Boolean(),
                      label="Update cache",
                      description="Enable update caching support.")

        form.addField(
            'captive',
            formal.Boolean(),
            label="Captive portal",
            description=
            "Enable captive portal (Requires Update Cache to be enabled).")

        form.addField(
            'captiveblock',
            formal.Boolean(),
            label="Captive block",
            description=
            "Check this if you want the default captive portal firewall policy to be blocking. By default all traffic will be accepted from authenticated computers"
        )

        form.addField(
            'bindaddr',
            formal.String(),
            label="Exit address",
            description=
            "The IP address to use for outbound connections. Leave blank for default"
        )

        k = self.sysconf.ProxyConfig
        data = {}
        data['contentfilter'] = k.get('contentfilter', False)
        data['captive'] = k.get('captive', False)
        data['captiveblock'] = k.get('captiveblock', False)

        if k.get('updates'):
            u = k['updates']

            data['advanced'] = u.get('enabled', False)

        data['bindaddr'] = k.get('bindaddr', '')

        form.data = data
        form.addAction(self.submitConfig)

        return form
Ejemplo n.º 17
0
Archivo: Ppp.py Proyecto: calston/tums
    def addForm(self, form):
        form.addField('link',
                      formal.String(required=True),
                      formal.widgetFactory(formal.SelectChoice,
                                           options=[
                                               (i, i)
                                               for i in self.getEthernets()
                                           ]),
                      label="Ethernet Link")

        form.addField('username',
                      formal.String(required=True),
                      label="Username")
        form.addField('password',
                      formal.String(required=True),
                      label="Password")

        form.addField(
            'localOnly',
            formal.Boolean(),
            label="Local Only",
            description=
            "Checking this box will cause only South African traffic to be routed over this link"
        )
        form.addField('defaultRoute',
                      formal.Boolean(),
                      label="Default Routes",
                      description="Make this the default internet connection")
        form.addField(
            'defaultDNS',
            formal.Boolean(),
            label="Default DNS",
            description="Use the DNS servers that this connection provides")
        form.addField(
            'createNAT',
            formal.Boolean(),
            label="Default NAT",
            description="Ensure there is a default NAT rule for this connection"
        )

        form.addField('zone',
                      formal.String(required=True),
                      formal.widgetFactory(formal.SelectChoice,
                                           options=self.getZones()),
                      label="Firewall Zone")

        form.data['createNAT'] = True
        form.data['link'] = 'eth0'
        form.data['defaultRoute'] = True
Ejemplo n.º 18
0
    def form_userSettings(self, ctx):
        form = formal.Form()

        form.addField('userPassword', formal.String(), formal.CheckedPassword, label="Password")
        form.addField('mailForwardingAddress', formal.String(), formal.TextArea, label="Forward mail to")
        form.addField('vacen', formal.Boolean(), label = "Vacation note active", description="Tick this to enable/disable the vacation note")
        form.addField('vacation', formal.String(), formal.TextArea, label="Vacation Note")

        form.addAction(self.submitForm)
        print self.avatarId.username, self.avatarId.domains[0]

        tData = {}
        l = LDAP.createLDAPConnection(Settings.LDAPServer, 'o='+Settings.LDAPBase, Settings.LDAPManager, Settings.LDAPPass)
        dc = "%s,%s,o=%s" % (Settings.LDAPPeople, LDAP.domainToDC(self.avatarId.domains[0]), Settings.LDAPBase)
        userData =  LDAP.getUsers(l, dc, 'uid='+self.avatarId.username)

        if userData[0].get('mailForwardingAddress', False):
            tData['mailForwardingAddress'] = '\n'.join(userData[0]['mailForwardingAddress'])

        try:
            vac = open("/var/spool/mail/vacation/%s@%s.txt" % (self.avatarId.username, self.avatarId.domains[0]), 'r')
            tData['vacation'] = vac.read()
            tData['vacen'] = True
        except Exception, e :
            print e, "in read vac note"
            pass # No vacation note
Ejemplo n.º 19
0
    def form_groupForm(self, data):
        form = formal.Form()
        # get groups
        l = LDAP.createLDAPConnection(Settings.LDAPServer,
                                      'o=' + Settings.LDAPBase,
                                      Settings.LDAPManager, Settings.LDAPPass)
        dc = "%s,o=%s" % (LDAP.domainToDC(
            Settings.defaultDomain), Settings.LDAPBase)

        self.groups = LDAP.getGroups(l, dc)

        # get users

        self.users = [i['uid'][0] for i in LDAP.getUsers(l, "ou=People," + dc)]

        form.data = {}
        for group in self.groups:
            for user in self.users:
                username = user
                field = "%s_%s" % (group[0], username)
                form.addField(field.replace('.', '').replace('-', ''),
                              formal.Boolean(),
                              label="%s-%s" % (group[1], username))
                form.data[field] = LDAP.isMemberOf(l,
                                                   dc,
                                                   username,
                                                   group=group[1])

        form.addAction(self.submitForm)

        return form
Ejemplo n.º 20
0
    def form_start_install(self, ctx):
        lbl = 'I have read and accept the License Agreement and the Privacy Policy'

        form = formal.Form()

        g = formalutils.CollapsibleGroup(
            'startinstall', label='License Agreement and Privacy Policy')
        g.setCollapsed(False)
        g.add(
            formal.Field('acceptlicense',
                         formal.Boolean(required=True),
                         label=lbl))
        sg = formalutils.SubmitFieldGroup('buttons')
        sg.add(
            formalutils.SubmitField('startinstallation',
                                    formal.String(),
                                    label='Next'))
        g.add(sg)
        form.add(g)
        form.addAction(self.submitted_start_install,
                       name='startinstallation',
                       label='Next',
                       validate=False)

        form.data['startinstall.acceptlicense'] = False

        return form
Ejemplo n.º 21
0
    def form_neigh(self, data):
        form = formal.Form()

        form.addField('ip',
                      formal.String(required=True,
                                    validators=[PageHelpers.IPValidator()]),
                      label="Remote IP")
        form.addField(
            'asn',
            formal.String(),
            label="Remote AS",
            description=
            "Remote AS number of peer. Leave blank for the same AS as this router"
        )
        #form.addField('hold', formal.Integer(required=True), label = "Hold time", description="Override the Hold timer for this peer (default 120)")

        #form.data['hold'] = 120

        form.addField(
            'multihop',
            formal.Boolean(),
            label="EBGP Multihop",
            description="Set this if the peer is more than 1 hop away")

        form.addField(
            'nexthop',
            formal.String(),
            label="Next-Hop",
            description=
            "Set this to an IP if you want to rewrite the next-hop of routes coming in from this peer. This is useful for route servers."
        )

        form.addAction(self.submitNeigh)
        return form
Ejemplo n.º 22
0
    def form_addVLAN(self, data):
        form = formal.Form()

        form.addField('interface',
                      formal.String(required=True),
                      formal.widgetFactory(formal.SelectChoice,
                                           options=[
                                               (i, i.replace('eth', 'Port '))
                                               for i in Utils.getInterfaces()
                                               if not i == "lo"
                                           ]),
                      label="Attached Interface")

        form.addField('vlan', formal.Integer(), label="VLAN Number")
        form.addField('ip', formal.String(), label="IP Address")
        form.addField('netmask',
                      formal.String(),
                      label="Netmask",
                      description="Netmask or CIDR bitmask for this range")
        form.addField('dhcpserver',
                      formal.Boolean(),
                      label="DHCP Server",
                      description="Serve DHCP on this interface")
        form.addAction(self.submitVlan)
        return form
Ejemplo n.º 23
0
    def form_balance(self, data):
        form = formal.Form()
        zones = [
            (zo, zo) for zo in self.sysconf.Shorewall.get('zones', {}).keys()
        ]  # Build something we can se for drop downs

        form.addField('zone',
                      formal.String(required=True),
                      formal.widgetFactory(formal.SelectChoice, options=zones),
                      label="Zone")

        form.addField(
            'gateway',
            formal.String(),
            label="Gateway",
            description=
            "Gateway for this network. Not required, but highly recommended whenever possible."
        )

        form.addField(
            'track',
            formal.Boolean(),
            label="Track",
            description=
            "Track connections so that sessions are routed out of the same interface they came in. (Recommended)"
        )

        form.addField(
            'balance',
            formal.Boolean(),
            label="Load Balance",
            description=
            "Perform load balancing between this zone and any others marked for load balancing."
        )

        form.addField(
            'loose',
            formal.Boolean(),
            label="Allow Spoofing",
            description=
            "Don't force source routes to be added for this zone. Only use this if your upstream does not mind spoofed packets such as if you are a properly multihomed site. (Not Recommended)"
        )

        form.data['track'] = True

        form.addAction(self.submitBalance)
        return form
Ejemplo n.º 24
0
    def form_authentication(self, data):
        form = formal.Form()

        form.addField('adauth',
                      formal.Boolean(),
                      label="Active Directory authentication")

        form.addField('adserv', formal.String(), label="Server")
        form.addField('addom', formal.String(), label="Full DN")
        form.addField('adldapuser',
                      formal.String(),
                      label="Directory Username")
        form.addField('adldappass',
                      formal.String(),
                      formal.Password,
                      label="Directory Password")

        form.addField(
            'adGroupDefaultDeny',
            formal.Boolean(),
            label="Deny Groups",
            description=
            "If groups are enabled, if checked deny by default access, this means that you will need to explicity grant access to the groups when defined"
        )

        form.addAction(self.submitAuth)

        k = self.sysconf.ProxyConfig
        data = {}
        if k.get('adauth', ''):
            data['ldapauth'] = False
            data['adauth'] = True
        else:
            data['ldapauth'] = True
            data['adauth'] = False

        data['adGroupDefaultDeny'] = k.get('adGroupDefaultDeny', False)

        data['adserv'] = k.get('adserver') or u''
        data['addom'] = k.get('addom') or u''
        data['adldapuser'] = k.get('adldapuser') or u''

        form.data = data

        return form
Ejemplo n.º 25
0
Archivo: HA.py Proyecto: calston/tums
    def form_config(self, ctx):
        form = formal.Form(self.submitForm)[
            formal.Group('topology')[
                tags.div[
                    tags.h3["Topology configuration"]
                ],
                formal.Field('name', formal.String(), label = "Name"),
                formal.Field('topology', formal.String(),  formal.widgetFactory(formal.SelectChoice, options = [
                        ('master', 'Master'),
                        ('slave', 'Slave')
                    ]), label = "Topology"),
                formal.Field('ipoverride', formal.Boolean(), label = "Take over LAN", 
                    description = "Take over the LAN settings of this server on failure."), 
                formal.Field('wanoverride', formal.Boolean(), label = "Take over WAN", 
                    description = "Take over the WAN settings of this server on failure."),
                #formal.Field('key', formal.String(), label = "Access Key", 
                #    description = "On the slave system, configure it to accept HA connections and generate a key which is pasted here")
            ],
            formal.Group('failover')[
                tags.div[
                    tags.h3["Failover services"]
                ],
                formal.Field('dhcp', formal.Boolean(), label = "DHCP", 
                    description = "This server will act as a backup DHCP server"),

                formal.Field('smtp', formal.Boolean(), label = "SMTP", 
                    description = "This server will provide backup SMTP routing - NOT POP3/IMAP DELIVERY."),

                formal.Field('routing', formal.Boolean(), label = "Internet Gateway", 
                    description = "This server may act as a backup internet gateway in the event that the master goes offline"),

                formal.Field('dns', formal.Boolean(), label = "DNS Server", 
                    description = "This server may act as a backup DNS server for all zones"),

                formal.Field('pdc', formal.Boolean(), label = "Domain controller", 
                    description = "This server may act as the primary domain controller")
            ],
            formal.Group('loadbalance')[
                tags.div[
                    tags.h3["Load sharing services"]
                ],
                formal.Field('dhcp', formal.Boolean(), label = "DHCP"),
                formal.Field('smtp', formal.Boolean(), label = "SMTP")
            ],
        ]
        
        form.data = self.populateForm()
        form.addAction(self.submitForm)
        return form
Ejemplo n.º 26
0
    def form_wizard7(self, data):
        form = formal.Form()

        form.addField('sambapdc', formal.Boolean(), label="Domain Master")
        form.addField('windom', formal.String(), label="Windows Domain")

        form.data = self.config

        form.addAction(self.submitWiz7)
        return form
Ejemplo n.º 27
0
    def form_configSamba(self, data):
        form = formal.Form()

        form.addField('pdc', formal.Boolean(), label="Domain controller")
        form.addField('profileroam',
                      formal.Boolean(),
                      label="Roaming Profiles")

        form.addAction(self.submitForm)

        smbcfg = self.sysconf.SambaConfig

        if smbcfg.get('logon path', None):
            if smbcfg['logon path']:
                form.data['profileroam'] = True
        if smbcfg.get('domain logons', None):
            if smbcfg['domain logons'] == 'yes':
                form.data['pdc'] = True
        return form
Ejemplo n.º 28
0
 def form_wizard2(self, data):
     form = formal.Form()
     form.addField(
         'lanppp',
         formal.Boolean(),
         label="2 LAN, 1 PPP",
         description=
         "Two lan interfaces with an ADSL connection established on one of them"
     )
     form.addField(
         'lanwan',
         formal.Boolean(),
         label="1 LAN, 1 WAN",
         description=
         "One lan interface, and one interface with a direct WAN connection (Like IS Business DSL or diginet)"
     )
     #form.addField('lanwanppp', formal.Boolean(), label = "2LAN, 1 PPP, 1 WAN", description="Two lan interfaces with internet balanced over an ADSL PPPoE as well as the WAN port")
     form.addAction(self.submitWiz2)
     form.data = self.config
     return form
Ejemplo n.º 29
0
    def create_firewall_group(self, form, ctx):
        txt = self.fw_uitexts

        g = formalutils.CollapsibleGroup('firewall',
                                         label=txt.firewall_group_caption)
        g.setCollapsed(uihelpers.collapse_setting(ns_ui.collapseFirewall))
        g.add(
            formalutils.Field('firewall_in_use',
                              formal.Boolean(required=True),
                              label=txt.enable_routing_label))
        return g
Ejemplo n.º 30
0
Archivo: VPN.py Proyecto: calston/tums
    def form_addUser(self, data):
        """ Form for adding a user"""
        form = formal.Form()
        
        form.addField('name', formal.String(required=True), label = self.text.vpnName)
        form.addField('mail', formal.String(), label = self.text.vpnMail) 
        form.addField('ip', formal.String(strip=True, validators=[PageHelpers.IPValidator()]), label = self.text.vpnStaticIP)
        form.addField('mailKey', formal.Boolean(), label = self.text.vpnMailQuestion)

        form.addAction(self.newCert)
        return form