Ejemplo n.º 1
0
	def activate_domain(translate, output, id_domain, conectionBrain, log):
		_ = translate
		cursor = conectionBrain.cursor()
		cursor.execute("UPDATE dns SET status = '1' WHERE id = '" + str(id_domain) + "'")
		conectionBrain.commit()
		generate.all(id_domain, conectionBrain)
		log.write(_('Activate domain'))
Ejemplo n.º 2
0
	def edit_host(translate, output, id_domain, conectionBrain, log):
		cursor = conectionBrain.cursor()
		cursor.execute("SELECT * FROM apache WHERE id = '" + id_domain + "'")
		for info in cursor:
			_ = translate

			domain_name = raw_input(_('Domain Name ') + str(info[1]) + ': ')
			email = raw_input(_('Email Contact ') + str(info[2]) + ': ')
			path_server = raw_input(_('Path Server ') + str(info[3]) + ': ')
			rewriteValue = 'y' if str(info[4]) else 'n'
			rewrite = raw_input(_('ReWrite ') + str(rewriteValue) + ': ')
			indexOfValue = 'y' if str(info[5]) else 'n'
			indexOf =  raw_input(_('IndexOf ') + str(indexOfValue) + ': ')


			control = False

			valores = ''

			if domain_name != "":
				control = True
				valores += "domain = '" + str(domain_name) + "', "

			if email != "":
				control = True
				valores += "email = '" + str(email) + "', "

			if path_server != "":
				control = True
				valores += "path_domain = '" + str(path_server) + "', "
			
			if rewrite != "":
				control = True
				if rewrite == 'y':
					r_value = '1'
				else:
					r_value = '0'
				valores += "rewrite = '" + str(r_value) + "', "
			
			if indexOf != "":
				control = True
				if indexOf == 'y':
					i_value = '1'
				else:
					i_value = '0'
				valores += "indexOf = '" + str(i_value) + "', "
			
			if control == True:
				final = valores + 'F'
				cursor.execute("UPDATE apache SET "  + final.split(', F')[0] + " WHERE id = '" + str(info[0]) + "'")
				conectionBrain.commit()
				generate.all(str(info[0]), conectionBrain)
				if domain_name == "":
					edit_host = str(info[1])
				else:
					edit_host = domain_name
				log.write(_('Edit host ') + str(edit_host))
Ejemplo n.º 3
0
	def activate_host(translate, output, id_domain, conectionBrain, log):
		_ = translate
		cursor = conectionBrain.cursor()
		cursor.execute("UPDATE apache SET status = '1' WHERE id = '" + str(id_domain) + "'")
		conectionBrain.commit()
		generate.all(id_domain, conectionBrain)
		cursor.execute("SELECT domain FROM apache WHERE id = '" + str(id_domain) + "'")
		for info in cursor:
			domain_name = info[0]
		command_addSite = 'a2ensite ' + str(domain_name)
		addSite = subprocess.Popen(command_addSite, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
		addSite_error = addSite.stderr.read()
		if addSite_error != '': 
			log.write(_('Failed active host'), 1)
		else:
			log.write(_('Active host ') + str(domain_name))
Ejemplo n.º 4
0
	def delete_domain(translate, output, id_domain, conectionBrain, log):
		_ = translate
		sentencia = raw_input('disable[0]/delete[1]: [0] ')
		while sentencia != '0' and sentencia != '1':
			output.error(_('Option not valid'))
			sentencia = raw_input('disable[0]/delete[1]: [0] ')
		cursor = conectionBrain.cursor()
		cursor.execute("SELECT domain FROM dns WHERE id = '" + str(id_domain) + "'")
		for info in cursor:
			domain = info[0]

		if sentencia == '0':
			cursor.execute("UPDATE dns SET status = '0' WHERE id = '" + id_domain + "'")
		else:
			cursor.execute("DELETE FROM dns WHERE id = '" + id_domain + "'")
		conectionBrain.commit()
		os.system('rm -f /etc/bind/pri.' + domain)
		generate.all('all', conectionBrain)
		log.write(_('Delete Domain ') + str(domain))
 def option5():
     generate.all("all", "")
		def option5():
			generate.all('all', '')
Ejemplo n.º 7
0
	def edit_domain(translate, output, id_domain, conectionBrain, log):
		cursor = conectionBrain.cursor()
		cursor.execute("SELECT * FROM dns WHERE id = '" + id_domain + "'")
		for info in cursor:
			_ = translate

			domain_name = raw_input('Domain Name [' + info[1] + ']: ')
			email = raw_input('Email Contact [' + info[2] + ']: ')
			ip_server = raw_input('Ip Server [' + info[3] + ']: ')
			ns_primary = raw_input('NS Primary [' + info[4] + ']: ')
			ns_secundary =  raw_input('NS Secundary [' + info[5] + ']: ')
			if str(info[6]) == '1':
				valor = 'y'
			else:
				valor = 'n'
			server_mail = raw_input('Server Mail [' + str(valor) + ']: ')
			type_zone = raw_input('Type Zone [' + info[9] + ']: ')
			ip_transfer =  raw_input('Ip transfer [' + info[10] + ']: ')
			domain_key = ''
			spf = ip_server

			control = False

			valores = ''

			if domain_name != "":
				control = True
				valores += "domain = '" + str(domain_name) + "', "

			if email != "":
				control = True
				valores += "email = '" + str(email) + "', "

			if ip_server != "":
				control = True
				valores += "ipserver = '" + str(ip_server) + "', "
			
			if ns_primary != "":
				control = True
				valores += "NS_primary = '" + str(ns_primary) + "', "
			
			if ns_secundary != "":
				control = True
				valores += "NS_secundary = '" + str(ns_secundary) + "', "
			
			if server_mail !="":
				control = True
				if server_mail == 'y':
					e_server = '1'
				else:
					e_server = '0'
				valores += "email_server = '" + str(e_server) + "', "
			
			if type_zone !="":
				control = True
				valores += "type_zone = '" + str(type_zone) + "', "
			
			if ip_transfer != "":
				control = True
				valores += "ip_transfer = '" + str(ip_transfer) + "', "
			
			if control == True:
				final = valores + 'F'
				cursor.execute("UPDATE dns SET "  + final.split(', F')[0] + " WHERE id = '" + str(info[0]) + "'")
				conectionBrain.commit()
				generate.all(str(info[0]), conectionBrain)
				log.write(_('Edit Domain ') + str(domain_name))