Giter Club home page Giter Club logo

packetnet-fw-agent's Introduction

packetnet-fw-agent

Build Status

Inspired by droplan.

This package configures your Packet host firewalls. This will limit network traffic only to those hosts.

Either project-wide, or to a tag-based subset of hosts running the agent, modes available. It will periodically update lists from the Packet API.

Ideal uses might be highly-network dependent frameworks like:

Cronjobs can be used to update rules dynamically.

This repository is Experimental meaning that it's based on untested ideas or techniques and not yet established or finalized or involves a radically new and innovative style! This means that support is best effort (at best!) and we strongly encourage you to NOT use this in production.

Setup

This package is supported on arm64 and amd64 servers.

packetnet-fw-agent requires 3 configuration variables:

PACKET_AUTH_TOKEN: read-only key

PACKET_PROJECT_ID: the project the hosts will reside in.

PACKET_SEEK_TAG (Optional): if set, hosts tagged with this value will be targetted.

PUBLIC (Optional): if set, will include Public IP addresses in ruleset. These hosts will be inaccessible, except from other hosts in the network).

Usage

The package can be built for arm64 and amd64 hosts using the Makefile:

make build
make build-arm

and then run:

PACKET_AUTH_TOKEN=<ro token> \
PACKET_SEEK_TAG="capsule" \
PACKET_PROJECT_ID=<id> ./packetnet-fw-agent

or using the Docker images (on Docker Hub):

jmarhee/packetnet-fw-agent.amd64

jmarhee/packetnet-fw-agent.arm64

as in:

docker run -d --restart=always --net=host --cap-add=NET_ADMIN \
--name packetnet-fw-agent \
-e PACKET_AUTH_TOKEN=$PACKET_AUTH_TOKEN \
-e PACKET_PROJECT_ID=$PACKET_PROJECT_ID \
-e PACKET_SEEK_TAG=$PACKET_SEEK_TAG \
-e PUBLIC=$PUBLIC \
-e CHECK_INTERVAL=300 jmarhee/packetnet-fw-agent.amd64:latest

You can build the Docker images using the Makefile:

make TAG=$(date +%F%H%M%S) docker-arm64
make TAG=$(date +%F%H%M%S) docker-amd64

which will build new binaries as well for the desired architecture.

Example

In example/, you can use Terraform to spin-up a test environment.

export TF_VAR_auth_token=<your RW API key>
export TF_VAR_packet_ro_token=<your RO API key>
export TF_VAR_packet_public_network="true"

terraform apply

This example creates two hosts running packetnet-fw-agent. The tagged node will be inaccessible from outside the network.

packetnet-fw-agent's People

Contributors

jmarhee avatar rainleander avatar

Watchers

 avatar  avatar

packetnet-fw-agent's Issues

inconsistent detection of private IPs when PUBLIC=false

capsule can reliably detect the public IPv4 address, and differentiates from private IP when PUBLIC is set to true; when set to false, capsule seems to intermittently (because of how the IP is being pulled from the response body, by index value) retrieve the IPv6 address, which, of course, does not commit to iptables properly.

Uniform Standards Request: Experimental Repository

Hello!

We believe this repository is Experimental and therefore needs the following files updated:

If you feel the repository should be maintained or end of life or that you'll need assistance to create these files, please let us know by filing an issue with https://github.com/packethost/standards.

Equinix Metal maintains a number of public repositories that help customers to run various workloads on Equinix Metal. These repositories are in various states of completeness and quality, and being public, developers often find them and start using them. This creates problems:

  • Developers using low-quality repositories may infer that Equinix Metal generally provides a low quality experience.
  • Many of our repositories are put online with no formal communication with, or training for, customer success. This leads to a below average support experience when things do go wrong.
  • We spend a huge amount of time supporting users through various channels when with better upfront planning, documentation and testing much of this support work could be eliminated.

To that end, we propose three tiers of repositories: Private, Experimental, and Maintained.

As a resource and example of a maintained repository, we've created https://github.com/packethost/standards. This is also where you can file any requests for assistance or modification of scope.

The Goal

Our repositories should be the example from which adjacent, competing, projects look for inspiration.

Each repository should not look entirely different from other repositories in the ecosystem, having a different layout, a different testing model, or a different logging model, for example, without reason or recommendation from the subject matter experts from the community.

We should share our improvements with each ecosystem while seeking and respecting the feedback of these communities.

Whether or not strict guidelines have been provided for the project type, our repositories should ensure that the same components are offered across the board. How these components are provided may vary, based on the conventions of the project type. GitHub provides general guidance on this which they have integrated into their user experience.

multi-arch container pipeline

There's no reason for this to build two images, when the only different is the step targeting the arch when hub support multiple architectures for the same image-- figure that out

Makefile `clean` fails

Need to fix syntax because clean does not work as-is, and this impacts the Docker build steps.

update iptables fails

unclear if rules re-apply cleanly, but bails if chain exists but nothing was loaded initially, requires retry to apply cleanly (flush and delete, then recreate?)

tables.go houses all this behavior, imported directly from droplan, but check how its invoked since i did not see similar behavior in droplan when public was disabled. seems to function as expected when public is enabled.

Test Requirements

Test should:

  • Run example TF
  • Ping jumphost (won't be firewalled-- if pingable, success):
ping -oc 100000 "$some_address" > /dev/null && exit 0 || exit 1
  • Ping FW agent node (will be firewalled-- if pingable, fail, else, pass):
ping -oc 100000 "$some_address" > /dev/null && exit 1 || exit 0

Pretty straightforward workflow, demonstrates functionality intentionally.

This will need a one-liner to get the addresses out of TF state reliably as well.

packet-labs/packetnet-fw-agent will be removed!

This repository will be deleted by November 1, 2021.

While the concepts and instruction provided in this repository may be helpful to some users and carry some relevance, this repository has seen few recent changes. Packet became Equinix Metal over a year ago.

This repository requires maintenance and owners to ensure that the documentation is up to date and relevant. A repository like this one may need to update the version of dependencies and tools for safe consumption.

If you are affected by this deletion, please comment by the November 1, 2021 date.

Alternatives:

  • Repo is Archived. This is not preferable, it is intended that the 'packet-labs' GH org is vacated.
  • Repo is moved to github.com/equinix-labs. This is only preferably after Packet branding and tooling has been updated to Equinix Metal.

Helm Chart

Add to packet-labs/helm-charts, potentially as a DaemonSet-- let the CCM Secret provide auth, and the only require SEEK_TAG to find the cluster tag.

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.