Forum Discussion
irule to select SSL client cert based on HTTP header
Hello ,
Today i get those errors:
Wed Jun 14 15:23:55 CEST 2017 root 0-0 sshd(pam_audit): User=root tty=ssh host=61.177.172.30 failed to login after 1 attempts (start="Wed Jun 14 15:23:53 2017" end="Wed Jun 14 15:23:55 2017").:
Wed Jun 14 15:23:52 CEST 2017 root 0-0 sshd(pam_audit): User=root tty=ssh host=61.177.172.30 failed to login after 1 attempts (start="Wed Jun 14 15:23:50 2017" end="Wed Jun 14 15:23:52 2017").:
Wed Jun 14 15:23:49 CEST 2017 root 0-0 sshd(pam_audit): User=root tty=ssh host=61.177.172.30 failed to login after 1 attempts (start="Wed Jun 14 15:23:47 2017" end="Wed Jun 14 15:23:49 2017").:
Wed Jun 14 15:23:46 CEST 2017 root 0-0 sshd(pam_audit): User=root tty=ssh host=61.177.172.30 failed to login after 1 attempts (start="Wed Jun 14 15:23:43 2017" end="Wed Jun 14 15:23:46 2017").:
Wed Jun 14 15:23:40 CEST 2017 root 0-0 sshd(pam_audit): User=root tty=ssh host=61.177.172.30 failed to login after 1 attempts (start="Wed Jun 14 15:23:38 2017" end="Wed Jun 14 15:23:40 2017").:
Wed Jun 14 15:23:28 CEST 2017 root 0-0 sshd(pam_audit): User=root tty=ssh host=61.177.172.30 failed to login after 1 attempts (start="Wed Jun 14 15:23:26 2017" end="Wed Jun 14 15:23:28 2017").:
Wed Jun 14 15:23:25 CEST 2017 root 0-0 sshd(pam_audit): User=root tty=ssh host=61.177.172.30 failed to login after 1 attempts (start="Wed Jun 14 15:23:22 2017" end="Wed Jun 14 15:23:25 2017").:
Wed Jun 14 15:23:22 CEST 2017 root 0-0 sshd(pam_audit): User=root tty=ssh host=61.177.172.30 failed to login after 1 attempts (start="Wed Jun 14 15:23:19 2017" end="Wed Jun 14 15:23:22 2017").:
Wed Jun 14 15:23:16 CEST 2017 root 0-0 sshd(pam_audit): User=root tty=ssh host=61.177.172.30 failed to login after 1 attempts (start="Wed Jun 14 15:23:14 2017" end="Wed Jun 14 15:23:16 2017").:
Wed Jun 14 15:23:10 CEST 2017 root 0-0 sshd(pam_audit): User=root tty=ssh host=61.177.172.30 failed to login after 1 attempts (start="Wed Jun 14 15:23:07 2017" end="Wed Jun 14 15:23:10 2017").:
Thanks you for your support. Best regards Notorious
- David_Scott_104Mar 31, 2017Historic F5 Account
substr will get at part of a string, the first argument is the string to look at, the second argument specifies how many characters to skip over (0 meaning don't skip any) and the last argument is the terminator or where to stop the substring.
For an example of the parameters, say you have the following url
So the HTTP::uri would be "/downloads?v13"
If I put this in an iRule:
log local0. "[substr [HTTP::uri] 0 "?"] "
Will return everything up to the ? so "/downloads" would be returned.
So in /var/log/ltm you would see something similar to this:
Mar 31 09:59:34 ltm2 info tmm1[11931]: Rule /Common/test : /downloads
Hope that helps you a bit,
Dave
looking at your rule if{[string length [substr {HTTP::uri] 0 "?"]]>0} this rule is always going to be true since the first character on a HTTP::uri is always "/" therefore the string lengh will always be greater than 0 may be you want to do if{[string length [substr {HTTP::uri] 1 "?"]]>0} this will start the string length after the first character of HTTP::uri which is always "/"
set VAR1 "/downloads/hector/file1?V12" set VAR2 [substr [VAR1] 0 "?"]
set VAR3 "/downloads/hector/fil?v13?hello" set VAR4 [substr [VAR1] 0 "?"]
set VAR5 [[substr [VAR1] 5 "?"]
Hi Charles,
as already outlined by David, a if { [string length [substr [HTTP::uri] 0 "?"]] > 0 } will make no sense at all, since the used
command will extract portion from the beginning of the[substr]
until the first ocourence of a question mark. This will be always at least a[HTTP::uri]
char, which would then resolve to a/
value of at least[string length]
.1
To check if a HTTP query string (the portion after the first
character) is present you may use one of the iRule snippets below...?
Example1: Using a rather simple
syntax.if { X contain Y } then { }
if { [HTTP::uri] contains "?" } then { A query string is present } else { A query string is NOT present }
Example2: Using F5s
command to extract the URI query string.[HTTP::query]
if { [HTTP::query] ne "" } then { A query string is present } else { A query string is NOT present }
Note: The difference of the two syntaxes is, that the first example will also identify empty query strings (e.g.
) and the seconds example will only identify query strings with valid parameters (e.g./somepath?
)./somepath?param=1
Cheers, Kai
Recent Discussions
Related Content
* 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