惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

L
LangChain Blog
The GitHub Blog
The GitHub Blog
Recent Announcements
Recent Announcements
MyScale Blog
MyScale Blog
P
Proofpoint News Feed
S
Security @ Cisco Blogs
N
News and Events Feed by Topic
H
Hacker News: Front Page
Attack and Defense Labs
Attack and Defense Labs
S
Secure Thoughts
Microsoft Security Blog
Microsoft Security Blog
N
Netflix TechBlog - Medium
U
Unit 42
Stack Overflow Blog
Stack Overflow Blog
T
Threat Research - Cisco Blogs
Google Online Security Blog
Google Online Security Blog
Spread Privacy
Spread Privacy
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
L
LINUX DO - 热门话题
T
Tenable Blog
博客园 - 叶小钗
D
DataBreaches.Net
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
博客园_首页
人人都是产品经理
人人都是产品经理
aimingoo的专栏
aimingoo的专栏
C
Check Point Blog
博客园 - 三生石上(FineUI控件)
量子位
P
Proofpoint News Feed
H
Help Net Security
Blog — PlanetScale
Blog — PlanetScale
宝玉的分享
宝玉的分享
Recorded Future
Recorded Future
The Register - Security
The Register - Security
F
Fortinet All Blogs
Engineering at Meta
Engineering at Meta
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Last Week in AI
Last Week in AI
S
Schneier on Security
V
Vulnerabilities – Threatpost
雷峰网
雷峰网
Microsoft Azure Blog
Microsoft Azure Blog
G
GRAHAM CLULEY
G
Google Developers Blog
月光博客
月光博客
V
V2EX
T
Troy Hunt's Blog
A
Arctic Wolf

Bastille Blog | BastilleBSD

Share Pkg Cache Between Jails | BastilleBSD Automating Ten Things To Do After Installing FreeBSD With Rocinante | BastilleBSD Ten Things To Do After Installing FreeBSD | BastilleBSD Bastille Template: AdGuard Home Exporter | BastilleBSD Bastille 0.9.20211225 Demo Livestream | BastilleBSD Closing Out 2021 With New Bastille Release | BastilleBSD Bastille Template: AdGuard Home | BastilleBSD Experimenting With Ubuntu and Debian Linux Containers | BastilleBSD Bastille New Year 2021 Bug Fix Release Notes | BastilleBSD Bastille Port Redirection and Persistence | BastilleBSD Bastille Default Templates and Customization | BastilleBSD Bastille New Year 2021 Release Notes | BastilleBSD Bastille Groundhog Day Release | BastilleBSD Bastille pkg demo: Bastille in depth Series | BastilleBSD Bastille create demo: Bastille in depth series | BastilleBSD Bastille cmd demo: Bastille in depth Series | BastilleBSD Bastille bootstrap demo: Bastille in depth Series | BastilleBSD Getting Started Video | BastilleBSD Thanksgiving 2019 | BastilleBSD Release Notes - Captain Jack | BastilleBSD Regarding Updating | BastilleBSD
Bastille Networking in Depth | BastilleBSD
Christer Edwards · 2020-02-18 · via Bastille Blog | BastilleBSD

Bastille is an open-source system for automating deployment and management containerized applications on FreeBSD.


Bastille Networking Options

loopback (bastille0)
LAN (host alias)
VNET (vnet0)

FreeBSD networking is known to be robust and reliable. This makes a great platform to host containerized applications and offers a flexibility of options allowing for a range of networks.

Bastille supports both IPv4 and IPv6 networks including assigning multiple addresses to a container interface.

loopback (bastille0)

The “loopback” design creates a non-routable loopback interface on the host system and assigns each container an address on this interface.

Containers attached to this loopback interface are unable to access traffic destined for another container despite sharing an interface. In this design containers are restricted with allow.raw_sockets=0, disallowing any packet sniffing or similar behavior. This restrictions also disallows the use of ping inside the container.

This is the default network design and easily flexible across networks and infrastructures (on-premise, data-center, cloud, etc). A host firewall is required in this design further securing the host and containers.

A quick one-time setup is required in this design:

bastille0

sysrc cloned_interfaces+=lo1
sysrc ifconfig_lo1_name=bastille0
service netif cloneup

/etc/pf.conf

ext_if="vtnet0"

set block-policy return
scrub in on $ext_if all fragment reassemble
set skip on lo

table <jails> persist
nat on $ext_if from <jails> to any -> ($ext_if)
rdr-anchor "rdr/*"

block in all
pass out quick keep state
antispoof for $ext_if inet
pass in inet proto tcp from any to any port ssh flags S/SA keep state

NOTE: The ext_if= in the example must be updated to match the name of the host external interface. This is usually em0, re0, vtnet0, etc.

ipv4

bastille create nginx 12.2-RELEASE 10.17.89.10 bastille0

ipv6

bastille create nginx 12.2-RELEASE fde3:e1d5:8af6:5a79::13 bastille0

LAN (host alias)

The “LAN” design uses the hosts existing interface(s) and assigns container addresses as aliases to these interfaces. In FreeBSD interfaces are named after the hardware/driver. This means you’ll find a range of interface names such as re0, igb0, em0, vtnet0, etc.

bastille create nginx 12.2-RELEASE 192.168.1.13 re0

ipv6

bastille create nginx 12.2-RELEASE fde3:e1d5:8af6:5a79::13 re0

VNET (vnet0)

VNET support was added in the second half of the 0.6.x series (0.6.20200224).

VNET (virtual network) provides a virtual network interface to the container. In this design the container does not share an interface with any other containers. This is the only design that supports private interfaces and DHCP.

Connectivity is achieved by attaching this virtual interface to a bridge interface on the host by way of an epair. An epair interface comes in two parts, an epairXa and an epairXb. The epairXa interface is attached to the bridge interface and the epairXb interface is passed to the container and renamed vnet0.

In Bastille’s VNET design each container is assigned a unique epair. These epair interfaces will named e0[ab]_vnetX. One side of the epair, e0a_vnetX will be added to the bridge while e0b_vnetX will be present only within the container and renamed by Bastille to vnet0.

Creating a VNET container requires using one of the -V, --vnet or vnet options as well as providing a network interface name. The network interface provided will be added to the bridge interface along with container(s) providing the physical link to the public network.

As of the 0.6.20200224 release, the default route is defined for a VNET conatiner by copying the host’s default route.

Bastille provides a shortcut to creating a DHCP-enabled container. Simply provide the IP 0.0.0.0 and the container will be configured to use DHCP.

DHCP (ipv4)

bastille create -V nginx 12.2-RELEASE 0.0.0.0 re0

ipv4

bastille create -V nginx 12.2-RELEASE 192.168.1.13 re0

ipv6

bastille create -V nginx 12.2-RELEASE fde3:e1d5:8af6:5a79::13 re0