diff options
author | Runxi Yu <me@runxiyu.org> | 2025-02-12 22:37:51 +0800 |
---|---|---|
committer | Runxi Yu <me@runxiyu.org> | 2025-02-12 22:37:51 +0800 |
commit | 11a8f2889e874ecebdbc49a6887918c7b043c503 (patch) | |
tree | 0ead7076fe6df7a1edf6d3a54963ae328a2f0084 /ssh.go | |
parent | README.md: Update about SSH implementation (diff) | |
download | forge-11a8f2889e874ecebdbc49a6887918c7b043c503.tar.gz forge-11a8f2889e874ecebdbc49a6887918c7b043c503.tar.zst forge-11a8f2889e874ecebdbc49a6887918c7b043c503.zip |
{ssh,global}.go, index.html: Add global data containing ssh fp
Diffstat (limited to 'ssh.go')
-rw-r--r-- | ssh.go | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -11,6 +11,10 @@ import ( go_ssh "golang.org/x/crypto/ssh" ) +var server_public_key_string string +var server_public_key_fingerprint string +var server_public_key go_ssh.PublicKey + func serve_ssh() error { host_key_bytes, err := os.ReadFile(config.SSH.Key) if err != nil { @@ -22,6 +26,10 @@ func serve_ssh() error { return err } + server_public_key = host_key.PublicKey() + server_public_key_string = string(go_ssh.MarshalAuthorizedKey(server_public_key)) + server_public_key_fingerprint = string(go_ssh.FingerprintSHA256(server_public_key)) + server := &glider_ssh.Server{ Handler: func(session glider_ssh.Session) { client_public_key := session.PublicKey() |