2015-08-17 22:53:40 +00:00
|
|
|
#!/usr/bin/lua
|
|
|
|
|
|
|
|
local sysconfig = require 'gluon.sysconfig'
|
2017-01-17 22:57:39 +00:00
|
|
|
local util = require 'gluon.util'
|
2016-05-01 12:21:20 +00:00
|
|
|
|
2017-01-19 11:51:04 +00:00
|
|
|
local uci = require('simple-uci').cursor()
|
2015-08-17 22:53:40 +00:00
|
|
|
|
|
|
|
|
2022-01-23 13:43:35 +00:00
|
|
|
local interfaces = util.get_role_interfaces(uci, 'client', true)
|
|
|
|
util.add_to_set(interfaces, 'local-port')
|
2016-05-01 12:21:20 +00:00
|
|
|
|
2017-02-10 08:32:39 +00:00
|
|
|
uci:section('network', 'interface', 'client', {
|
|
|
|
type = 'bridge',
|
|
|
|
ifname = interfaces,
|
|
|
|
proto = 'none',
|
|
|
|
auto = true,
|
|
|
|
ipv6 = false,
|
|
|
|
macaddr = sysconfig.primary_mac,
|
2017-04-13 20:22:34 +00:00
|
|
|
igmp_snooping = true,
|
|
|
|
multicast_querier = true,
|
2018-12-07 20:40:13 +00:00
|
|
|
ra_holdoff = 30,
|
2017-02-10 08:32:39 +00:00
|
|
|
})
|
2017-01-17 22:57:39 +00:00
|
|
|
|
2016-11-30 19:29:25 +00:00
|
|
|
uci:save('network')
|
2016-05-01 12:21:20 +00:00
|
|
|
|
2017-06-14 17:40:08 +00:00
|
|
|
uci:section('firewall', 'zone', 'drop', {
|
|
|
|
name = 'drop',
|
2017-02-10 08:32:39 +00:00
|
|
|
network = {'client'},
|
|
|
|
input = 'DROP',
|
|
|
|
output = 'DROP',
|
|
|
|
forward = 'DROP',
|
|
|
|
})
|
|
|
|
|
2020-09-13 03:24:33 +00:00
|
|
|
local networks = uci:get_list('firewall', 'loc_client', 'network')
|
2017-12-26 22:15:57 +00:00
|
|
|
util.add_to_set(networks, 'local_node')
|
2020-09-13 03:24:33 +00:00
|
|
|
uci:set_list('firewall', 'loc_client', 'network', networks)
|
2017-02-10 08:32:39 +00:00
|
|
|
|
|
|
|
|
2016-11-30 19:29:25 +00:00
|
|
|
local dnsmasq = uci:get_first('dhcp', 'dnsmasq')
|
2017-01-19 11:51:04 +00:00
|
|
|
uci:set('dhcp', dnsmasq, 'boguspriv', false)
|
|
|
|
uci:set('dhcp', dnsmasq, 'localise_queries', false)
|
|
|
|
uci:set('dhcp', dnsmasq, 'rebind_protection', false)
|
2016-11-30 19:29:25 +00:00
|
|
|
|
2017-06-14 17:40:08 +00:00
|
|
|
uci:section('dhcp', 'dhcp', 'local_client', {
|
2017-02-10 07:16:27 +00:00
|
|
|
interface = 'client',
|
|
|
|
ignore = true,
|
|
|
|
})
|
2016-11-30 19:29:25 +00:00
|
|
|
|
|
|
|
uci:save('dhcp')
|
2017-06-14 17:40:08 +00:00
|
|
|
uci:save('firewall')
|