Skip to content

daniel5gh/lxc-nat-py

master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
doc
 
 
 
 
 
 
 
 
 
 
 
 
 
 

lxc-nat-py

Python script to setup iptables to forward to LXC containers according to forwarder config in a YAML file.

Based on the following ruby scripts referenced on http://terrarum.net/blog/building-an-lxc-server-1404.html

I took those and made a python version, I like python. When no filename is passed to --conf, ./nat-conf.yml is used.

Usage

  usage: lxc-nat.py [-h] [-v] [-F] [--dry-run] [-c CONF]

  optional arguments:
    -h, --help            show this help message and exit
    -v, --verbose         show the iptables commands that are run
    -F, --flush           flush and delete rules and chains only
    --dry-run             don't actually run the iptables commands
    -c CONF, --conf CONF  YAML file containing forwarding rule definitions

An example YAML conf file:

  forwards:
    - source:
        ip: 10.0.0.1
        port: 8080
      destination:
        name: www
        port: 80
    - source:
        port: 3306
      destination:
        name: mysql_server
    - proto: udp
      source:
        interface: eth1
        port: 53333
      destination:
        name: dns_server
    - source:
        port: 1234
      destination:
        name: test1
        port: 22

Packaging

To make a dist package run:

python setup.py bdist_wheel

This will give you a python wheel in ./dist/

About

Python script to setup iptables to forward to LXC containers

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages