Skip to main content

Offline Internet route origin validation using RPKI, IRR, and RIRs delegated databases

Project description

route-origin-validator

Offline Internet route origin validation using RPKI, IRR, and RIRs delegated databases

This python library is designed for validating a large number of routes in one shot. It downloads IRR, RPKI, and delegated databases to avoid network overhead for each query.

Installation

pip install rov

Usage:

Both the command line and python interfaces return status codes for each data source. For IRR and RPKI the possible status codes are:

  • NotFound
  • Invalid
  • Invalid,more-specific
  • Valid

For delegated we expect globally reachable resources to be 'assigned'. Resources that are 'reserved' and 'available' should be considered as bogons.

Command line

The command line interface should be used only for a few queries, each query will reload all databases.

>> rov 8.8.8.0/24 15169 
{
    "query": {
        "prefix": "8.8.8.0/24",
        "asn": 15169
    },
    "irr": {
        "status": "Valid",
        "prefix": "8.8.8.0/24",
        "descr": "Google",
        "source": "RADB"
    },
    "rpki": {
        "status": "Valid",
        "prefix": "8.8.8.0/24",
        "maxLength": 24,
        "ta": "arin"
    },
    "delegated": {
        "prefix": {
            "status": "assigned",
            "prefix": "8.0.0.0/9",
            "date": "19921201",
            "registry": "arin",
            "country": "US"
        },
        "asn": {
            "status": "assigned",
            "registry": "arin"
        }
    }
}

>> rov 10.1.0.0/16 15169
{
    "query": {
         "prefix": "10.1.0.0/16",
         "asn": "15169"
    },
    "irr": {
        "status": "NotFound"
    },
    "rpki": {
        "status": "NotFound"
    },
    "delegated": {
        "prefix": {
            "status": "reserved",
            "prefix": "10.0.0.0/8",
            "date": "19940301",
            "registry": "iana",
            "country": "ZZ"
        },
        "asn": {
            "status": "assigned",
            "registry": "arin"
        }
    }
}

Past RPKI data can also be queried. Currently this only works for RPKI, so the results mix past and recent data. In the following example, the rpki results are for 2018/10/01 but other results correspond to the exectution date.

>> rov 8.8.8.0/24 15169 --rpki_archive 2018/10/01
{
    "query": {
        "prefix": "8.8.8.0/24",
        "asn": 15169
    },
    "irr": {
        "status": "Valid",
        "prefix": "8.8.8.0/24",
        "descr": "Google",
        "source": "RADB"
    },
    "rpki": {
        "status": "NotFound"
    },
    "delegated": {
        "prefix": {
            "status": "assigned",
            "prefix": "8.0.0.0/9",
            "date": "19921201",
            "registry": "arin",
            "country": "US"
        },
        "asn": {
            "status": "assigned",
            "registry": "arin"
        }
    }
}

In python

For large batches use the python library as follows:

import json
from rov import ROV

# list of routes we want to validate
routes = [
    ['1.1.1.0/24', 13335],
    ['2.2.2.0/24', 3215],
    ['3.3.3.0/24', 16509],
    ['4.4.4.0/24', 198949],
    ['5.5.5.0/24', 6805],
    ]
    

rov = ROV()

# optional: download latest databases if needed
rov.download_databases()

# read databases, this may take a minute or so
rov.load_databases()

# this should be super fast
for prefix, asn in routes:
    state = rov.check(prefix, asn)
    print(prefix)
    print(json.dumps(state, indent=4))

