Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set up CA #19

Merged
merged 26 commits into from
Jun 11, 2022
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
85045a5
fix error, where instance is not reachable after restart
bafread Jun 4, 2022
4f8d75c
TLDR: Fix Issue with Packer and add Guest Image on Sacrificial
bafread Jun 4, 2022
90d35c9
update main.tf
bafread Jun 4, 2022
292877b
add machine type
bafread Jun 5, 2022
a4bbd3f
Revert "add machine type"
bafread Jun 5, 2022
ed2dc0b
Updated Packer
bafread Jun 6, 2022
6530a55
add script to prepare folder for config
bafread Jun 6, 2022
264f9bd
Apply some changes and add a fix for docker daemon in sacrificial-vm
bafread Jun 7, 2022
7832f4c
small changes, and add script
bafread Jun 8, 2022
1e97591
re-add the mount of folder
bafread Jun 8, 2022
18f5ac5
small fix and small change
bafread Jun 8, 2022
98a5647
add script: run container on gateway-vm
bafread Jun 8, 2022
1ed9489
just another version
bafread Jun 8, 2022
1e4bb40
small changes on .gitignore
bafread Jun 8, 2022
80be9bb
docs: remove unused doc
paseaf Jun 10, 2022
a46bcdc
chore: remove /.gitignore, update terraform lock file
paseaf Jun 10, 2022
212e25e
chore: add description to terraform variables.tf
paseaf Jun 10, 2022
0d98061
refactor: move packer var to auto.pkrvars.hcl
paseaf Jun 10, 2022
b38f0e9
refactor: rename scripts
paseaf Jun 10, 2022
29880a5
style: format
paseaf Jun 10, 2022
aee10bb
feat: set up CA
paseaf Jun 11, 2022
f696f72
docs: improve doc
paseaf Jun 11, 2022
73e6509
chore: update .gitignore for packer
paseaf Jun 11, 2022
be287d6
doc: rephrease section head
paseaf Jun 11, 2022
394baf7
packer: remove ca files
paseaf Jun 11, 2022
d49fe0b
docs: run dockerd in detached mode
paseaf Jun 11, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions packer/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,20 @@
gcp.key.json

# Recommended .gitignore
# from https://github.com/github/gitignore/blob/main/Packer.gitignore
# Cache objects
packer_cache/

# Crash log
crash.log

# https://www.packer.io/guides/hcl/variables
# Exclude all .pkrvars.hcl files, which are likely to contain sensitive data,
# such as password, private keys, and other secrets. These should not be part of
# version control as they are data points which are potentially sensitive and
# subject to change depending on the environment.
#
*.pkrvars.hcl

# For built boxes
*.box
10 changes: 7 additions & 3 deletions packer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ What you need:

> Note: if you want to use a different file name or location, change `account_file` in [`./main.pkr.hcl`](./main.pkr.hcl) accordingly

3. Update `project-id` in `main.pkr.hcl` to match yours
3. Create a `variables.auto.pkrvars.hcl` file:

```bash
project = "<your_GCP_project_ID>"
```

### Build the image

Expand All @@ -45,6 +49,6 @@ An image should be built to your GCP project
Note: `-force` to overwrite previously built image.

### Troubleshooting
1. Flaky `packer build -force`
Solution: rerun the command. There are strange errors sometimes and we don't yet know how to solve it :P

1. Flaky `packer build -force`
Solution: rerun the command. There are strange errors sometimes and we don't yet know how to solve it :P
Binary file added packer/files/ca_client.tar
Binary file not shown.
Binary file added packer/files/ca_server.tar
Binary file not shown.
209 changes: 209 additions & 0 deletions packer/files/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,209 @@
log:
level: warning
ssh:
banner: |

********************************************************************
Warning!
********************************************************************

This is a honeypot. All information, including IP address, username,
password, any commands you type, or files you upload will be visible
to the honeypot.

If you do not agree disconnect now.

********************************************************************

