Exemple #1
0
 def get_ui(self):                        
     lista_dominios = ConfigFile('/etc/bind/named.conf.local')
     open('/tmp/1','w').write(str(dir(lista_dominios)))
     if lista_dominios.getZones() == []:
          ui = self.app.inflate("email:msg")
     else:
         ui = self.app.inflate('email:main')
         msg = ui.find('msg')
         email = open('/var/lib/netcontrol/plugins/email/email').read()
         if email == "":
             msg.append(
                 UI.Label(size=3,text="Nenhum dominio de email foi definido" )
             )
             info = ui.find('info')
             info.append(UI.Label(size=3,text="Defina um dominio de Email"))
         else:
             msg.append(
                 UI.Label(size=3,text="Servidor de email configurado para %s"%email )
             )
             info = ui.find('info')
             info.append(UI.Label(size=3,text="Mudar o dominio de Email"))
         lista = ui.find('dominios')
         for i in lista_dominios.getZones():
             if i.getName().find('in-addr') == -1:
                 lista.append( UI.SelectOption(value=i.getName(),text=i.getName()) )
     if self.info_restart == True:
         t = ui = self.app.inflate("email:restart")
         t.find("restart").append(  UI.DTR(  UI.Label(text=self._resposta)  )  )
         self.info_restart = False
     return ui
 def config_bind(self,dominio):
     zonas = ConfigFile('/etc/bind/named.conf.local')
     print dir(zonas)
     for i in zonas.getZones():
         if i.getName() == dominio:
             arq = i.getFile()
             arquivo = open(arq,'r').read()
             print arquivo
             if arquivo.find('MX') == -1:
                 mx = '@\tIN\tMX 10 '
                 indice = arquivo.find('192')
                 for j in range(14):
                     mx += arquivo[indice+j]
                 arquivo += mx
                 open(arq,'w').write(arquivo)      
Exemple #3
0
 def config_bind(self, dominio):
     zonas = ConfigFile('/etc/bind/named.conf.local')
     print dir(zonas)
     for i in zonas.getZones():
         if i.getName() == dominio:
             arq = i.getFile()
             arquivo = open(arq, 'r').read()
             print arquivo
             if arquivo.find('MX') == -1:
                 mx = '@\tIN\tMX 10 '
                 indice = arquivo.find('192')
                 for j in range(14):
                     mx += arquivo[indice + j]
                 arquivo += mx
                 open(arq, 'w').write(arquivo)
Exemple #4
0
class Config(Plugin):
    implements(IConfigurable)
    name = 'Bind'
    icon = '/dl/bind/icon.png'
    id   = 'bind'

    configFile = None

    def list_files(self):
        return [ BIND_CONF_FILE ]

    def read(self):
        self.configFile = ConfigFile( BIND_CONF_FILE  )
        return self.configFile.getZones()

    def save(self, zone):
        ConfigFile.SaveFileWithZone( BIND_CONF_FILE, zone, newZone=True )

    def saveZoneFile(self, zone, zoneFileObject):
        open(zone.getFile(), 'w').write( ZoneFile.getZoneFileByZone (zoneFileObject) )
Exemple #5
0
 def save(self, zone):
     ConfigFile.SaveFileWithZone( BIND_CONF_FILE, zone, newZone=True )
Exemple #6
0
 def read(self):
     self.configFile = ConfigFile( BIND_CONF_FILE  )
     return self.configFile.getZones()