F5 Sites
  • F5.com
  • LearnF5
  • NGINX
  • MyF5
  • Partner Central
Contact
  • Under Attack?
  • F5 Support
  • DevCentral Support
  • F5 Sales
  • NGINX Sales
  • F5 Professional Services
Skip to contentBrand Logo
Forums
CrowdSRC
Articles
Groups
EventsSuggestionsHow Do I...?
RegisterSign In
  1. DevCentral
  2. CrowdSRC
  3. CodeShare

Suppress MFA for a period of time

Problem this snippet solves: This code snippet can be used if you want to suppress MFA for a period of time. This solution uses an encrypted persistent cookie, that will be set at a successful MFA l...
Published Jul 16, 2019
Version 1.0
application delivery
BIG-IP Access Policy Manager (APM)
iRules
security
Niels_van_Sluis's avatar
Niels_van_Sluis
Icon for MVP rankMVP
Joined May 16, 2019
View Profile
Niels_van_Sluis's avatar
Niels_van_Sluis
Icon for MVP rankMVP
Joined May 16, 2019
View Profile
Slayer001's avatar
Slayer001
Icon for Cirrus rankCirrus
Jul 26, 2019

Got it to work, thanks for your help Niels.

Als added a timestamp in the cookie to avoid tampering with the expiration time of the cookie

This is what I have for the checkcookie event now:

when ACCESS_POLICY_AGENT_EVENT {
    # check if hash from cookie matches current session hash (username and user-agent)
    switch [ACCESS::policy agent_id] {
        "checkcookie" {
            set username [ACCESS::session data get session.logon.last.username]
            set UA [ACCESS::session data get session.user.agent]
            set hash [b64encode [md5 "c:$username:$UA"]]
            set currenttime [clock seconds]
            set starttime [string range [ACCESS::session data get session.custom.suppressmfa.hash] end-9 end]
            if {$starttime equals ""}{
            }
            else {
                set start_int $starttime
                set diff_int $static::suppress_mfa(seconds)
                set endtime [expr {$start_int + $diff_int}]
                #log local0. "endtime: $endtime"
                if { $currenttime <= $endtime } {
                    if { $hash equals [string range [ACCESS::session data get session.custom.suppressmfa.hash] 0 end-10] } {
                        ACCESS::session data set session.custom.suppressmfa.skip 1
                    }
                }
            }
        }
    }
}

ABOUT DEVCENTRAL

DevCentral NewsTechnical ForumTechnical ArticlesTechnical CrowdSRCCommunity GuidelinesDevCentral EULAGet a Developer Lab LicenseBecome a DevCentral MVP

RESOURCES

Product DocumentationWhite PapersGlossaryCustomer StoriesWebinarsFree Online CoursesF5 CertificationLearnF5 Training

SUPPORT

Manage SubscriptionsProfessional ServicesProfessional ServicesCreate a Service RequestSoftware DownloadsSupport Portal

PARTNERS

Find a Reseller PartnerTechnology AlliancesBecome an F5 PartnerLogin to Partner Central

F5 logo©2024 F5, Inc. All rights reserved.
TrademarksPoliciesPrivacyCalifornia PrivacyDo Not Sell My Personal Information