hostkeys:
- /etc/containerssh/ssh_host_rsa_key
backend: docker
docker:
connection:
host: tcp://10.0.1.10:2376
cert: |
-----BEGIN CERTIFICATE-----
MIIFoDCCA4igAwIBAgIUU62+sbHHcvVoYA65ZIqwhVr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ZEornJFPeAwHr46sf
rDgxtReibkFwmzkPTvlyZKlrPSwptDWCjtindpGWzq26ON4POpPozoSAy9oc2SeX
7It1UX40zz+gOWcCAwEAAaNTMFEwHQYDVR0OBBYEFOVZ4jK5qNy9s2uv6XCV6tZx
WrMkMB8GA1UdIwQYMBaAFOVZ4jK5qNy9s2uv6XCV6tZxWrMkMA8GA1UdEwEB/wQF
MAMBAf8wDQYJKoZIhvcNAQELBQADggIBAC9JQH+bQGprD78TNHH+X2C4tDjI6KEo
2+nRwb8PoMDHF2EXqIT+g90nIIpSRzZaBG0FmQIAIZ+5hx//RPuBfIQdIQuvxIvt
H3QNCw4ABmmepO2ymYdsSjJIaDmQUVMKTruh2k+XVqN/9lRCqhe39J7RXSxmRQgg
B/jFUZomfcVklB8e6Z4mrFH928ylBgsFt8QO4Rnc/69md2G2ZZMsVM3fZUTyTxd7
CCvSUawqGr+3R5EZ71iRmFLRPg7b1OSuFMw9JeT6PyAbLp4vxiCVY6XHsQzRoWGL
v7BO6njyZHxvwsYrllwEL993UdhQSqIzQ05PuN8AUjh8TW52oY110VyZ3AJQsuVO
FUTeIVwnYrDkvTUDfs9mNEQ3fTkiQp1WBjvxntfAZRoiptXw88Q/r61TBuhzKblN
XWIa3HN8INLESqo1Mj/hAMn74l/oyJA+SIICcdKCaTSu9hWbBYM91lgYcLw31lh5
2etaoD6m0vN2IwLwWZZw8lPmSBG0L3cfRVDDSmNS85PWhwuSUMBT+CRi5JEHQbp4
gFByxSj8Ez6EDLUTTSXa1gylwp6NnY+9sHpYH9TFAzS6o5uimMXjfBIutU5T+ftD
zPMfrpjwrw+ungUcIhcBvPhvmXKxdPSsiX5CyPby/KV5n4UkUGJyL7+LY4MMgenP
6RFnPgn7Egf3
-----END CERTIFICATE-----
execution:
imagePullPolicy: Never
container:
image: containerssh/containerssh-guest-image
hostname: bitcoin
# Disable network in the container
networkdisabled: true
# Force running as user 1000
user: 1000
# Optionally set working directory
workingdir: /home/ubuntu
host:
# Don't let the attacker write to the root FS.
readonlyrootfs: true
resources:
# 10% of CPU
cpuperiod: 10000
cpuquota: 1000
# 50 MB of memory with swap
memoryswap: 52428800
memoryswappiness: 50
# 25 MB of memory
memory: 26214400
# Reserve 20 MB of memory
memoryreservation: 20000000
# Max 1000 processes to prevent fork bombs
pidslimit: 1000
tmpfs:
# Create writable directories in memory
/tmp: rw,noexec,nosuid,size=65536k,uid=1000,gid=1000
/run: rw,noexec,nosuid,size=65536k,uid=1000,gid=1000
/home/ubuntu: rw,noexec,nosuid,size=65536k,uid=1000,gid=1000
metrics:
enable: true
listen: "0.0.0.0:9101"
path: "/metrics"
audit:
enable: true
format: binary
storage: s3
intercept:
stdin: true
stdout: true
stderr: true
passwords: true
s3:
# Local directory to store the audit log temporarily.
local: /var/log/containerssh/audit/
accessKey: ROOTNAME
secretKey: CHANGEME123
region: europe-west3
bucket: sshcontainer
# Optional: set your S3 endpoint
endpoint: http://10.0.0.11:9090/
metadata:
# Which metadata fields to set in the object storage.
username: true
ip: false
auth:
url: "http://127.0.0.1:8080"
configserver:
url: "http://127.0.0.1:8080/config"
79 changes: 62 additions & 17 deletions packer/main.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -8,61 +8,106 @@ packer {
}

