Giter VIP home page Giter VIP logo

docker-netns's People

Contributors

tr4cks avatar

Stargazers

 avatar  avatar

Watchers

 avatar

docker-netns's Issues

README, documentation

Hello, thanks you for this handy tool!

I have found this repository here, as I need something similar.

It is really not obvious to use without documentation thus I would like to share my findings here, maybe you will adapt them in a nice way at your repository.

Installation part is the most straightforward one:

git clone https://github.com/tr4cks/docker-netns
cd docker-netns
go build docker-netns.go

After that we need to configure what commands are required to be executed on a container after it is started (important thing is that container must start exactly after docker-netns, otherwise nothing is executed). For this file ./config.yaml needs to be edited (it is in the projects' root directory). For example, it might be preparations for the sslh transparent mode:

sslh-transparent:
  - /usr/sbin/ip rule add fwmark 0x1 lookup 100
  - /usr/sbin/ip route add local 0.0.0.0/0 dev lo table 100 
  - /usr/sbin/iptables -t raw -A PREROUTING ! -i lo -d 127.0.0.0/8 -j DROP
  - /usr/sbin/iptables -t mangle -A POSTROUTING ! -o lo -s 127.0.0.0/8 -j DROP
  - /usr/sbin/iptables -t nat -A OUTPUT -p tcp -d 127.0.0.0/8 --tcp-flags FIN,SYN,RST,ACK SYN -j CONNMARK --set-xmark 0x01/0x0f
  - /usr/sbin/iptables -t mangle -A OUTPUT ! -o lo -p tcp -m connmark --mark 0x01/0x0f -j CONNMARK --restore-mark --mask 0x0f 

Where sslh-transparent is a name of container whose netns will be used (container id is not used for consistency purposes).

Now, finalize our setup of docket-netns daemon with systemd:

./docker-netns service install
systemctl enable --now docket-netns

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.