Giter Site home page Giter Site logo

devrt / docker-host-network-firewall Goto Github PK

View Code? Open in Web Editor NEW
5.0 2.0 2.0 14 KB

Protect your docker host network from possible trojan horse attack.

Home Page: https://hub.docker.com/r/devrt/host-network-firewall/

License: MIT License

Python 85.80% Shell 14.20%
firewall docker docker-network iptables trojan-horse-attack

docker-host-network-firewall's Introduction

Protect your docker host network from possible trojan horse attack.

Background

docker has a feature to isolate between networks created by docker itself, however, it won't isolate your host network. You can confirm this fact by entering following commands.

Check your current iptables:

$ sudo iptables-save

Run nmap scans to see how your host network is visible from the container:

$ git clone https://github.com/devrt/docker-host-network-firewall.git
$ cd docker-host-network-firewall
$ ./test.sh

For those who pull and run third party docker container in your private network, you should be awared that the container may contain evil script to scan and steal your important informations on the network.

Now, docker-host-network-firewall is here to proctect you.

Enter following command to enforce the firewall:

$ docker run -ti --rm --cap-add=NET_ADMIN --net=host -v /var/run/docker.sock:/var/run/docker.sock devrt/host-network-firewall

Check your current iptables:

$ sudo iptables-save

Run nmap scans again to make sure it is protected.

Persist firewall protection

Once you have confirmed firewall protection, you can persist the protection by entering following command:

$ docker run --name host-network-firewall -d --restart=always --cap-add=NET_ADMIN --net=host -v /var/run/docker.sock:/var/run/docker.sock devrt/host-network-firewall

Notice

This firewall script only isolate between docker network and your host network. Please note the containers linked inside the same docker network can communicate each other freely (so there is still an attack surface).

Written by

Yosuke Matsusaka [email protected]

Distributed under MIT license.

docker-host-network-firewall's People

Contributors

yosuke avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

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.