--- a/access/access.go Sat May 04 03:24:20 2019 -0300
+++ b/access/access.go Sat May 04 04:17:51 2019 -0300
@@ -1,10 +1,10 @@
@@ -236,23 +236,16 @@
// loadKeys reads file trying to parse it as an authorized key
// format, returning the finger prints of all keys found
func loadKeys(file string) ([]string, error) {
- f, err := os.Open(filepath.Join(keysDir, file))
+ f, err := ioutil.ReadFile(filepath.Join(keysDir, file)) return nil, fmt.Errorf("loadKeys %q: %v", file, err)
- keys := make([]string, 0, 20)
- // according to sshd(8) each line of the file contains one key,
- // ignoring empty and lines starting with #
- bio := bufio.NewScanner(f)
- for line := 1; bio.Scan(); line++ {
- if key == "" || key[0] == '#' {
- pub, _, _, _, err := ssh.ParseAuthorizedKey([]byte(key))
+ keys := make([]string, 0, 5) + pub, _, _, f, err = ssh.ParseAuthorizedKey(f) - log.Errorf("loadKeys %q:%d: %v", file, line, err)
+ log.Errorf("loadKeys %s: %v", file, err) keys = append(keys, ssh.FingerprintSHA256(pub))