Forum Discussion
Adrien_Legros_1
Altostratus
Oct 16, 2008Encrypt-Decrypt all the cookies on the fly
Our applications use a lot of cookies so I wanted to secure it via an Irule inspired by these i can find in this forum but nothing is working. When I use my Irule or another one, my website doesn't wo...
Adrien_Legros_1
Altostratus
Oct 16, 2008I understood that the encryption did not work on the boolean value to test if the cookies are sen. So, I've modified my code:
One cookie is well encrypted but the others are sent in clear...that's what I dont understand... No more errors in the LTM logs..
when RULE_INIT {
set ::cookie_passphrase "123AqwZsx"
}
when HTTP_RESPONSE {
log local0. "reponse1"
set myValues [HTTP::cookie names]
foreach mycookies $myValues {
if {$mycookies ne "ns_cookietest"}{
log local0. "Cookie $mycookies : Value before encryption is [HTTP::cookie value $mycookies]: "
set encrypted_value [HTTP::cookie encrypt $mycookies $::cookie_passphrase]
log local0. "Encrypted value is $encrypted_value"
HTTP::cookie remove $mycookies
HTTP::cookie insert name $mycookies value $encrypted_value
log local0. "Cookie $mycookies : Send value is [HTTP::cookie value $mycookies]: "
}
}
}
when HTTP_REQUEST {
set myValues [HTTP::cookie names]
foreach mycookies $myValues {
if {$mycookies ne "ns_cookietest"}{
log local0. "Cookie $mycookies : Received value is [HTTP::cookie value $mycookies]: "
set decrypted_value [HTTP::cookie decrypt $mycookies $::cookie_passphrase]
HTTP::cookie remove $mycookies
HTTP::cookie insert name $mycookies value $decrypted_value
log local0. "Cookie $mycookies : Decrypted value send to backend is [HTTP::cookie value $mycookies]: "
}
}
}
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects