gatekeeper/utils.go
Evan Hazlett 374742d8e8
add redis and ip assignment
Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
2019-09-13 00:13:38 -04:00

19 lines
340 B
Go

package main
import (
"crypto/sha256"
"fmt"
"github.com/gliderlabs/ssh"
"github.com/gomodule/redigo/redis"
)
func (s *Server) getConn() (redis.Conn, error) {
return redis.DialURL(s.cfg.RedisURL)
}
func (s *Server) getID(key ssh.PublicKey) string {
h := sha256.New()
h.Write(key.Marshal())
return fmt.Sprintf("%x", h.Sum(nil))
}