Create README.md for snap (#205)

* Create README.md for snap

* gen with desc
This commit is contained in:
Boshi Lian 2023-08-24 23:34:31 -07:00 committed by GitHub
parent bc5e676948
commit 36f03e7a74
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 73 additions and 5 deletions

View file

@ -0,0 +1,54 @@
# Snap for sshpiperd
[![Get it from the Snap Store](https://snapcraft.io/static/images/badges/en/snap-store-white.svg)](https://snapcraft.io/sshpiperd)
## Install
```
sudo snap install sshpiperd
```
## Config
```
sudo snap set sshpiperd <config>=<value>
sudo snap restart sshpiperd
```
### sshpiperd
* `sshpiperd.plugins` space separated list of plugins, allowed values: `workingdir`, `fixed`, `yaml` `failtoban`,
* `sshpiperd.address` listening address
* `sshpiperd.port` listening port
* `sshpiperd.server-key` server key files, support wildcard
* `sshpiperd.server-key-data` server key in base64 format, server-key, server-key-generate-mode will be ignored if set
* `sshpiperd.server-key-generate-mode` server key generate mode, one of: disable, notexist, always. generated key will be written to `server-key` if * no`texist or always
* `sshpiperd.login-grace-time` sshpiperd forcely close the connection after this time if the pipe has not successfully established
* `sshpiperd.log-level` log level, one of: trace, debug, info, warn, error, fatal, panic
* `sshpiperd.typescript-log-dir` create typescript format screen recording and save into the directory see https://linux.die.net/man/1/script
* `sshpiperd.banner-text` display a banner before authentication, would be ignored if banner file was set
* `sshpiperd.banner-file` display a banner from file before authentication
* `sshpiperd.drop-hostkeys-message` filter out hostkeys-00@openssh.com which cause client side warnings
### workingdir plugin
* `workingdir.root path` to root working directory
* `workingdir.allow-baduser-name` allow bad username
* `workingdir.no-check-perm` disable 0400 checking
* `workingdir.strict-hostkey` upstream host public key must be in known_hosts file, otherwise drop the connection
* `workingdir.no-password-auth` disable password authentication and only use public key authentication
### yaml plugin
* `yaml.config` path to yaml config file
* `yaml.no-check-perm` disable 0400 checking
### fixed plugin
* `fixed.target` target ssh endpoint address
### failtoban plugin
* `failtoban.max-failures` max failures
* `failtoban.ban-duration` ban duration

View file

@ -58,13 +58,22 @@ func extractFlags(namespace, filePath string) {
return true
}
var flagName string
var flagDesc string
for _, v := range cl.Elts {
if kv, ok := v.(*ast.KeyValueExpr); ok {
if kv.Key.(*ast.Ident).Name == "Name" {
fmt.Println(namespace + "." + strings.Trim(kv.Value.(*ast.BasicLit).Value, " \""))
switch kv.Key.(*ast.Ident).Name {
case "Name":
flagName = strings.Trim(kv.Value.(*ast.BasicLit).Value, " \"")
case "Usage":
flagDesc = strings.Trim(kv.Value.(*ast.BasicLit).Value, " \"")
}
}
}
fmt.Printf("%v.%v %v\n", namespace, flagName, flagDesc)
}
}
return true

View file

@ -70,17 +70,22 @@ func loadFromSnapctl() map[string][][]string {
continue
}
v, err := get(line)
parts := strings.Split(line, " ")
if len(parts) == 0 {
continue
}
opt := parts[0]
v, err := get(opt)
if err != nil {
log.Fatal(err)
log.Printf("error getting %v: %v", line, err)
}
if v == "" {
continue
}
parts := strings.Split(line, ".")
parts = strings.Split(opt, ".")
ns := parts[0]
flag := parts[1]