diff --git a/lustmolch.py b/lustmolch.py index c059e571dbb4db810ef212f73bc1bf478d31d8d2..538970aa8729ef9b6fbf15ff123436f38a6c98ec 100755 --- a/lustmolch.py +++ b/lustmolch.py @@ -22,6 +22,7 @@ template_files_container = [ FLAVOUR = 'buster' DEBIAN_MIRROR = 'http://mirror.stusta.de/debian' +IP_RANGES = ['10.150.0.0/17', '141.84.69.0/24'] www_root = Path('/var/www') SSH_START_PORT = 10022 @@ -130,8 +131,7 @@ def create_container(dry_run, config_file, name): click.echo(f'Updating Iptable rules for port {context["ssh_port"]}') if not dry_run: - ip_ranges = ['10.150.0.0/17', '141.84.69.0/24'] - for ip_range in ip_ranges: + for ip_range in IP_RANGES: run(['iptables', '-A', 'INPUT', '-p', 'tcp', '-m', 'tcp', '--dport', context['ssh_port'], '-s', ip_range, '-j', 'ACCEPT']) click.echo('Starting container') @@ -208,6 +208,8 @@ def remove_container(config_file, name): except OSError as e: click.echo(f'{e} ignored when updating config file') + click.echo('All done, although you might need to manually remove some iptable rules.') + if __name__ == '__main__': cli()