To implement two-factor authentication with APM. After creating an access policy, data group and all the likes, I find that the APM is expecting a different code than the authenticator shows. I found out by printing the variables that I enter as a code, and the variables that the APM expects as a code, into the logs. The whole process itself works. The iRule is triggered, the username is found in the datagroup, and the calculations are made. It’s just expecting a different code. For example, my code will say “781023”, and the BIGIP will be expecting code “826015”. I tested this with multiple different accounts and the same results all around. I’m wondering if Google just changed its algorithm a few years ago and the article became outdated, or if something in recent F5 versions has changed that changes the calculation algorithm. Has anyone done a recent implementation with this iRule without any issues? I quadruple-checked everything and added log entries to every part of the iRule. I know it’s being triggered correctly, but it’s just coming up with a different expected code than Google is.
In that article, there are 2 comments by people with the same issue on 11.5, so at least I’m not alone
We have the same issue since we upgraded to 11.6 from 11.3. Each time we load the config we see: “/Common/Google_SoftToken_Generator_V3:33: warning: [use curly braces to avoid double substitution]” Maybe that’s the reason the code calculation is different. We couldn’t figure it out how to fix the code. So we just move Google Authenticator to another F5 box which is still on 11.3. I hope someone can look into the GA code and make it work for 11.6 otherwise we have to stop using it.
Nope, no more errors using the curly braces. But the Google code is still wrong. As I don’t know the logic of the calculations, so not sure if the curly braces are correct are not.
I know this thread is old, but I just went through the same process trying to get the otp iRule working as normal without warnings.
The problematic expr statements contain string concatenation used to generate hex values for bitwise operations. It wont work as expected if you simply wrap that in curly brackets, so I just break it up a little. For example this becomes this…
set o [expr 0x$k ^ 0x5C ]
set i [expr 0x$k ^ 0x36 ]
set kh 0x$k
set o [expr {$kh ^ 0x5C} ]
set i [expr {$kh ^ 0x36} ]