Created
March 21, 2015 09:38
-
-
Save jandd/9c69f602fb534a47c0ee to your computer and use it in GitHub Desktop.
Getting the CN from a client certificates SubjectDN and put it into a header with nginx and LUA
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set_by_lua $ssl_client_s_dn_subject_cn ' | |
dn = ngx.arg[1]; | |
cnstart = string.sub(dn, string.find(dn, "/CN=") + 4); | |
return string.sub(cnstart, 0, string.find(cnstart, "/") - 1); | |
' $ssl_client_s_dn; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment