Securing the REST API
  • 30 Mar 2022
  • 1 Minute to read
  • Dark
    Light

Securing the REST API

  • Dark
    Light

This guide explains how to Control REST API Security on Ant Media Server. You could secure your REST Services with IP Filter feature.

IP Filter in REST API

If you want only some IP addresses to be able to access REST APIs, you should add IP’s or IP Ranges in Dashboard > {Application} > Settings > IP Filtering Settings in panel.

 

If 127.0.0.1 is deleted, requests in the server(localhost) is disabled. Devices in the same network can access but other devices that are not cannot access the REST API when 127.0.0.1 is on the list.

If you want to remove REST Filter in AMS, you should delete below codes in SERVER_FOLDER/webapp/Application(LiveApp or etc.)/WEB-INF/web.xml

<filter>
<filter-name>AuthenticationFilter</filter-name>
<filter-class>io.antmedia.console.rest.AuthenticationFilter</filter-class>
</filter>

<filter-mapping>
<filter-name>AuthenticationFilter</filter-name>`
<url-pattern>/rest/*</url-pattern>
</filter-mapping>

 If you delete AuthenticationFilter code block in Application, every one can access your REST API.

Changing IP filter from configurations file

  • Open /usr/local/antmedia/conf/red5.properties file.
  • Find the following line. Default configuration lets all IPs access the web panel.
server.allowed_dashboard_CIDR=0.0.0.0/0
  • Change the configuration according to your CIDR notation. You can add comma-separated CIDR notations as well.
server.allowed_dashboard_CIDR=13.197.23.11/16,87.22.34.66/8

Save the file and restart the server.

Now only the IPs that are in the CIDR block can access the web panel.

Here is the IP Filter Demo:

For more details, you can check this link -> IP Filter Gif


Was this article helpful?