Skip to content

Rule Lists: Enhancing Control and Flexibility

Rule lists in Peakhour provide a powerful way to manage and apply rules across various configurations. They allow you to create reusable sets of IP addresses, text strings, or integer values that can be referenced in your firewall rules, rate limiting configurations, and other settings.

Types of Rule Lists#

  1. IP Lists
  2. Text Lists
  3. Integer Lists

IP Lists#

IP lists contain a collection of IP addresses or CIDR ranges. They are useful for creating allow lists, block lists, or any configuration where you need to apply rules based on IP addresses.

Example use case: Create a trusted IP list for administrative access

10.0.0.0/8
172.16.0.0/12
192.168.0.0/16
203.0.113.42

You can reference this list in a firewall rule:

ip.src in $trusted_ips

Text Lists#

Text lists contain strings that can be used for matching against various text-based fields like user agents, TLS fingerprints, or HTTP headers.

Example use case: Create a list of allowed user agents for API access

MyApp/1.0
PartnerBot/2.1
LegacyClient/0.9

You can use this list in a firewall rule:

http.user_agent in $allowed_user_agents

Integer Lists#

Integer lists contain numeric values, which can be useful for matching against ASNs (Autonomous System Numbers) or other numeric identifiers.

Example use case: Create a list of trusted ASNs

13335
16509
14618

You can use this list in a rate limiting configuration:

ip.geoip.asnum in $trusted_asns

Creating and Managing Rule Lists#

To create a rule list:

  1. Navigate to the Rule Lists section in your Peakhour dashboard
  2. Click "Create New List"
  3. Choose the list type (IP, Text, or Integer)
  4. Give your list a name
  5. Add entries to your list
  6. Save the list

You can edit or delete existing lists as needed.

Using Rule Lists in Configurations#

Once you've created a rule list, you can reference it in various configurations using the $list_name syntax. This allows you to create more maintainable and flexible rules.

Example: Rate limiting configuration using a trusted ASN list

rate_limit.add_zone:
  zone: api_requests
  key:
    - ip
  action:
    type: block
    status_code: 429
condition: not (ip.geoip.asnum in $trusted_asns)

Best Practices#

  1. Use descriptive names for your lists to make them easily identifiable
  2. Regularly review and update your lists to ensure they remain current
  3. Use comments within your lists to document the purpose of specific entries
  4. Consider using version control for your lists if you need to track changes over time

Rule lists provide a flexible and powerful way to manage complex configurations in Peakhour. By leveraging these lists, you can create more maintainable, efficient, and scalable rules across your CDN configuration. Title: Rule Lists: Enhancing Control and Flexibility

Rule lists in Peakhour provide a powerful way to manage and apply rules across various configurations. They allow you to create reusable sets of IP addresses, text strings, or integer values that can be referenced in your firewall rules, rate limiting configurations, and other settings.

Types of Rule Lists#

  1. IP Lists
  2. Text Lists
  3. Integer Lists

IP Lists#

IP lists contain a collection of IP addresses or CIDR ranges. They are useful for creating allow lists, block lists, or any configuration where you need to apply rules based on IP addresses.

Example use case: Create a trusted IP list for administrative access

10.0.0.0/8
172.16.0.0/12
192.168.0.0/16
203.0.113.42

You can reference this list in a firewall rule:

ip.src in $trusted_ips

Text Lists#

Text lists contain strings that can be used for matching against various text-based fields like user agents, TLS fingerprints, or HTTP headers.

Example use case: Create a list of allowed user agents for API access

MyApp/1.0
PartnerBot/2.1
LegacyClient/0.9

You can use this list in a firewall rule:

http.user_agent in $allowed_user_agents

Integer Lists#

Integer lists contain numeric values, which can be useful for matching against ASNs (Autonomous System Numbers) or other numeric identifiers.

Example use case: Create a list of trusted ASNs

13335
16509
14618

You can use this list in a rate limiting configuration:

ip.geoip.asnum in $trusted_asns

Creating and Managing Rule Lists#

To create a rule list:

  1. Navigate to the Rule Lists section in your Peakhour dashboard
  2. Click "Create New List"
  3. Choose the list type (IP, Text, or Integer)
  4. Give your list a name
  5. Add entries to your list
  6. Save the list

You can edit or delete existing lists as needed.

Using Rule Lists in Configurations#

Once you've created a rule list, you can reference it in various configurations using the $list_name syntax. This allows you to create more maintainable and flexible rules.

Example: Rate limiting configuration using a trusted ASN list

rate_limit.add_zone:
  zone: api_requests
  key:
    - ip
  action:
    type: block
    status_code: 429
condition: not (ip.geoip.asnum in $trusted_asns)

Best Practices#

  1. Use descriptive names for your lists to make them easily identifiable
  2. Regularly review and update your lists to ensure they remain current
  3. Use comments within your lists to document the purpose of specific entries
  4. Consider using version control for your lists if you need to track changes over time

Rule lists provide a flexible and powerful way to manage complex configurations in Peakhour. By leveraging these lists, you can create more maintainable, efficient, and scalable rules across your CDN configuration.