class RhaproxyUserlist
It is possible to control access to frontend/backend/listen sections or to http stats by allowing only authenticated and authorized users. To do this, it is required to create at least one userlist and to define users.
Attributes
group[RW]
group <groupname> [users <user>,<user>,(…)]
Adds group <groupname> to the current userlist. It is also possible to attach users to this group by using a comma separated list of names proceeded by "users" keyword.
name[RW]
name <listname>
Creates new userlist with name <listname>. Many independent userlists can be used to store authentication & authorization data for independent customers.
user[RW]
user <username> [password|insecure-password <password>]
[groups <group>,<group>,(...)] Adds user <username> to the current userlist. Both secure (encrypted) and insecure (unencrypted) passwords can be used. Encrypted passwords are evaluated using the crypt(3) function so depending of the system's capabilities, different algorithms are supported. For example modern Glibc based Linux system supports MD5, SHA-256, SHA-512 and of course classic, DES-based method of crypting passwords.
Public Class Methods
new()
click to toggle source
Returns a new RhaproxyUserlist
Object
# File lib/rhaproxy/userlist.rb, line 49 def initialize() end
Public Instance Methods
config()
click to toggle source
Compile the HAproxy userlist configuration
# File lib/rhaproxy/userlist.rb, line 55 def config if @name conf = option_string() return conf else puts "no userlists name defined" return false end end
Private Instance Methods
option_string()
click to toggle source
# File lib/rhaproxy/userlist.rb, line 75 def option_string() ostring = " " + "userlist " + @name + "\n" if @group ostring += " " + "group " + @group + "\n" end if @user ostring += " " + "user " + @user + "\n" end ostring += "\n" return ostring end