How to install the Scheduled Blocking solution through Azion Marketplace

The Azion Scheduled Blocking solution is a serverless solution available at Azion Marketplace.

This solution allows you to control the access to your application based on a time schedule, according to your needs.


To use the Scheduled Blocking solution provided by Azion Marketplace, you have to:

  1. Log in to your Real-Time Manager (RTM) account.
  2. On the upper-left corner of the page, select Products menu > Marketplace.
  3. Select the search box and type “scheduled blocking” or browse through the cards to find the Scheduled Blocking solution.
  4. Once you’ve found the Scheduled Blocking card, select it to go to the solution page.
  5. On the solution page, look for the Subscribe for section on the bottom-right corner.
  6. Click the Get It Now button.

You’ll see a message indicating that your solution was successfully installed and is ready to use.


Setting up the Edge Firewall rule

Section titled Setting up the Edge Firewall rule

To instantiate the Scheduled Blocking solution, follow the steps:

  1. In the Products menu, select Edge Firewall in the SECURE section.
  2. Click the Add Rule Set button.
  3. Give an easy-to-remember name to your new rule.
  4. Select the domains you want to protect with the function.
  5. Turn the Edge Functions switch on.
  6. Click the Save button.

Done. Now you’ve instantiated the rule for your function.


To instantiate the Scheduled Blocking solution, while still on the Edge Firewall page, select the Functions tab and follow these steps:

  1. Click the Add Function button.
  2. Give an easy to remember name to your instance.
  3. On the dropdown menu, select the Scheduled Blocking function.

This action will load the function, showing a form with the source code of the function and, just above it, two tabs: Code and Args.

By clicking the Code tab, you’ll be able to navigate through the source code but not to change it. In the same box, there’s the Args tab, which is where you’ll pass the parameters you want to use with your solution.

The Args tab will load a JSON file that looks like this:

{
"schedule": [
{
"action": "deny",
"execute_action_when": "in_interval",
"interval": {
"starts_at_utc": "00:00",
"finishes_at_utc": "00:59"
},
"week_days": {
"Sun": true,
"Mon": true,
"Tue": true,
"Wed": true,
"Thu": true,
"Fri": false,
"Sat": true
}
},
{
"action": "drop",
"execute_action_when": "not_in_interval",
"interval": {
"starts_at_utc": "01:00",
"finishes_at_utc": "20:00"
},
"week_days": {
"Mon": true,
"Tue": true
}
},
{
"action": "static_response",
"execute_action_when": "in_interval",
"static_response_data": {
"status": 503,
"message": "You can write a custom message here",
"html": "<!-- Some HTML can go here -->"
},
"interval": {
"starts_at_utc": "20:00",
"finishes_at_utc": "23:59"
},
"week_days": {
"Sun": true,
"Sat": true
}
}
]
}

The arguments that you can pass on this JSON file are the following:

AtributeData TypeDescription
actionStringDefines the action which the function will execute whenever a request matches the trigger criteria.

Possible values are:
Deny: it will close the request with an HTTP 403 Forbidden response.
Drop: it will close the request without sending any response to the client.
static_response: it will close the request with a static response to it.
execute_action_whenStringPossible values are:
in_interval
not_in_interval

When this argument is set to in_interval, the action will be executed whenever this function is called during the defined time interval.
When this argument is set to not_in_interval, the action will be executed whenever this function is called out of the defined time interval.
intervalDictionary of StringsDefines the time interval.
The values must be in the format “HH
”, based on a 24 hour clock.
Note: This function is used in the UTC time zone.
interval.starts_at_utcStringDefines the starting time of the interval.
interval.finishes_at_utcStringDefines the ending time of the interval.
week_daysDictionary of BooleansDefines the days of the week when the function will be executed.
The indexes of the dictionary represent each day of the week. They are expected to use a 3 letter format (EEE), starting with capital case. If an invalid day is used, it’ll be ignored.
Note that if a day is not present in the dictionary, it will be considered as false.
static_response_dataDictionary of StringsAllows the customization of the static response page which will be returned whenever the action is set to static_response.
static_response_data.statusNumberThe status code used in the static response.
static_response_data.messageStringAllows you to customize the message displayed in the static response page.
static_response_data.htmlStringAllows you to provide a custom HTML to be used when delivering the static response.

Note that for static_response parameter in action, you can define the status code that will be used in the response, as well as set a custom HTML page that will be delivered to your users.

Click the Save button and you’re done. Your Edge Firewall solution is instantiated.


Finally, you must set up the Rules Engine to configure the behavior and the criteria to run the function.

Still in the Edge Firewall page, select the Rules Engine tab and follow these steps:

  1. Click the New Rule button.
  2. Give a name to the rule.
  3. Select a criteria to run and catch the domain you want to run the solution on.
  4. Below, select the Run Function behavior to the criteria.
  • Select the adequate Scheduled Blocking function according to the name you gave it in the instantiate step.
  1. Click the Save button.

Done. Now the Scheduled Blocking solution is running for every request made to the domain you indicated.


Contributors