Skip to content
forked from diefans/ferment

A tool to provide the current docker config in ferm format

License

Notifications You must be signed in to change notification settings

ushacow/ferment

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ferment

Objective

Create a ferm config for the current docker container setup. This seems useful for automated provisioning of systems (e.g. with ansible) which want to use ferm for their firewall setup. It is fork from original project: https://github.com/diefans/ferment with modified template for docker-ce version higher then 18

Usage

Install Ferment via pip:

# pip install ferment-ng


# ferment docker --help
Usage: ferment docker [OPTIONS] COMMAND [ARGS]...

Options:
  -d, --docker PATH     The docker api socket.
  -c, --cidr TEXT       Docker CIDR.
  -i, --interface TEXT  Docker interface.
  --help                Show this message and exit.

Commands:
  config

You just include a callback to ferment within your ferm.conf:

# -*- shell-script -*-
#
#  Configuration file for ferm(1).
#

table filter {
    chain INPUT {
        policy DROP;

        # connection tracking
        mod state state INVALID DROP;
        mod state state (ESTABLISHED RELATED) ACCEPT;

        # allow local packet
        interface lo ACCEPT;

        # respond to ping
        proto icmp ACCEPT;

        # allow IPsec
        proto udp dport 500 ACCEPT;
        proto (esp ah) ACCEPT;

        # allow SSH connections
        proto tcp dport ssh ACCEPT;
    }
    chain OUTPUT {
        policy ACCEPT;

        # connection tracking
        #mod state state INVALID DROP;
        mod state state (ESTABLISHED RELATED) ACCEPT;
    }
    chain FORWARD {
        policy DROP;

        # connection tracking
        mod state state INVALID DROP;
        mod state state (ESTABLISHED RELATED) ACCEPT;
    }
}

@include '/usr/local/bin/ferment-ng docker config|';

About

A tool to provide the current docker config in ferm format

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%