diff --git a/external/cmd/helpers/createkeyfile/main.go b/external/cmd/helpers/createkeyfile/main.go index 990578c..cdcff38 100644 --- a/external/cmd/helpers/createkeyfile/main.go +++ b/external/cmd/helpers/createkeyfile/main.go @@ -76,12 +76,13 @@ func main() { quit(fmt.Sprintf("file contents look wrong: %s", string(stdin)), 8) } - n, err = f.Write(stdin) + _, err = f.Write(stdin) if err != nil { quit(err.Error(), 9) - } else if n == 0 { - quit("wrote nothing to keyfile", 10) } + + _, err = f.WriteString("\n") + } /* diff --git a/external/cmd/welcome/main.go b/external/cmd/welcome/main.go index 87a483c..b51fbb5 100644 --- a/external/cmd/welcome/main.go +++ b/external/cmd/welcome/main.go @@ -7,6 +7,7 @@ import ( "fmt" "os" "os/exec" + "strings" "time" "git.tilde.town/tildetown/town/invites" @@ -205,12 +206,16 @@ func createUser(data newUserData) (err error) { } func keyfileText(data newUserData) string { + pkey := data.PubKey + if !strings.HasSuffix(pkey, "\n") { + pkey += "\n" + } header := `########## GREETINGS! ########## # This file was automatically generated by tilde.town when # your account was created. You can edit it if you want, but we # recommend adding stuff to ~/.ssh/authorized_keys instead.` - return fmt.Sprintf("%s\n%s", header, data.PubKey) + return fmt.Sprintf("%s\n%s", header, pkey) } func main() {