Add healthcheck user

This commit is contained in:
Manfred Touron 2017-12-04 09:34:52 +01:00
parent 391a39d82c
commit f9d450ffaf
3 changed files with 22 additions and 0 deletions

View file

@ -3,6 +3,7 @@
## master (unreleased)
* Add `--latest` and `--quiet` options to `ls` commands
* Add `healthcheck` user
## v1.5.0 (2017-12-02)

View file

@ -38,6 +38,7 @@ Jump host/Jump server without the jump, a.k.a Transparent SSH bastion
* Session management
* Audit log
* Host Keys verifications shared across users
* Healthcheck user
## Usage
@ -316,3 +317,15 @@ ssh whoami@portal
ssh portal host create test@chat.shazow.net
ssh chat@portal
```
## Healthcheck
By default, `sshportal` will return `OK` to anyone sshing using the `healthcheck` user without checking for authentication.
```console
$ ssh healthcheck@sshportal
OK
$
```
the `healtcheck` user can be changed using the `healthcheck-user` option.

View file

@ -71,6 +71,11 @@ func main() {
Usage: "SSH user that spawns a configuration shell",
Value: "admin",
},
cli.StringFlag{
Name: "healthcheck-user",
Usage: "SSH user that returns healthcheck status without checking the SSH key",
Value: "healthcheck",
},
cli.StringFlag{
Name: "aes-key",
Usage: "Encrypt sensitive data in database (length: 16, 24 or 32)",
@ -123,6 +128,9 @@ func server(c *cli.Context) error {
}
switch username := s.User(); {
case username == c.String("healthcheck-user"):
fmt.Fprintln(s, "OK")
return
case username == currentUser.Name || username == currentUser.Email || username == c.String("config-user"):
if err := shell(c, s, s.Command(), db); err != nil {
fmt.Fprintf(s, "error: %v\n", err)