Skip to content

Instantly share code, notes, and snippets.

@Iristyle
Created February 21, 2013 15:53
Show Gist options
  • Save Iristyle/5005653 to your computer and use it in GitHub Desktop.
Save Iristyle/5005653 to your computer and use it in GitHub Desktop.
Configure HAProxy for userlists

Create SHA512 passwords

# make sure to use a leading space so that the command is not stored in your bash history!!
 mkpasswd -m sha-512 password1
# generates -> $6$yMgsow58.g/Z$mBjHfdVzqcF/LN.iwV23Eyqg.yGPTsp9pOwaStsJ6c4I4zL7BhucVVAkv5guf7OVRr8Pw0mHF4NrWBRCG5ci7/
 mkpasswd -m sha-512 password2
# generates -> $6$RZ86vRkQ$aRKN1HOsk6bDHBbMhS7jSo/p1NGFl4PvwY3KpU.72i./LvITi41nL84EkxOFXl.6Bmhynj/L7pYbfF0rUHtOB0

Edit /etc/haproxy/haproxy.cfg

userlist UsersFor_Ops
  group AdminGroup users userone,usertwo
  user userone password $6$yMgsow58.g/Z$mBjHfdVzqcF/LN.iwV23Eyqg.yGPTsp9pOwaStsJ6c4I4zL7BhucVVAkv5guf7OVRr8Pw0mHF4NrWBRCG5ci7/
  user usertwo password $6$RZ86vRkQ$aRKN1HOsk6bDHBbMhS7jSo/p1NGFl4PvwY3KpU.72i./LvITi41nL84EkxOFXl.6Bmhynj/L7pYbfF0rUHtOB0


...


backend myserver
    mode    http
    server  myserver   1.1.1.1:80
    acl AuthOkay_Ops http_auth(UsersFor_Ops)
    http-request auth realm MyAuthRealm if !AuthOkay_Ops
@ba0f3
Copy link

ba0f3 commented Dec 3, 2018

thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment