NLnetLabs / ROVer

A Discord bot that fetches and displays the RPKI validity of a route
https://nlnetlabs.nl/rpki
BSD 3-Clause "New" or "Revised" License
6 stars 1 forks source link

Include AS name #6

Closed AlexanderBand closed 3 years ago

AlexanderBand commented 3 years ago

As requested by Greg Villain, include the AS name in the result. Could for example be fetched from RIPEstat JSON.

ximon18 commented 3 years ago

The output of the !validity command currently has the form:

Results for AS16509 - 185.49.143.0/24: VALID
At least one VRP Matches the Route Prefix

Matched VRPs
ASN          Prefix               Max Length
AS16509      185.49.143.0/24      24

Unmatched VRPs - ASN
ASN          Prefix               Max Length
AS14618      185.49.143.0/24      24

Unmatched VRPs - Length
ASN          Prefix               Max Length
AS8587       185.49.140.0/22      22

Last updated at: 2021-04-11T10:14:09.758385320+00:00

Looking at https://stat.ripe.net/data/as-overview/data.json?resource=AS16509 I assume the holder field is the interesting part:

{
    "messages": [],
    "see_also": [],
    "version": "1.3",
    "data_call_status": "supported - based on 2.1",
    "cached": false,
    "data": {
        "type": "as",
        "resource": "16509",
        "block": {
            "resource": "16384-17407",
            "desc": "Assigned by ARIN",
            "name": "IANA 16-bit Autonomous System (AS) Numbers Registry"
        },
        "holder": "AMAZON-02",
        "announced": true,
        "query_starttime": "2021-04-13T00:00:00",
        "query_endtime": "2021-04-13T00:00:00"
    },
    "query_id": "20210413085333-2cc3403b-1b9c-4b6e-8ecd-3888e3317b7f",
    "process_time": 411,
    "server_id": "app148",
    "build_version": "live.2021.4.12.154",
    "status": "ok",
    "status_code": 200,
    "time": "2021-04-13T08:53:34.041893"
}

@AlexanderBand: Where should this be added in the !validity response. Like this perhaps? Can we add Greg to this issue to get his feedback?

Results for AS16509 (AMAZON-02) - 185.49.143.0/24: VALID
At least one VRP Matches the Route Prefix

Matched VRPs
ASN          Prefix               Max Length
AS16509      185.49.143.0/24      24

Unmatched VRPs - ASN
ASN          Prefix               Max Length
AS14618      185.49.143.0/24      24

Unmatched VRPs - Length
ASN          Prefix               Max Length
AS8587       185.49.140.0/22      22

Last updated at: 2021-04-11T10:14:09.758385320+00:00
ximon18 commented 3 years ago

Also, @AlexanderBand , are there any requirements or restrictions concerning making requests to the RIPEstat endpoint?

Update: Seems okay after reading https://www.ripe.net/about-us/legal/ripestat-service-terms-and-conditions.

Update: The following from "Rules of Usage" for the data API could apply in theory to ROVer but the chances of so many concurrent or total daily requests is very low to non-existent at the moment:

These are the rules for the usage of the data API:

  • No limit on the amount of requests but please register if you plan to regularly do more than 1000 requests/day, see "Regular Usage" for details.
  • The system limits the usage to 8 concurrent (at the same time) requests coming from one IP address.

However, it might still be wise to do as suggested in the "Regular Usage" section:

Regular Usage If you are using the API on a regular basis you can use the "sourceapp" parameter to provide a unique identifier to every data call. This identifier helps us to assist you when you encounter any problems with the system. The identifier can be your project name or your company's.

Please drop us a short mail to stat@ripe.net with the identifier and an email address on which we can reach you. (If you include the purpose of the lookups, gold membership support is awaiting you :-)

ximon18 commented 3 years ago

For the AS Overview endpoint the RIPEstat documentation says:

upcoming - 2.0 Difference to 1.1: "query_starttime" and "query_endtime" is replaced by "query_time"

We should therefore either add preferred_version=1.3 to the request query parameters to avoid response parsing failure when the upcoming 2.0 service version changes the response format, OR ensure that the response parsing is not affected by changes to these response fields.

ximon18 commented 3 years ago

@AlexanderBand: When you have a moment, I've implemented the AS holder fetch from the RIPEstat AS Overview API endpoint. Can you give some feedback (or bring Greg to this discussion to give feedback) on whether including the AS name like this (if available) is okay?

Results for AS4608 (APNIC-SERVICES Asia Pacific Network Information Centre) - 202.12.29.0/24: VALID
At least one VRP Matches the Route Prefix

Matched VRPs
ASN          Prefix               Max Length
AS4608       202.12.29.0/24       24

Last updated at: 2021-04-13T23:42:50.663618388+00:00
AlexanderBand commented 3 years ago

Given the monospace, plain text format ROVer currently returns I think we have to be mindful of line length and clutter. Let's rethink this layout once we make it rich text with links, etc.

For now I'd say the most important informational bit should remain uncluttered at the top. How about this?

Results for AS4608 - 202.12.29.0/24: VALID
At least one VRP Matches the Route Prefix

Matched VRPs
ASN          Prefix               Max Length
AS4608       202.12.29.0/24       24

AS Name: APNIC-SERVICES Asia Pacific Network Information Centre
Validation last updated at: 2021-04-13T23:42:50.663618388+00:00
ximon18 commented 3 years ago

@AlexanderBand: I considered your design but thought I was being too picky ;-) I'll change it as suggested.

ximon18 commented 3 years ago

@AlexanderBand: Done, example:

Results for AS43996 - 5.57.16.0/24: VALID
At least one VRP Matches the Route Prefix

Matched VRPs
ASN          Prefix               Max Length
AS43996      5.57.16.0/24         24

Unmatched VRPs - ASN
ASN          Prefix               Max Length
AS26415      5.57.16.0/24         24
AS19905      5.57.16.0/24         24

Unmatched VRPs - Length
ASN          Prefix               Max Length
AS43996      5.57.16.0/22         22
AS43996      5.57.16.0/21         21

AS Name: BOOKING-BV - Booking.com BV
Validation last updated at: 2021-04-14T08:44:04.979073404+00:00

As this matches exactly what you suggested I'll go ahead and release it.