#1.1.1.0/24
#{
#    "query": {
#        "prefix": "1.1.1.0/24",
#        "asn": 13335
#    },
#    "irr": {
#        "status": "Valid",
#        "prefix": "1.1.1.0/24",
#        "descr": "APNIC Research and Development\n6 Cordelia St",
#        "source": "APNIC"
#    },
#    "rpki": {
#        "status": "Valid",
#        "prefix": "1.1.1.0/24",
#        "maxLength": 24,
#        "ta": "apnic"
#    },
#    "delegated": {
#        "prefix": {
#            "status": "assigned",
#            "prefix": "1.1.1.0/24",
#            "date": "20110811",
#            "registry": "apnic",
#            "country": "AU"
#        },
#        "asn": {
#            "status": "assigned",
#            "registry": "arin"
#        }
#    }
#}
#2.2.2.0/24
#{
#    "query": {
#        "prefix": "2.2.2.0/24",
#        "asn": 3215
#    },
#    "irr": {
#        "status": "Invalid,more-specific",
#        "prefix": "2.2.0.0/16",
#        "descr": "France Telecom Orange",
#        "source": "RIPE"
#    },
#    "rpki": {
#        "status": "Invalid,more-specific",
#        "prefix": "2.0.0.0/12",
#        "maxLength": 17,
#        "ta": "ripe"
#    },
#    "delegated": {
#        "prefix": {
#            "status": "assigned",
#            "prefix": "2.0.0.0/12",
#            "date": "20100712",
#            "registry": "ripencc",
#            "country": "FR"
#        },
#        "asn": {
#            "status": "assigned",
#            "registry": "ripencc"
#        }
#    }
#}
#3.3.3.0/24
#{
#    "query": {
#        "prefix": "3.3.3.0/24",
#        "asn": 16509
#    },
#    "irr": {
#        "status": "NotFound"
#    },
#    "rpki": {
#        "status": "Valid",
#        "prefix": "3.0.0.0/10",
#        "maxLength": 24,
#        "ta": "arin"
#    },
#    "delegated": {
#        "prefix": {
#            "status": "assigned",
#            "prefix": "3.0.0.0/9",
#            "date": "20171220",
#            "registry": "arin",
#            "country": "US"
#        },
#        "asn": {
#            "status": "assigned",
#            "registry": "arin"
#        }
#    }
#}
#4.4.4.0/24
#{
#    "query": {
#        "prefix": "4.4.4.0/24",
#        "asn": 198949
#    },
#    "irr": {
#        "status": "Valid",
#        "prefix": "4.4.4.0/24",
#        "descr": "dima_training",
#        "source": "RADB"
#    },
#    "rpki": {
#        "status": "NotFound"
#    },
#    "delegated": {
#        "prefix": {
#            "status": "assigned",
#            "prefix": "4.0.0.0/9",
#            "date": "19921201",
#            "registry": "arin",
#            "country": "US"
#        },
#        "asn": {
#            "status": "assigned",
#            "registry": "ripencc"
#        }
#    }
#}
#5.5.5.0/24
#{
#    "query": {
#        "prefix": "5.5.5.0/24",
#        "asn": 6805
#    },
#    "irr": {
#        "status": "Invalid,more-specific",
#        "prefix": "5.4.0.0/14",
#        "descr": "Telefonica Germany GmbH & Co. OHG",
#        "source": "RIPE"
#    },
#    "rpki": {
#        "status": "Invalid,more-specific",
#        "prefix": "5.4.0.0/14",
#        "maxLength": 14,
#        "ta": "ripe"
#    },
#    "delegated": {
#        "prefix": {
#            "status": "assigned",
#            "prefix": "5.4.0.0/14",
#            "date": "20120425",
#            "registry": "ripencc",
#            "country": "DE"
#        },
#        "asn": {
#            "status": "assigned",
#            "registry": "ripencc"
#        }
#    }
#}

Acknowledgements

This project is supported by MANRS/ISOC, thanks!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rov-0.6.0.tar.gz (22.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rov-0.6.0-py3-none-any.whl (20.9 kB view details)

Uploaded Python 3

File details

Details for the file rov-0.6.0.tar.gz.

File metadata

  • Download URL: rov-0.6.0.tar.gz
  • Upload date:
  • Size: 22.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for rov-0.6.0.tar.gz
Algorithm Hash digest
SHA256 c7033566029bdba95de63b39d1c5def57478d7c96c8d6531f9242c365e853ab9
MD5 8392f2d83e99d1f0c983202bbf95ba8e
BLAKE2b-256 7a9fc8fadacb1a42711c4102c9bc9bce4ff62ba0cbc86300709c6d7e8e81d86f

See more details on using hashes here.

Provenance

The following attestation bundles were made for rov-0.6.0.tar.gz:

Publisher: release.yml on InternetHealthReport/route-origin-validator

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rov-0.6.0-py3-none-any.whl.

File metadata

  • Download URL: rov-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 20.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for rov-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 89c828a0126625fcec34c27ea9fd9e6e3b31485fbe043541935698ea91a40b02
MD5 7bacd0a962482c5a97c15d5c0cdf6851
BLAKE2b-256 45f033c77346b9c4b010a9fb17da03362e88191fd73f03757dfa34ae3fe7c777

See more details on using hashes here.

Provenance

The following attestation bundles were made for rov-0.6.0-py3-none-any.whl:

Publisher: release.yml on InternetHealthReport/route-origin-validator

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page