Erreur dans l'offset

This commit is contained in:
chirac 2019-09-14 02:09:15 +02:00 committed by root
parent 7cbbc3c4d4
commit b35b191904

View file

@ -27,7 +27,7 @@ api_hostname = config.get('Re2o', 'hostname')
api_password = config.get('Re2o', 'password')
api_username = config.get('Re2o', 'username')
api_client = Re2oAPIClient(api_hostname, api_username, api_password, use_tls=False)
api_client = Re2oAPIClient(api_hostname, api_username, api_password, use_tls=True)
client_hostname = socket.gethostname().split('.', 1)[0]
@ -499,7 +499,7 @@ class iptables:
# On nat
for interface, pub_ip_range in nat_type['interfaces_ip_to_nat'].items():
ip_nat = '.'.join(pub_ip_range.split('.')[:3]) + '.' + str(int(nat_prive_ip_plage.split('.')[1][0])*40 + 4*(nat_ip_range - 1) + nat_private_ip//64)
ip_nat = '.'.join(pub_ip_range.split('.')[:3]) + '.' + str((int(nat_prive_ip_plage.split('.')[1][0]) - 1)*40 + 4*(nat_ip_range - 1) + nat_private_ip//64)
nat_rule_tcp += '\n-A %s -s %s -o %s -p tcp -j SNAT --to-source %s' % (subrange_name, ip_src, interface, ip_nat + ':' + str(port_low) + '-' + str(port_high))
nat_rule_udp += '\n-A %s -s %s -o %s -p udp -j SNAT --to-source %s' % (subrange_name, ip_src, interface, ip_nat + ':' + str(port_low) + '-' + str(port_high))
self.add("nat4", nat_rule_tcp)
@ -537,6 +537,7 @@ class iptables:
def restore_iptables(self, mode='4'):
"""Restoration de l'iptable générée"""
return
if mode == '6':
global_chain = self.global_chain6
command_to_execute = ["sudo","-n","/sbin/ip6tables-restore"]