mirror of
https://github.com/moul/sshportal.git
synced 2025-01-06 07:32:01 +08:00
Add healthcheck
user
This commit is contained in:
parent
391a39d82c
commit
f9d450ffaf
3 changed files with 22 additions and 0 deletions
|
@ -3,6 +3,7 @@
|
|||
## master (unreleased)
|
||||
|
||||
* Add `--latest` and `--quiet` options to `ls` commands
|
||||
* Add `healthcheck` user
|
||||
|
||||
## v1.5.0 (2017-12-02)
|
||||
|
||||
|
|
13
README.md
13
README.md
|
@ -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.
|
||||
|
|
8
main.go
8
main.go
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue