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

Commit 38f5a25

Browse files
authored
Merge pull request #66 from keybase/david/update-docs-per-schlos
Update docs per feedback on Github issues
2 parents 911c116 + c50f3ff commit 38f5a25

7 files changed

Lines changed: 47 additions & 13 deletions

File tree

docker/Makefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,13 @@ serve: env-file-exists ca-key-exists build
3030
docker run -d --restart unless-stopped -v $(CURDIR)/example-keybaseca-volume:/mnt:rw ca:latest docker/entrypoint-server.sh
3131
@echo "Started CA bot service in the background... Use `docker ps` and `docker logs` to monitor it"
3232

33+
# Stop the service
34+
stop:
35+
docker kill `docker ps -q --filter ancestor=ca`
36+
37+
# Restart the service (useful if you updated env.sh)
38+
restart: stop serve
39+
3340
# Wipe all data
3441
clean: confirm-clean reset-permissions
3542
@# Sudo since it is likely owned by another use since it was written from a docker container

docs/getting_started.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,10 @@ kssh root@server # If in {TEAM}.ssh.root_everywhere
6565
```
6666

6767
We recommend building kssh yourself and distributing the binary among your team (perhaps in Keybase Files!).
68+
69+
## Updating environment variables
70+
71+
If you update any environment variables, it is necessary to restart the keybaseca service. This can be done
72+
by running `make restart`. Note that it is not required to re-run `make generate`.
73+
74+
Note that this means `kssh` will not work for a brief period of time while the container restarts.

docs/troubleshooting.md

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,15 @@
33
This file contains some general directions and thoughts on troubleshooting the code in this repo. This is not meant
44
to be a comprehensive troubleshooting guide and is only a jumping off point.
55

6+
## `make generate` refuses to overwrite an existing key
7+
8+
In order to force `make generate` to overwrite the existing CA key (note that this will delete the existing CA
9+
key which means kssh will not work with any servers it currently works with), simply run:
10+
11+
```
12+
FORCE_WRITE=true make generate
13+
```
14+
615
## kssh is slow, but it works
716

817
When kssh starts, it has to search every team you are in for a `kssh-client.config` file which specifies the information
@@ -31,8 +40,19 @@ user than you are using for kssh.
3140

3241
## SSH rejects the connection
3342

34-
This likely means that you have not configured the SSH server correctly. Review the directions in README.md and ensure
35-
that you have followed the steps correctly ([sshca.md](./sshca.md) also has some additional information on how SSH CAs work that may
43+
This likely means that you have not configured the SSH server correctly. Confirm that on the SSH server you are trying to access:
44+
45+
* `/etc/ssh/ca.pub` has an SSH public key in it
46+
* `/etc/ssh/auth_principals/username-of-ssh-user` has the name of your Keybase team in it (or multiple comma separated keybase teams)
47+
* `/etc/ssh/sshd_config` has the below two lines somewhere in it:
48+
49+
```
50+
TrustedUserCAKeys /etc/ssh/ca.pub
51+
AuthorizedPrincipalsFile /etc/ssh/auth_principals/%u
52+
```
53+
54+
If that all looks good, review the getting started directions and ensure that you have followed the steps correctly
55+
([sshca.md](./sshca.md) also has some additional information on how SSH CAs work that may
3656
be helpful). If you would like to follow an example, see the code in the `tests/` directory which contains integration
3757
tests (focus on Dockerfile-sshd for an example SSH server setup). If none of that works, the best strategy is to run
3858
SSH on the server on an alternate port and review the debug information. On the server run `/usr/sbin/sshd -dd -D -p 2222`
@@ -101,3 +121,8 @@ It may be useful to define aliases in your bashrc to simplify this:
101121
alias kscp='kssh --provision && scp -F ~/.ssh/kssh-config'
102122
alias krsync='kssh --provision && rsync -e "ssh -F $HOME/.ssh/kssh-config"'
103123
```
124+
125+
## Other
126+
127+
For any other issues, please open a Github issue or ping @dworken on Keybase! We want to make this project as reliable
128+
as possible so please let us know if there are any ways we can improve the project.

src/cmd/keybaseca/keybaseca.go

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,8 @@ func main() {
5858
Before: beforeAction,
5959
},
6060
{
61-
Name: "generate",
62-
Usage: "Generate a new CA key",
63-
Flags: []cli.Flag{
64-
cli.BoolFlag{
65-
Name: "overwrite-existing-key",
66-
},
67-
},
61+
Name: "generate",
62+
Usage: "Generate a new CA key",
6863
Action: generateAction,
6964
Before: beforeAction,
7065
},
@@ -134,7 +129,7 @@ func generateAction(c *cli.Context) error {
134129
return err
135130
}
136131
captureControlCToDeleteClientConfig(conf)
137-
err = sshutils.Generate(conf, c.Bool("overwrite-existing-key") || os.Getenv("FORCE_WRITE") == "true")
132+
err = sshutils.Generate(conf, strings.ToLower(os.Getenv("FORCE_WRITE")) == "true")
138133
if err != nil {
139134
return fmt.Errorf("Failed to generate a new key: %v", err)
140135
}

src/keybaseca/sshutils/generate_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ func TestGenerateNewSSHKey(t *testing.T) {
1919
require.NoError(t, err)
2020

2121
err = GenerateNewSSHKey(filename, false, false)
22-
require.Errorf(t, err, "Refusing to overwrite existing key (try with --overwrite-existing-key or FORCE_WRITE=true if you're sure): "+filename)
22+
require.Errorf(t, err, "Refusing to overwrite existing key (try with FORCE_WRITE=true if you're sure): "+filename)
2323

2424
err = GenerateNewSSHKey(filename, true, false)
2525
require.NoError(t, err)

src/keybaseca/sshutils/sshutils.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ func GenerateNewSSHKey(filename string, overwrite bool, printPubKey bool) error
2828
return err
2929
}
3030
} else {
31-
return fmt.Errorf("Refusing to overwrite existing key (try with --overwrite-existing-key or FORCE_WRITE=true if you're sure): %s", filename)
31+
return fmt.Errorf("Refusing to overwrite existing key (try with FORCE_WRITE=true if you're sure): %s", filename)
3232
}
3333
}
3434

tests/bot-entrypoint.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def load_env():
2323
". %s\n"
2424
"bin/keybaseca --wipe-all-configs\n"
2525
"bin/keybaseca --wipe-logs || true\n"
26-
"bin/keybaseca generate --overwrite-existing-key\n"
26+
"FORCE_WRITE=true bin/keybaseca generate\n"
2727
# The output from this backup is tested in test_env_1.py
2828
"echo yes | bin/keybaseca backup > /shared/cakey.backup\n"
2929
# The output from this sign operation is tested in test_env_1.py

0 commit comments

Comments
 (0)