f5
225 TopicsPower of tmsh commands using Ansible
Why is data important Having accurate data has become an integral part of decision making. The data could be for making simple decisions like purchasing the newest electronic gadget in the market or for complex decisions on what hardware and/or software platform works best for your highly demanding application which would provide the best user experience for your customer. In either case research and data collection becomes essential. Using what kind of F5 hardware and/or software in your environment follows the same principals where your IT team would require data to make the right decision. Data could vary from CPU, Throughput and/or Memory utilization etc. of your F5 gear. It could also be data just for a period of a day, a month or a year depending the application usage patterns. Ansible to the rescue Your environment could have 10's or maybe 100 or even 1000's of F5 BIG-IP's in your environment, manually logging into each one to gather data would be a highly inefficient method. One way which is a great and simple way could be to use Ansible as an automation framework to perform this task, relieving you to perform your other job functions. Let's take a look at some of the components needed to use Ansible. An inventory file in Ansible defines the hosts against which your playbook is going to run. Below is an example of a file defining F5 hosts which can be expanded to represent your 10'/100's or 1000's of BIG-IP's. Inventory file: 'inventory.yml' [f5] ltm01 password=admin server=10.192.73.xxx user=admin validate_certs=no server_port=443 ltm02 password=admin server=10.192.73.xxx user=admin validate_certs=no server_port=443 ltm03 password=admin server=10.192.73.xxx user=admin validate_certs=no server_port=443 ltm04 password=admin server=10.192.73.xxx user=admin validate_certs=no server_port=443 ltm05 password=admin server=10.192.73.xxx user=admin validate_certs=no server_port=443 A playbook defines the tasks that are going to be executed. In this playbook we are using the bigip_command module which can take as input any BIG-IP tmsh command and provide the output. Here we are going to use the tmsh commands to gather performance data from the BIG-IP's. The output from each of the BIG-IP's is going to be stored in a file that can be referenced after the playbook finished execution. Playbook: 'performance-data/yml' --- - name: Create empty file hosts: localhost gather_facts: false tasks: - name: Creating an empty file file: path: "./{{filename}}" state: touch - name: Gather stats using tmsh command hosts: f5 connection: local gather_facts: false serial: 1 tasks: - name: Gather performance stats bigip_command: provider: server: "{{server}}" user: "{{user}}" password: "{{password}}" server_port: "{{server_port}}" validate_certs: "{{validate_certs}}" commands: - show sys performance throughput historical - show sys performance system historical register: result - lineinfile: line: "\n###BIG-IP hostname => {{ inventory_hostname }} ###\n" insertafter: EOF dest: "./{{filename}}" - lineinfile: line: "{{ result.stdout_lines }}" insertafter: EOF dest: "./{{filename}}" - name: Format the file shell: cmd: sed 's/,/\n/g' ./{{filename}} > ./{{filename}}_formatted - pause: seconds: 10 - name: Delete file hosts: localhost gather_facts: false tasks: - name: Delete extra file created (delete file) file: path: ./{{filename}} state: absent Execution: The execution command will take as input the playbook name, the inventory file as well as the filename where the output will be stored. (There are different ways of defining and passing parameters to a playbook, below is one such example) ansible-playbook performance_data.yml -i inventory.yml --extra-vars "filename=perf_output" Snippet of expected output: ###BIG-IP hostname => ltm01 ### [['Sys::Performance Throughput' '-----------------------------------------------------------------------' 'Throughput(bits)(bits/sec)Current3 hrs24 hrs7 days30 days' '-----------------------------------------------------------------------' 'Service223.8K258.8K279.2K297.4K112.5K' 'In212.1K209.7K210.5K243.6K89.5K' 'Out21.4K21.0K21.1K57.4K30.1K' '' '-----------------------------------------------------------------------' 'SSL TransactionsCurrent3 hrs24 hrs7 days30 days' '-----------------------------------------------------------------------' 'SSL TPS00000' '' '-----------------------------------------------------------------------' 'Throughput(packets)(pkts/sec)Current3 hrs24 hrs7 days30 days' '-----------------------------------------------------------------------' 'Service7982836362' 'In4140403432' 'Out4140403234'] ['Sys::Performance System' '------------------------------------------------------------' 'System CPU Usage(%)Current3 hrs24 hrs7 days30 days' '------------------------------------------------------------' 'Utilization1718181817' '' '------------------------------------------------------------' 'Memory Used(%)Current3 hrs24 hrs7 days30 days' '------------------------------------------------------------' 'TMM Memory Used1010101010' 'Other Memory Used5555545453' 'Swap Used00000']] ###BIG-IP hostname => ltm02 ### [['Sys::Performance Throughput' '-----------------------------------------------------------------------' 'Throughput(bits)(bits/sec)Current3 hrs24 hrs7 days30 days' '-----------------------------------------------------------------------' 'Service202.3K258.7K279.2K297.4K112.5K' 'In190.8K209.7K210.5K243.6K89.5K' 'Out19.6K21.0K21.1K57.4K30.1K' '' '-----------------------------------------------------------------------' 'SSL TransactionsCurrent3 hrs24 hrs7 days30 days' '-----------------------------------------------------------------------' 'SSL TPS00000' '' '-----------------------------------------------------------------------' 'Throughput(packets)(pkts/sec)Current3 hrs24 hrs7 days30 days' '-----------------------------------------------------------------------' 'Service7782836362' 'In3940403432' 'Out3740403234'] ['Sys::Performance System' '------------------------------------------------------------' 'System CPU Usage(%)Current3 hrs24 hrs7 days30 days' '------------------------------------------------------------' 'Utilization2118181817' '' '------------------------------------------------------------' 'Memory Used(%)Current3 hrs24 hrs7 days30 days' '------------------------------------------------------------' 'TMM Memory Used1010101010' 'Other Memory Used5555545453' 'Swap Used00000']] The data obtained is historical data over a period of time. Sometimes it is also important to gather the peak usage of throughout/memory/cpu over time and not the average. Stay tuned as we will discuss on how to obtain that information in a upcoming article. Conclusion Use the output of the data to learn the traffic patterns and propose the most appropriate BIG-IP hardware/software in your environment. This could be data collected directly in your production environment or a staging environment, which would help you make the decision on what purchasing strategy gives you the most value from your BIG-IP's. For reference: https://www.f5.com/pdf/products/big-ip-local-traffic-manager-ds.pdf The above is one example of how you can get started with using Ansible and tmsh commands. Using this method you can potentially achieve close to 100% automation on the BIG-IP.11KViews4likes3CommentsHow to activate F5 VE License Key?
I have two F5 VE VM running BIG-IP 11.3.0 Build 39.0 VE Trial 11.3.0-HF1 (based on BIGIP 11.3.0HF6. I decided to buy license now and I bought two license key from cdw in $95. Now how do i put new registration key in F5? In GUI i can't see anywhere i can put new key? In License tab i can se re-activate but it is not allowing to put new Key. I check this document https://support.f5.com/kb/en-us/solutions/public/2000/500/sol2595.html But it is very confusing, what i need to do in order to activate key?Solved2.4KViews0likes24CommentsNeed help with URL re-write without a redirect
I have virtual server on F5 with an iRule and want to add a condition for a new re-write. I have to re-write complete URL without redirecting or changing the URL in client's browser. Tested the below but client browsers keeps getting a reset. Below is my existing iRule and the syntax i have tried for re-write. Also attached few logs which show that traffic is matching the condition and re-writing the URL but fails. Browser URL: "abc.domain.com/uri/path" Backend URL: "abc4.domain4.com/file.html" when HTTP_REQUEST { set doStream 0 switch [HTTP::host] { "abc.domain.com" { if {[HTTP::path] contains "/abc/abc" && [HTTP::query] contains "location="} { HTTP::respond 301 "Location" "https://[HTTP::host]/abc/[string tolower [findstr [HTTP::query] "location=" 9]]" pool xyz_pool } elseif {[string tolower [HTTP::host]] starts_with "abc.domain.com" && [HTTP::path] eq "/uri/path"} { HTTP::header replace Host "abc4.domain4.com" HTTP::uri "/file.html" set doStream 4 log local0. "[HTTP::host][HTTP::uri] Changed rewrite" pool test-pool } elseif {[class match [HTTP::path] equals "url_redirect_list"]} { set newURL [class match -value -- [HTTP::uri] equals "url_redirect_list"] log local0. "NEW Redirect URI is [HTTP::uri]" HTTP::respond 301 "Location" $newURL } elseif {[class match [HTTP::path] equals "url_explicit_list"]} { log local0. "[HTTP::path]: Explicit URL path goes to [LB::server] with cookie value [HTTP::cookie value "cookie"]" HTTP::header replace Host "abc1.domain.com" set doStream 1 log local0. "[IP::client_addr]:[TCP::client_port]: [LB::server] Request with persistence cookie [HTTP::cookie value "cookie"] to [HTTP::uri]" pool explicit_pool } elseif {[class match [HTTP::path] starts_with "url_wildcard_list"]} { log local0. "[HTTP::path]: Wildcard URL path goes to [LB::server]" HTTP::header replace Host "abc1.domain.com" set doStream 1 #log local0. "[HTTP::path]: Wildcard URL path goes to [LB::server]" } elseif { [string tolower [HTTP::uri]] ne "/autodiscover" } { log local0. "[IP::client_addr]:[TCP::client_port]: [LB::server] Request with persistence cookie [HTTP::cookie value "cookie"] to [HTTP::uri]" pool backend_pool persist cookie insert "cookie" } else { drop } } } } when HTTP_RESPONSE { switch $doStream { 0 { return } 1 { STREAM::expression {@http://abc1.domain.com@https://abc.domain.com@} STREAM::enable } 4 { STREAM::expression {@https://abc4.domain4.com/file.html@https://abc.domain.com/uri/path@} STREAM::enable } } } /var/log/ltm.1:Apr 14 13:44:55 info tmm1[17567]: Rule /Common/POOL_SELECTION_IRULE <HTTP_REQUEST>: abc4.domain4.com/file.html Changed rewrite /var/log/ltm.1:Apr 14 13:44:55 info tmm[17567]: Rule /Common/POOL_SELECTION_IRULE <HTTP_REQUEST>: abc4.domain4.com/file.html Changed rewrite /var/log/ltm.1:Apr 14 13:45:04 info tmm[17567]: Rule /Common/POOL_SELECTION_IRULE <HTTP_REQUEST>: abc4.domain4.com/file.html Changed rewrite /var/log/ltm.1:Apr 14 13:45:05 info tmm1[17567]: Rule /Common/POOL_SELECTION_IRULE <HTTP_REQUEST>: abc4.domain4.com/file.html Changed rewrite /var/log/ltm.1:Apr 14 13:45:05 info tmm[17567]: Rule /Common/POOL_SELECTION_IRULE <HTTP_REQUEST>: abc4.domain4.com/file.html Changed rewrite /var/log/ltm.1:Apr 14 13:50:05 info tmm[17567]: Rule /Common/POOL_SELECTION_IRULE <HTTP_REQUEST>: abc4.domain4.com/file.html Changed rewrite /var/log/ltm.1:Apr 14 14:00:06 info tmm[17567]: Rule /Common/POOL_SELECTION_IRULE <HTTP_REQUEST>: abc4.domain4.com/file.html Changed rewrite /var/log/ltm.1:Apr 14 15:42:37 info tmm1[17567]: Rule /Common/POOL_SELECTION_IRULE <HTTP_REQUEST>: abc4.domain4.com/file.html Changed rewrite Any help is appreciated. ThanksSolved2.4KViews0likes6CommentsWhere to buy F5 VE lab license?
I am looking to buy F5 VE Lab license but i didn't find any link to buy online? All i see is trial version. F5 doesn't sale key online on their website? Do i need to contact F5 support to buy license? I saw third party website selling Key but i don't trust on them..2.1KViews0likes13CommentsWAFaaS with SSL Orchestrator
Introduction Note: This article applies to SSL Orchestrator versions prior to 11.0. If using version 11.0 refer to the articleHERE This use case allows you to insert F5 WAF functionality as a Service in the SSL Orchestrator inspection zone. WAFaaS is the ability to insert ASM profiles into the SSL Orchestrator Service Chain for Inbound Topologies.This configuration is specific to a WAF policy running on the SSL Orchestrator device.WAF and SSL Orchestrator consume significant CPU cycles so care should be given when deploying both together.It is also possible to deploy WAF as a service on a separate BIG-IP device, in which case you’d simply configure an inline transparent proxy service.The ability to insert F5’s WAF into the Service Chain presents a significant customer benefit. This guide assumes you already have WAF/ASM profile(s) configured, licensed and provisioned on BIG-IP and wish to add this functionality to an Inbound Topology.In order to run WAF and SSL Orchestrator on the same device you will need an LTM license with SSL Orchestrator as an add-on option.You cannot add a WAF license to an SSL Orchestrator stand-alone license. SSL Orchestrator does not directly support inserting F5 WAF policies into the Service Chain.However, the F5 platform is flexible enough to handle many custom use cases.In this case, the ICAP service configuration exposes a framework that is useful for any number of specialized patterns, including adding a WAF policy to an SSLO service chain.We will configure an ICAP Service and attach the WAF policy to it. Steps: Create ICAP Service Disable Strictness on the Service Disable TCP monitor for the ICAP Pool ICAP Adapt profiles removed from the Virtual Server Application Security Policy enabled and a Policy assigned under Security Step #1: Create ICAP Service Note: These instructions assume an SSL Orchestrator Topology and Service Chain are already deployed and working properly.These instructions simply add WAFaaS to the existing Service Chain.It is entirely possible to create the WAFaaS during the initial Topology creation, in which case you would create the service during the workflow, then make the necessary changes after the topology has been created. From the SSL Orchestrator Guided Configuration click Services then Add Scroll to the bottom, select Generic ICAP Service and click Add Give it a name, WAFaaS in this example For ICAP Devices click Add on the right Enter an IP Address, 198.19.97.1 in this example and click Done. Note:the IP address you use does not have to be the one above.It’s just a local, non-routable address used as a placeholder in the service definition.This IP address will not be used. IP addresses 198.19.97.0 to 198.19.97.255 are owned by network benchmark tests and located in private networks. Scroll to the bottom and click Save & Next. The next screen is the Services Chain List.Click the name of the Service Chain you wish to add WAF functionality to, ssloSC_ServiceChain in this example. Note: The order of the Services in the Selected column is the order in which SSL Orchestrator will pass decrypted data to the device.This can be an important consideration if you want some devices to see, or not see, the actions taken by the WAF Service. Select the WAFaaS Service and click the right arrow to move it to Selected.Click Save. Click Save & Next Click Deploy You should receive a Success message Step #2: Disable Strictness on the Service From the SSL Orchestrator Configuration screen select Services.Click the padlock to Unprotect Configuration. Note:Disabling Strictness on the ICAP Service is needed to modify it and attach the WAFaaS policy.Strictness must remain disabled on this service and disabling strictness on the service has no effect on any other part of the SSL Orchestrator configuration. Click OK to Unprotect the Configuration Step #3: Disable tcp monitor for the ICAP Pool From Local Traffic select Pools > Pool List Select the WAFaaS Pool Under Active Health Monitors select tcp and click >> to move it to Available.This removes the Pool’s Monitor because otherwise it would be marked as down or unavailable. Click Update Note:The Health Monitor needs to be removed because there is no actual ICAP service to monitor. Step #4: ICAP Adapt profiles removed from the Virtual Server From Local Traffic select Virtual Servers > Virtual Server List Locate the WAFaaS ICAP service that ends in “-t-4”virtual server and select it Set the Request Adapt Profile and Response Adapt Profile to None to disable the default ICAP Profiles Click Update Step #5: Application Security Policy enabled and a Policy assigned under Security For the WAFaaS-t-4 Virtual Server click the Security tab Set Application Security Policy to Enabled Select the Security Policy you wish to use.Click Update when done Note: In specific versions of SSL Orchestrator there is one extra configuration item that needs to be modified. This is NOT required in other versions. If this change is made, when performing an upgrade it is not necessarily required to back out this change. Required versions: SSLO version 5.9.15 available on TMOS 14.1.4 SSLO versions 6.0-6.5 available on TMOX 15.0.x Navigate to “Local Traffic››Profiles : Other : Service” Select the Service profile named “ssloS_WAFaaS-service” Change the “Type” from “ICAP” to “F5 Module” Conclusion The configuration is now complete.Using the WAFaaS this way is functionally the same as using it by itself.There are no known limitations to this configuration.2KViews5likes9CommentsF5 loadbalancer and session timeout in ASP application
Hello, I have a problem with F5 loadbalancer and session timeout in ASP application. We have F5 in out company for few days Since then, there is a problem with session timeout. ASP app has 30min timeout set but keeps logging of already after few minutes. This phenomenon didn't occur with Windows loadbalancer.2KViews0likes15CommentsNeed iRule to block the traffic for specific URL
Hello Can somebody help on this please? I have LTM appliance &Virtual server 'https://www100.test.com' hosted. The requirement I have is to block all the traffic destinated to one of the application 'https://www100.test.com/ce' - is this something achievable by iRule If so do you have any idea on the iRule? Would appreciate somebody can help. Have seen this - https://support.f5.com/csp/article/K74012450 but that is looking too complex to me. Thanks1.9KViews0likes6CommentsRemoving Cookies from Client: Nothing seems to work....
I cannot get any of the cookie commands to remove cookies from the client. I want to have the F5 tell the client to remove cookies if they hit a certain URI. Here is what I have tried so far. None of it worked. I am not seeing any cookie response headers coming back First try.... when HTTP_REQUEST { set cookies [HTTP::cookie names] some other stuff blah blah blah if {[HTTP::path] matches "/delete-my-cookies"} { set deletecookies 1 return } } when HTTP_RESPONSE { if { deletecookies == 1 } { foreach cookie $cookies { HTTP::cookie remove $cookie } HTTP::respond 200 content "OK!" } } Second try.... when HTTP_REQUEST { set cookies [HTTP::cookie names] some other stuff blah blah blah if {[HTTP::path] matches "/delete-my-cookies"} { set deletecookies 1 return } } when HTTP_RESPONSE { HTTP::cookie remove "cookie1" HTTP::cookie remove "cookie2" etc, etc HTTP::respond 200 content "OK!" } Third Try.... when HTTP_REQUEST { set cookies [HTTP::cookie names] some other stuff blah blah blah if {[HTTP::path] matches "/delete-my-cookies"} { set deletecookies 1 return } } when HTTP_RESPONSE { HTTP::cookie insert name "cookie1" value "test_value" domain ".slce006.com" HTTP::cookie expires "cookie1" 1 absolute HTTP::cookie insert name "cookie2" value "test_value" domain ".slce006.com" HTTP::cookie expires "cookie1" 2 absolute HTTP::respond 200 content "OK!" } Any ideas? Basically I want the client to scrub all session cookies it has when it hits this URL so the client browser expires all cookies. On BigIP Version 11.61.9KViews0likes1Comment