@@ -21,13 +21,52 @@ need.
2121 }}}
2222
2323 This configures two users, \code{myuser} and \code{anotheruser}, with their
24- corresponding passwords.
24+ corresponding passwords. The literal password can be provided, or a
25+ \link{bcrypt}{https://en.wikipedia.org/wiki/Bcrypt} hash of the password.
2526
2627 When local users are configured, the log-in page in the web UI will show a
2728 username/password prompt.
2829
2930 Local users can also log in via \reference{fly-login} with the
3031 \code{--username} and \code{--password} flags.
32+
33+ \section{
34+ \title{Bcrypt Hashing Passwords}{local-authentication}
35+
36+ Instead of passing in user passwords in plaintext, you can provide
37+ Concourse with a bcrypt hash of the passwords.
38+
39+ There aren't any great CLI tools for quickly hashing passwords with bcrypt.
40+ Here's a simple Go program that can do the hashing for you.
41+
42+ \codeblock{go}{{{
43+ package main
44+
45+ import (
46+ "fmt"
47+
48+ "golang.org/x/crypto/bcrypt"
49+ )
50+
51+ func main() {
52+ password := []byte("mypass")
53+ hash, _ := bcrypt.GenerateFromPassword(password, 12)
54+ fmt.Println(string(hash))
55+ }
56+ }}}
57+
58+ Put that in a \code{main.go} then run \code{go run main.go} and it will
59+ output a hash for your password. You can run this program in the \link{Go
60+ Playground}{https://go.dev/play/p/Ucv-ADJ9M0J} if you want to avoid
61+ installing Go.
62+
63+ Hashing the passwords for the previous example, you would then set
64+ \code{CONCOURSE_ADD_LOCAL_USER} to the following:
65+
66+ \codeblock{bash}{{{
67+ CONCOURSE_ADD_LOCAL_USER='myuser:$2a$12$L8Co5QYhD..S1l9mIIVHlucvRjfte4tuymMCk9quln0H/eol16d5W,anotheruser:$2a$12$VWSSfrsTIisf96q7UVsvyOBbrcP88kh5CLtuXYSXGwnSnM3ClKxXu'
68+ }}}
69+ }
3170}
3271
3372\section{
0 commit comments