-
Notifications
You must be signed in to change notification settings - Fork 0
/
Taskfile.yml
88 lines (78 loc) · 2.12 KB
/
Taskfile.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
version: 3
includes:
common:
taskfile: ./task/Taskfile.yml
internal: true
aliases:
- c
tasks:
default:
- task: start
clean:
desc: clean ./build and docker
cmds:
- rm -rf ./build
- docker-compose down
lint:
desc: lint project
cmds:
- task: c:lint:go
test:
desc: test project
deps:
- start
cmds:
- defer: { task: stop }
- defer: sh -c 'docker container stop {{.TEST_IMAGE}}; docker container rm {{.TEST_IMAGE}}'
- sleep 1 # Takes a while for SSH server to start
- robot -X --exitonerror ./tests/e2e.robot
vars:
TEST_IMAGE: { sh: docker run -d -p 2001:22 alx99/honeypot:latest }
build:
desc: build project
sources:
- ./internal/**/*.go
- ./cmd/botpot/main.go
- ./go.mod
generates:
- ./build/botpot
cmds:
- CGO_ENABLED=0 go build -v -trimpath -ldflags "-s -w -X 'main.commitHash={{.COMMIT_HASH}}' -X 'main.compilationDate={{.DATE}}'" -o ./build/botpot ./cmd/botpot/main.go
start:
desc: start project
deps: [image, keys]
cmds:
- docker-compose up -d
stop:
desc: stop project
cmds:
- docker-compose stop
image:
desc: build project images
deps:
- task: build
- task: c:docker:build
vars:
DOCKER_FILE: honeypot/Dockerfile
IMAGE_NAME: alx99/honeypot:latest
cmds:
- task: c:docker:build
vars:
IMAGE_NAME: alx99/botpot:latest
keys:
desc: generate crypto keys
cmds:
- mkdir -p {{.KEY_DIR}}
- ssh-keygen -t rsa -N "" -f {{.KEY_DIR}}/rsa.pem
- ssh-keygen -t ed25519 -N "" -f {{.KEY_DIR}}/ed25519.pem
- ssh-keygen -t ecdsa -b 256 -N "" -f {{.KEY_DIR}}/ecdsa256.pem
- ssh-keygen -t ecdsa -b 384 -N "" -f {{.KEY_DIR}}/ecdsa384.pem
- ssh-keygen -t ecdsa -b 521 -N "" -f {{.KEY_DIR}}/ecdsa521.pem
status:
- test -f {{.KEY_DIR}}/rsa.pem
- test -f {{.KEY_DIR}}/ed25519.pem
- test -f {{.KEY_DIR}}/ecdsa256.pem
- test -f {{.KEY_DIR}}/ecdsa384.pem
- test -f {{.KEY_DIR}}/ecdsa521.pem
vars:
KEY_DIR: ./build/keys