Forum Discussion

gimlie_382872's avatar
gimlie_382872
Icon for Nimbostratus rankNimbostratus
Apr 04, 2019

Can we read DataGroup form external file via iRule

Hi expert,

I'have internal server and provide url list. i would like to use ltm block access to url if match in datagroup. I create cronjob and shell script to download url form internal server. But i'm not sure how can i create iRule to read this url list.

So please recomend iRule parameter to me. Thank you

4 Replies

  • If you format the URL list correctly, you can import it into an external datagroup.

    e.g.

    "name1" := "/path1",
    "name2" := "/path2",
    "name3" := "/path3",
    

    Once setup, you can schedule a transfer of this list to F5.

    Once on the box, you can schedule the following command using iCall or Cron to update the datagroup

    modify sys file data-group [my-data-group-name] source-path file:/var/tmp/url.list

  • Hi,

    So first of create your DG "dg-uri-restriction":

    • type string
    • string: /uri
    • value: not needed in your case.

    Then create your irule, it's simple:

     when HTTP_REQUEST {
     set userip [HTTP::uri]
     if { [class match $userip equals dg-uri-restriction] } {
        HTTP::respond 403 content "Forbidden" "Content-Type" "text/html" "Connection" "Close"
        return
         you can also use reject...
     }
     }
    
  • Hi all i try by your recomend is work, but when i try to add crontab. BIG-IP don't run schedule task.