source "googlecompute" "ubuntu-2204" {
project_id = "containerssh"
project_id = var.project_id
paseaf marked this conversation as resolved.
Show resolved Hide resolved
source_image_family = "ubuntu-pro-2204-lts"
ssh_username = "root"
zone = "europe-west3-c"
account_file = "./gcp.key.json"
machine_type = "e2-small"
paseaf marked this conversation as resolved.
Show resolved Hide resolved
}

build {
name = "sacrificial-vm-image"

source "googlecompute.ubuntu-2204" {
image_name = "sacrificial-vm-image"
}

provisioner "shell" {
inline = [
"mkdir -p /home/deployer/tmp",
"mkdir /etc/docker/",
"mkdir /var/docker/"
]
}

provisioner "file" {
source = "./scripts/util_fn"
destination = "/tmp/util_fn"
source = "./files/ca_server.tar"
destination = "/home/deployer/tmp/ca_server.tar"
}

provisioner "file" {
source = "./scripts/apt_get_wait_lock.sh"
destination = "/home/deployer/tmp/apt_get_wait_lock.sh"
}
provisioner "shell" {
script = "./scripts/update.sh"
script = "./scripts/update_apt_packages.sh"
expect_disconnect = true
paseaf marked this conversation as resolved.
Show resolved Hide resolved
}

provisioner "file" {
source = "./scripts/util_fn"
destination = "/tmp/util_fn"
source = "./scripts/apt_get_wait_lock.sh"
destination = "/home/deployer/tmp/apt_get_wait_lock.sh"
}

provisioner "shell" {
script = "./scripts/install_docker.sh"
}

provisioner "shell" {
inline = [
"docker pull containerssh/containerssh-guest-image:latest"
]
}
}

build {
name = "logger-vm-image"

name = "ubuntu-with-docker-image"
source "googlecompute.ubuntu-2204" {
image_name = "logger-vm-image"
image_name = "ubuntu-with-docker-image"
}

provisioner "shell" {
inline = [
"mkdir -p /home/deployer/tmp",
]
}

# test
provisioner "file" {
source = "./files/ca_client.tar"
destination = "/home/deployer/tmp/ca_client.tar"
paseaf marked this conversation as resolved.
Show resolved Hide resolved
}

provisioner "file" {
source = "./scripts/apt_get_wait_lock.sh"
destination = "/home/deployer/tmp/apt_get_wait_lock.sh"
}

provisioner "shell" {
script = "./scripts/update_apt_packages.sh"
expect_disconnect = true
}

provisioner "file" {
source = "./scripts/util_fn"
destination = "/tmp/util_fn"
source = "./scripts/apt_get_wait_lock.sh"
destination = "/home/deployer/tmp/apt_get_wait_lock.sh"
}

provisioner "shell" {
script = "./scripts/update.sh"
inline = [
"mkdir /srv/containerssh/"
]
}

provisioner "file" {
source = "./scripts/util_fn"
destination = "/tmp/util_fn"
source = "./files/config.yaml"
destination = "/srv/containerssh/config.yaml"
}

provisioner "shell" {
script = "./scripts/containerssh_config.sh"
}

provisioner "shell" {
script = "./scripts/install_docker.sh"
}
}

File renamed without changes.
8 changes: 8 additions & 0 deletions packer/scripts/containerssh_config.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

set -euxo pipefail

mkdir -p /srv/containerssh/config/
mkdir -p /srv/containerssh/audit/
cd /srv/containerssh
openssl genrsa > ssh_host_rsa_key
Loading