Skip to content
This repository was archived by the owner on Jan 22, 2025. It is now read-only.

Commit c7b16b9

Browse files
authored
replace source env.sh with env.list (#76)
1 parent 41ad75e commit c7b16b9

File tree

8 files changed

+20
-22
lines changed

8 files changed

+20
-22
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
bin/
22
keybaseca.config
33
nohup.out
4-
env.sh
4+
env.list
55
__pycache__
66

77
# sphinx generated files:

docker/Dockerfile-ca

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,9 @@ COPY --from=builder --chown=keybase:keybase /go/bin/keybase /usr/local/bin/
4141
COPY --from=builder --chown=keybase:keybase /go/bin/kbfsfuse /usr/local/bin/
4242
COPY --from=builder --chown=keybase:keybase /bot-sshca/bin/keybaseca bin/
4343

44-
# copy in entrypoint scripts and env.sh
45-
COPY --chown=keybase:keybase ./docker ./
44+
# copy in entrypoint scripts
45+
COPY --chown=keybase:keybase ./docker/entrypoint-generate.sh ./
46+
COPY --chown=keybase:keybase ./docker/entrypoint-server.sh ./
4647

4748
# Run container as root but only to be able to chown the Docker bind-mount,
4849
# then immediatetly step down to the keybase user via sudo in the entrypoint scripts

docker/Makefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ build: reset-permissions
1515

1616
# Generate a new CA key
1717
generate: env-file-exists build
18-
docker run -e FORCE_WRITE=$(FORCE_WRITE) -v $(CURDIR)/example-keybaseca-volume:/mnt:rw ca:latest ./entrypoint-generate.sh
18+
docker run -e FORCE_WRITE=$(FORCE_WRITE) --env-file ./env.list -v $(CURDIR)/example-keybaseca-volume:/mnt:rw ca:latest ./entrypoint-generate.sh
1919
@echo -e "\nRun these commands on each server that you wish to use with the CA chatbot\n"
2020
@echo "useradd developer && mkdir -p /home/developer && chown developer:developer /home/developer # The user that will be used for non-root logins"
2121
@echo "echo \"`cat $(CURDIR)/example-keybaseca-volume/keybase-ca-key.pub`\" > /etc/ssh/ca.pub"
@@ -27,14 +27,14 @@ generate: env-file-exists build
2727

2828
# Start the CA chatbot in the background
2929
serve: env-file-exists ca-key-exists
30-
docker run -d --restart unless-stopped -v $(CURDIR)/example-keybaseca-volume:/mnt:rw ca:latest ./entrypoint-server.sh
30+
docker run -d --restart unless-stopped --env-file ./env.list -v $(CURDIR)/example-keybaseca-volume:/mnt:rw ca:latest ./entrypoint-server.sh
3131
@echo "Started CA bot service in the background... Use `docker ps` and `docker logs` to monitor it"
3232

3333
# Stop the service
3434
stop:
3535
docker kill `docker ps -q --filter ancestor=ca`
3636

37-
# Restart the service (useful if you updated env.sh)
37+
# Restart the service (useful if you updated env.list)
3838
restart: stop serve
3939

4040
# Wipe all data
@@ -52,9 +52,9 @@ reset-permissions:
5252
# Avoid prompting for sudo unless the permissions actually need to be chnaged by piping find to xargs
5353
find example-keybaseca-volume/ -not -user $$USER | xargs -I {} -- sudo chown -R $$USER {}
5454

55-
# Asserts that env.sh exists
55+
# Asserts that env.list exists
5656
env-file-exists:
57-
@test -e "env.sh" || (echo "You must create and fill in env.sh prior to running make" && exit 1)
57+
@test -e "env.list" || (echo "You must create and fill in env.list prior to running make" && exit 1)
5858

5959
# Assert that a CA key exists
6060
ca-key-exists:

docker/entrypoint-generate.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ chown -R keybase:keybase /mnt
77

88
# Run everything else as the keybase user
99
sudo -i -u keybase bash << EOF
10-
source ./env.sh
1110
export "FORCE_WRITE=$FORCE_WRITE"
1211
nohup bash -c "KEYBASE_RUN_MODE=prod kbfsfuse /keybase | grep -v 'ERROR Mounting the filesystem failed' &"
1312
sleep 3

docker/entrypoint-server.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ chown -R keybase:keybase /mnt
77

88
# Run everything else as the keybase user
99
sudo -i -u keybase bash << EOF
10-
source ./env.sh
1110
nohup bash -c "KEYBASE_RUN_MODE=prod kbfsfuse /keybase | grep -v 'ERROR Mounting the filesystem failed' &"
1211
sleep 3
1312
keybase oneshot

docker/env.list.example

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# List the subteams here separated by commas (eg "teamname.ssh.production,teamname.ssh.staging") that you
2+
# wish to use to grant SSH access
3+
TEAMS="teamname.ssh.staging,teamname.ssh.production,..."
4+
5+
# Login info for the chat bot
6+
KEYBASE_USERNAME="username_of_ca_bot"
7+
KEYBASE_PAPERKEY="paper key for the ca bot"

docker/env.sh.example

Lines changed: 0 additions & 9 deletions
This file was deleted.

docs/getting_started.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ On a secured server (note that this server only needs docker installed) that you
2424
```bash
2525
git clone [email protected]:keybase/bot-sshca.git
2626
cd bot-sshca/docker/
27-
cp env.sh.example env.sh
28-
nano env.sh # Fill in the values including the previously generated paper key
27+
cp env.list.example env.list
28+
nano env.list # Fill in the values including the previously generated paper key
2929
make generate # Generate a new CA key
3030
```
3131

@@ -71,4 +71,5 @@ We recommend building kssh yourself and distributing the binary among your team
7171
If you update any environment variables, it is necessary to restart the keybaseca service. This can be done
7272
by running `make restart`. Note that it is not required to re-run `make generate`.
7373

74-
Note that this means `kssh` will not work for a brief period of time while the container restarts.
74+
Note that this means `kssh` will not work for a brief period of time while the container restarts.
75+

0 commit comments

Comments
 (0)