Skip to content

Commit 5f22eb2

Browse files
chore(cdk): Add Firejail and gVisor POC Dockerfiles
Co-Authored-By: Aaron <AJ> Steers <[email protected]>
1 parent 0895115 commit 5f22eb2

File tree

3 files changed

+73
-0
lines changed

3 files changed

+73
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Dockerfile for Firejail POC
2+
FROM airbyte/source-declarative-manifest:latest
3+
4+
USER root
5+
6+
# Install firejail
7+
RUN apt-get update && \
8+
apt-get install -y firejail && \
9+
apt-get clean && \
10+
rm -rf /var/lib/apt/lists/*
11+
12+
# Create a wrapper script for the entry point
13+
RUN echo '#!/bin/bash' > /usr/local/bin/firejail-wrapper.sh && \
14+
echo '# Firejail wrapper for source-declarative-manifest' >> /usr/local/bin/firejail-wrapper.sh && \
15+
echo 'firejail --noprofile --quiet --private -- python /airbyte/integration_code/main.py "$@"' >> /usr/local/bin/firejail-wrapper.sh && \
16+
chmod +x /usr/local/bin/firejail-wrapper.sh
17+
18+
# Set the new entry point
19+
ENTRYPOINT ["/usr/local/bin/firejail-wrapper.sh"]
20+
USER airbyte
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Dockerfile for gVisor POC
2+
FROM airbyte/source-declarative-manifest:latest
3+
4+
USER root
5+
6+
# Install dependencies
7+
RUN apt-get update && \
8+
apt-get install -y curl gnupg apt-transport-https ca-certificates && \
9+
apt-get clean && \
10+
rm -rf /var/lib/apt/lists/*
11+
12+
# Add gVisor repo and install runsc
13+
RUN curl -fsSL https://gvisor.dev/archive.key | apt-key add - && \
14+
echo 'deb https://storage.googleapis.com/gvisor/releases release main' > /etc/apt/sources.list.d/gvisor.list && \
15+
apt-get update && \
16+
apt-get install -y runsc && \
17+
apt-get clean && \
18+
rm -rf /var/lib/apt/lists/*
19+
20+
# Create a wrapper script for the entry point
21+
RUN echo '#!/bin/bash' > /usr/local/bin/gvisor-wrapper.sh && \
22+
echo '# gVisor wrapper for source-declarative-manifest' >> /usr/local/bin/gvisor-wrapper.sh && \
23+
echo 'runsc run --network=host --TESTONLY-unsafe-nonroot=true --rootless -- python /airbyte/integration_code/main.py "$@"' >> /usr/local/bin/gvisor-wrapper.sh && \
24+
chmod +x /usr/local/bin/gvisor-wrapper.sh
25+
26+
# Set the new entry point
27+
ENTRYPOINT ["/usr/local/bin/gvisor-wrapper.sh"]
28+
USER airbyte

docker/sandbox-poc/README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Sandbox POC Dockerfiles
2+
3+
This directory contains Dockerfiles for proof-of-concept (POC) implementations of sandboxing solutions for the source-declarative-manifest connector.
4+
5+
## Firejail
6+
7+
The `Dockerfile.firejail` adds [Firejail](https://firejail.wordpress.com/) to the source-declarative-manifest image. Firejail is a SUID sandbox program that restricts the running environment of untrusted applications using Linux namespaces and seccomp-bpf.
8+
9+
To build the image:
10+
```
11+
docker build -f Dockerfile.firejail -t airbyte/source-declarative-manifest-firejail .
12+
```
13+
14+
## gVisor
15+
16+
The `Dockerfile.gvisor` adds [gVisor](https://gvisor.dev/) (via runsc) to the source-declarative-manifest image. gVisor is a user-space kernel, written in Go, that implements a substantial portion of the Linux system call interface. It provides an additional layer of isolation between running applications and the host operating system.
17+
18+
To build the image:
19+
```
20+
docker build -f Dockerfile.gvisor -t airbyte/source-declarative-manifest-gvisor .
21+
```
22+
23+
## Usage
24+
25+
Both images wrap the original entry point of the source-declarative-manifest connector with their respective sandboxing solution. The wrapped entry point handles all the same command-line arguments as the original entry point.

0 commit comments

Comments
 (0)