def handle(self, *args, **options):
		logging.info('check_authorizations')
		fw = Firewall()
		expired_authorizations = DeviceAuthorization.filter_expired()
		for da in expired_authorizations:
			logging.info('deleting %s' % da)
			try:
				fw.del_authorization(da)
			except:
				pass
			da.delete()
示例#2
0
def splash_action(request):
	if not request.POST.has_key('accept'):
		return HttpResponseForbidden('Not authorized')

	# user accepted
	client_ip = request.META['REMOTE_ADDR']
	try:
		c = ArpCache()
		client_mac = c.get_mac(client_ip)
	except KeyError:
		client_mac=''

	auth = DeviceAuthorization(ip_address=client_ip, mac_address=client_mac)
	auth.save()

	fw = Firewall()
	fw.add_authorization(auth)

	context = {'device_authorization': auth}

	return render(request, 'captive_portal/splash_action.html', context)
示例#3
0
	def handle(self, *args, **options):
		fw = Firewall()
		fw.reload_rules()

		self.stdout.write('Successfully reloaded firewall rules')
	def handle(self, *args, **options):
		DeviceAuthorization.objects.all().delete()
		fw = Firewall()
		fw.reload_rules()