ACL custom HAproxy

This commit is contained in:
nyanloutre 2018-06-21 10:15:39 +02:00
parent 71dfe32758
commit 4b9b6df84c
2 changed files with 10 additions and 5 deletions

View file

@ -27,6 +27,8 @@ in
port = mkOption { type = int; description = "Port number"; };
socket = mkOption { type = str; description = "Emplacement du socket"; default = ""; };
auth = mkOption { type = bool; description = "Enable authentification"; default = false; };
extraAcls = mkOption { type = str; description = "ACL HaProxy suplémentaires"; default = ""; };
aclBool = mkOption { type = str; description = "Logique d'authentification"; default = "!AUTH_OK"; };
}; });
example = ''
haproxy_backends = {
@ -102,8 +104,11 @@ in
''
)}
${(if value.auth then (
"\n acl AuthOK_LOUTRE http_auth(LOUTRE)\n"
+ " http-request auth realm LOUTRE if !AuthOK_LOUTRE\n"
value.extraAcls
+ ''
acl AUTH_OK http_auth(LOUTRE)
http-request auth realm LOUTRE if ${value.aclBool}
''
) else "")}
''
) cfg.services)}