Forum Discussion
Yozzer
Oct 14, 2011Nimbostratus
Username and IP restricted login
Hi
I want to restrict access to a website login page so that it can only be accessed by certain usernames (e.g User1-Ops, User2-Ops, etc) and only if they access from a list of allowed IP a...
Yozzer
Oct 15, 2011Nimbostratus
would this work?
when HTTP_REQUEST {
if {([HTTP::method] eq "POST") && ([HTTP::uri] eq "/login.aspx") && (![matchclass [IP::client_addr] equals $::trustedAddresses])} {
HTTP::collect [HTTP::header "Content-Length"]
}
}
when HTTP_REQUEST_DATA {
set sema "no"
switch -glob [URI::decode [URI::query "?[HTTP::payload]" username]] {
"*-Ops*" {
set sema "yes"
}
}
if { $sema == "yes"} {
HTTP::respond 200 content {
HTML page settings to show the following text:
You can’t login from your current location.
}
}
}
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