First working qdb external/internal draft

This commit is contained in:
Giulio 2021-07-13 12:38:48 +02:00
parent accfdcb61f
commit 678b6df280

View File

@ -368,7 +368,7 @@ class NetVMMixin(qubes.events.Emitter):
'''Recursively resolve netvm until no netvm is set, order is important''' '''Recursively resolve netvm until no netvm is set, order is important'''
netpath = list() netpath = list()
netvm = self.netvm netvm = self
while netvm: while netvm:
netpath.append(netvm) netpath.append(netvm)
netvm = netvm.netvm netvm = netvm.netvm
@ -399,14 +399,22 @@ class NetVMMixin(qubes.events.Emitter):
# write new forward rules # write new forward rules
for key, value in vm.firewall.qdb_forward_entries( for key, value in vm.firewall.qdb_forward_entries(
addr_family=addr_family, type="internal").items(): addr_family=addr_family, type="internal").items():
print() self.untrusted_qdb.write(base_dir + key, value)
# code here '''
# signal its done with open("/tmp/log.internal.txt", "a") as f:
f.write("VMName: {}\t\tPath: {}\t\tRule: {}\n".format(self.name, base_dir+key, value))
'''
for key, value in vm.firewall.qdb_forward_entries( for key, value in vm.firewall.qdb_forward_entries(
addr_family=addr_family, type="external").items(): addr_family=addr_family, type="external").items():
# to fix current_ip = ip
for netvm in netpath: for netvm in netpath:
self.untrusted_qdb.write(base_dir + key, value) base_dir = '/qubes-firewall-forward/{}/'.format(current_ip)
netvm.untrusted_qdb.write(base_dir + key, value)
'''
with open("/tmp/log.external.txt", "a") as f:
f.write("VMName: {}\t\tPath: {}\t\tRule: {}\n".format(netvm.name, base_dir+key, value))
'''
current_ip = netvm.ip
# signal its done # signal its done
self.untrusted_qdb.write(base_dir[:-1], '') self.untrusted_qdb.write(base_dir[:-1], '')