Deny requests from one autonomous system
Deny every client of one network by its Autonomous System Number, with an asn network list and one firewall rule, in Azion Console, the CLI, or the API.
You can deny the requests of one autonomous system from Azion Console, the Azion CLI, or the API. An autonomous system is a network, and its Autonomous System Number (ASN) identifies it. An asn network list holds that number, and one firewall rule denies each client whose address belongs to the network. Use this rule when unwanted traffic comes from across one network, from more addresses than you can list. To deny by country instead, refer to Deny requests from a list of countries.
Prerequisites
Console
- A workload bound to a firewall through its deployment. That firewall receives the rule you create in this guide.
- Network Shield turned on for that firewall. Network Shield is on by default when a firewall is created.
- Access to Azion Console.
Create the ASN list
An asn list holds one item per network: its Autonomous System Number, written as digits alone. Each item covers every address of its network, legitimate clients included. The API refuses an item that carries the AS prefix with 22011 Invalid ASN Number, so send 64496, not AS64496. An asn item also takes no annotation, which means no due date: a network stays in the list until a write of the list’s items leaves it out. Its type stays asn for the life of the list. For the fields of a list and the format of each type, refer to Network list fields and List types.
Console
To create the list in Azion Console:
Access Azion Console > Edge Libraries > Network Lists.
In the General section, enter a Name. For example: Blocked networks.
In the Network List Settings section, keep ASN as the type. The form opens with this type already chosen.
In the List field, enter 64496. To deny more networks, enter one ASN per line.
Select Save.
Azion Console confirms with the message Your network list has been created. The list appears in Network Lists, and its List Type column reads ASN.
Create the rule that denies the autonomous system
The rule compares the client address of each request with the asn list through the Network criterion. The criterion is true when that address belongs to a network in the list. The Deny (403 Forbidden) behavior then refuses the request. A rule holds the ID of its list, never a copy of the numbers. When you add an ASN to the list or remove one, the rule denies the updated set with no edit. For the criteria and behaviors that a rule can combine, refer to Rules Engine for Firewall.
Console
To create the rule in Azion Console:
Access Azion Console > Secure > Firewalls. Select the firewall in the list.
The Create Rule drawer opens.
In the General section, enter a Name. For example: Deny one autonomous system.
In the Criteria section, select Network as the variable and matches as the operator.
The variable reads Network - required Network Shield while Network Shield is off for this firewall. In that case, turn on Network Shield in Main Settings > Modules and select Save. The variable is selectable after the save.
In the Select a Network dropdown, select Blocked networks, the name you gave the list.
In the Behaviors section, select the Deny (403 Forbidden) behavior.
Select Save.
Azion Console confirms with the message Rule successfully created. The rule appears in the Rules Engine tab, with Active in its Status column.
Confirm that the rule denies the autonomous system
The rule in this guide carries no criterion besides Network. It therefore denies the clients of a listed network on every path of the workload. The application never receives their requests. Expect the rule to reach traffic 6 minutes 29 seconds to 9 minutes 18 seconds after you create it. A workload bound shortly before can need several minutes for its first rule, and no duration is guaranteed. Until the rule reaches traffic, clients of the network still get through to the application.
After that, a client whose address belongs to a listed ASN receives HTTP 403 and Azion’s default error page, headed Forbidden. A request from an address in a listed network gets this response:
The Your IP row is the client address that the firewall compared with the list. Azion finds the ASN of an address in databases from external suppliers, and for some addresses that answer is inaccurate. The Azion Terms of Service state that access control works on a best-effort basis. For the best level of control, the same terms tell you to restrict access by IP address. For more information, refer to Terms of Service.
Once the rule is live, a change to the list’s items reaches traffic in 46 seconds to about 100 seconds. Meanwhile, one request can reflect the old items and the next one the updated items. Send the request again until the answers agree. For every propagation time, refer to Propagation. For the response that a denied client receives, refer to Deny (403 Forbidden).
To deny the network on one path only, add a Request Uri criterion to the same block. For the steps, refer to Guard one path with a network list.