Forum Discussion
Stanislas_Piro2
Mar 11, 2018Cumulonimbus
I already had such issue. there might be another issue, if CN contains a comma (with backslash before), split command may cause an issue. I used following code to convert comma to | except if comma is backslashed:
array set dnparts [split [string map [list "\\," "," " , " "|" " ," "|" ", " "|"] $dn] "|="]
this command already create the array.
your code become:
when HTTP_REQUEST priority 200 {
...
create HTTP headers with ssl cert infos
set dn [ X509::issuer $cert ]
Split DN into Parts
array set dnparts [split [string map [list "\\," "," " , " "|" " ," "|" ", " "|"] $dn] "|="]
Insert the neccessary headers from the DN
HTTP::header insert "SSL_CLIENT_I_DN" "\"$dn\""
foreach field [array names dnparts] {
HTTP::header insert "SSL_CLIENT_I_DN_$field" "\"$dnparts($field)\""
}
}