From 589a891da55d336287a2116d8f832dde1f35421c Mon Sep 17 00:00:00 2001 From: Andy Newton Date: Wed, 15 Jan 2025 10:43:00 -0500 Subject: [PATCH 1/5] info messages that are useful for slow services --- icann-rdap-cli/src/rt/exec.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/icann-rdap-cli/src/rt/exec.rs b/icann-rdap-cli/src/rt/exec.rs index 93360b0..ea69a41 100644 --- a/icann-rdap-cli/src/rt/exec.rs +++ b/icann-rdap-cli/src/rt/exec.rs @@ -132,6 +132,7 @@ pub async fn execute_tests<'a, BS: BootstrapStore>( let mut test_run = TestRun::new_v4(vec![], v4, port); if !options.skip_v4 && more_runs { let client = create_client_with_addr(client_config, host, test_run.socket_addr)?; + info!("Sending request to {}", test_run.socket_addr); let rdap_response = rdap_url_request(&query_url, &client).await; test_run = test_run.end(rdap_response, options); } @@ -144,6 +145,7 @@ pub async fn execute_tests<'a, BS: BootstrapStore>( .origin(HeaderValue::from_str(&options.origin_value)?) .build(); let client = create_client_with_addr(&client_config, host, test_run.socket_addr)?; + info!("Sending request to {}", test_run.socket_addr); let rdap_response = rdap_url_request(&query_url, &client).await; test_run = test_run.end(rdap_response, options); } @@ -159,6 +161,7 @@ pub async fn execute_tests<'a, BS: BootstrapStore>( let mut test_run = TestRun::new_v6(vec![], v6, port); if !options.skip_v6 && more_runs { let client = create_client_with_addr(client_config, host, test_run.socket_addr)?; + info!("Sending request to {}", test_run.socket_addr); let rdap_response = rdap_url_request(&query_url, &client).await; test_run = test_run.end(rdap_response, options); } @@ -171,6 +174,7 @@ pub async fn execute_tests<'a, BS: BootstrapStore>( .origin(HeaderValue::from_str(&options.origin_value)?) .build(); let client = create_client_with_addr(&client_config, host, test_run.socket_addr)?; + info!("Sending request to {}", test_run.socket_addr); let rdap_response = rdap_url_request(&query_url, &client).await; test_run = test_run.end(rdap_response, options); } From a53b059dd54ad359d5db13fd6bf9745ecfc337de Mon Sep 17 00:00:00 2001 From: Andy Newton Date: Thu, 23 Jan 2025 14:43:34 -0500 Subject: [PATCH 2/5] fix for bug #99 and chaning tests to new style --- icann-rdap-common/src/check/httpdata.rs | 179 +++++++++++++++++++++--- 1 file changed, 157 insertions(+), 22 deletions(-) diff --git a/icann-rdap-common/src/check/httpdata.rs b/icann-rdap-common/src/check/httpdata.rs index fa4a046..9e13267 100644 --- a/icann-rdap-common/src/check/httpdata.rs +++ b/icann-rdap-common/src/check/httpdata.rs @@ -18,7 +18,7 @@ impl GetChecks for HttpData { items.push(Check::CorsAllowCredentialsNotRecommended.check_item()) } if let Some(content_type) = &self.content_type { - if !content_type.eq(RDAP_MEDIA_TYPE) { + if !content_type.starts_with(RDAP_MEDIA_TYPE) { items.push(Check::ContentTypeIsNotRdap.check_item()); } } else { @@ -58,11 +58,11 @@ impl GetChecks for HttpData { } #[cfg(test)] -#[allow(non_snake_case)] mod tests { use crate::{ check::{Check, CheckParams, GetChecks}, httpdata::HttpData, + media_types::{JSON_MEDIA_TYPE, RDAP_MEDIA_TYPE}, response::{ domain::Domain, types::{Common, ExtensionId, ObjectCommon}, @@ -71,8 +71,8 @@ mod tests { }; #[test] - fn GIVEN_icann_tig_with_cors_star_WHEN_get_checks_THEN_no_check() { - // GIVEN + fn check_not_rdap_media() { + // GIVEN an rdap response let domain = Domain { common: Common::level0_with_options() .extension(ExtensionId::IcannRdapTechnicalImplementationGuide0.to_extension()) @@ -87,12 +87,139 @@ mod tests { network: None, }; let rdap = RdapResponse::Domain(domain); + + // and GIVEN httpdata with content type that is not RDAP media type + let http_data = HttpData::example().content_type(JSON_MEDIA_TYPE).build(); + + // WHEN checks are run + let checks = http_data.get_checks(CheckParams::for_rdap(&rdap)); + + // THEN incorrect media type check is found + assert!(checks + .items + .iter() + .any(|c| c.check == Check::ContentTypeIsNotRdap)); + } + + #[test] + fn check_exactly_rdap_media() { + // GIVEN an rdap response + let domain = Domain { + common: Common::level0_with_options() + .extension(ExtensionId::IcannRdapTechnicalImplementationGuide0.to_extension()) + .build(), + object_common: ObjectCommon::domain().build(), + ldh_name: Some("foo.example".to_string()), + unicode_name: None, + variants: None, + secure_dns: None, + nameservers: None, + public_ids: None, + network: None, + }; + let rdap = RdapResponse::Domain(domain); + + // and GIVEN httpdata with content type that is not RDAP media type + let http_data = HttpData::example().content_type(RDAP_MEDIA_TYPE).build(); + + // WHEN checks are run + let checks = http_data.get_checks(CheckParams::for_rdap(&rdap)); + + // THEN incorrect media type check is not found + assert!(!checks + .items + .iter() + .any(|c| c.check == Check::ContentTypeIsNotRdap)); + } + + #[test] + fn check_rdap_media_with_charset_parameter() { + // GIVEN an rdap response + let domain = Domain { + common: Common::level0_with_options() + .extension(ExtensionId::IcannRdapTechnicalImplementationGuide0.to_extension()) + .build(), + object_common: ObjectCommon::domain().build(), + ldh_name: Some("foo.example".to_string()), + unicode_name: None, + variants: None, + secure_dns: None, + nameservers: None, + public_ids: None, + network: None, + }; + let rdap = RdapResponse::Domain(domain); + + // and GIVEN httpdata with content type that is not RDAP media type with charset parameter + let mt = format!("{RDAP_MEDIA_TYPE};charset=UTF-8"); + let http_data = HttpData::example().content_type(mt).build(); + + // WHEN checks are run + let checks = http_data.get_checks(CheckParams::for_rdap(&rdap)); + + // THEN incorrect media type check is not found + assert!(!checks + .items + .iter() + .any(|c| c.check == Check::ContentTypeIsNotRdap)); + } + + #[test] + fn check_media_type_absent() { + // GIVEN an rdap response + let domain = Domain { + common: Common::level0_with_options() + .extension(ExtensionId::IcannRdapTechnicalImplementationGuide0.to_extension()) + .build(), + object_common: ObjectCommon::domain().build(), + ldh_name: Some("foo.example".to_string()), + unicode_name: None, + variants: None, + secure_dns: None, + nameservers: None, + public_ids: None, + network: None, + }; + let rdap = RdapResponse::Domain(domain); + + // and GIVEN httpdata no content type + let http_data = HttpData::example().build(); + + // WHEN checks are run + let checks = http_data.get_checks(CheckParams::for_rdap(&rdap)); + + // THEN no media type check is found + assert!(checks + .items + .iter() + .any(|c| c.check == Check::ContentTypeIsAbsent)); + } + + #[test] + fn check_cors_header_with_tig() { + // GIVEN a response with gtld tig + let domain = Domain { + common: Common::level0_with_options() + .extension(ExtensionId::IcannRdapTechnicalImplementationGuide0.to_extension()) + .build(), + object_common: ObjectCommon::domain().build(), + ldh_name: Some("foo.example".to_string()), + unicode_name: None, + variants: None, + secure_dns: None, + nameservers: None, + public_ids: None, + network: None, + }; + let rdap = RdapResponse::Domain(domain); + + // and GIVEN a cors header with * let http_data = HttpData::example().access_control_allow_origin("*").build(); - // WHEN + // WHEN running checks let checks = http_data.get_checks(CheckParams::for_rdap(&rdap)); - // THEN + // THEN no check is given assert!(!checks .items .iter() @@ -100,8 +227,8 @@ mod tests { } #[test] - fn GIVEN_icann_tig_with_cors_not_star_WHEN_get_checks_THEN_cors_check() { - // GIVEN + fn check_cors_header_with_foo_and_tig() { + // GIVEN a response with gtld tig extension let domain = Domain { common: Common::level0_with_options() .extension(ExtensionId::IcannRdapTechnicalImplementationGuide0.to_extension()) @@ -116,14 +243,16 @@ mod tests { network: None, }; let rdap = RdapResponse::Domain(domain); + + // and GIVEN response with cors header of "foo" (not "*") let http_data = HttpData::example() .access_control_allow_origin("foo") .build(); - // WHEN + // WHEN running checks let checks = http_data.get_checks(CheckParams::for_rdap(&rdap)); - // THEN + // THEN the check is found assert!(checks .items .iter() @@ -131,8 +260,8 @@ mod tests { } #[test] - fn GIVEN_icann_tig_without_WHEN_get_checks_THEN_cors_check() { - // GIVEN + fn check_no_cors_header_and_tig() { + // GIVEN domain response with gtld tig extension id let domain = Domain { common: Common::level0_with_options() .extension(ExtensionId::IcannRdapTechnicalImplementationGuide0.to_extension()) @@ -147,12 +276,14 @@ mod tests { network: None, }; let rdap = RdapResponse::Domain(domain); + + // and GIVEN a response with no cors header let http_data = HttpData::example().build(); - // WHEN + // WHEN running checks let checks = http_data.get_checks(CheckParams::for_rdap(&rdap)); - // THEN + // THEN check for missing cors is found dbg!(&checks); assert!(checks .items @@ -161,8 +292,8 @@ mod tests { } #[test] - fn GIVEN_icann_tig_with_https_WHEN_get_checks_THEN_no_check() { - // GIVEN + fn given_response_is_over_https_and_tig() { + // GIVEN response with gtld tig extension let domain = Domain { common: Common::level0_with_options() .extension(ExtensionId::IcannRdapTechnicalImplementationGuide0.to_extension()) @@ -177,18 +308,20 @@ mod tests { network: None, }; let rdap = RdapResponse::Domain(domain); + + // and GIVEN response is over https let http_data = HttpData::now().scheme("https").host("example.com").build(); - // WHEN + // WHEN running checks let checks = http_data.get_checks(CheckParams::for_rdap(&rdap)); - // THEN + // THEN then check for must use https is not present assert!(!checks.items.iter().any(|c| c.check == Check::MustUseHttps)); } #[test] - fn GIVEN_icann_tig_with_http_WHEN_get_checks_THEN_must_use_https_check() { - // GIVEN + fn response_over_htttp_and_tig() { + // GIVEN domain response with gtld tig extension let domain = Domain { common: Common::level0_with_options() .extension(ExtensionId::IcannRdapTechnicalImplementationGuide0.to_extension()) @@ -203,12 +336,14 @@ mod tests { network: None, }; let rdap = RdapResponse::Domain(domain); + + // and GIVEN response is with http (not https) let http_data = HttpData::now().scheme("http").host("example.com").build(); - // WHEN + // WHEN running checks let checks = http_data.get_checks(CheckParams::for_rdap(&rdap)); - // THEN + // THEN check for must use https is found assert!(checks.items.iter().any(|c| c.check == Check::MustUseHttps)); } } From a2edf4e45a45800e3d9f84c7521d713de05ca38c Mon Sep 17 00:00:00 2001 From: Andy Newton Date: Fri, 24 Jan 2025 11:04:37 -0500 Subject: [PATCH 3/5] update of READMEs --- README.md | 14 ++- icann-rdap-cli/README.md | 148 +++---------------------------- icann-rdap-srv/README.md | 183 ++------------------------------------- 3 files changed, 27 insertions(+), 318 deletions(-) diff --git a/README.md b/README.md index 4098984..0cd73cf 100644 --- a/README.md +++ b/README.md @@ -12,11 +12,19 @@ About This repository hosts 4 separate packages (i.e. Rust crates): -* [icann-rdap-cli](icann-rdap-cli/README.md) is the Command Line Interface client. This package produces an executable binary. -* [icann-rdap-client](icann-rdap-client/README.md) is a library handling making RDAP requests. -* [icann-rdap-common](icann-rdap-common/README.md) is a library of RDAP structures. +* [icann-rdap-cli](icann-rdap-cli/README.md) is the Command Line Interface client and testing tool. +* [icann-rdap-client](icann-rdap-client/README.md) is a Rust library handling making RDAP requests. +* [icann-rdap-common](icann-rdap-common/README.md) is a Rust library of RDAP structures. * [icann-rdap-srv](icann-rdap-srv/README.md) is a simple, in-memory RDAP server. This package produces multiple executable binaries. +![Example of rdap command](https://github.com/icann/icann-rdap/wiki/images/rdap_command.png) + +Installation and Usage +---------------------- + +See the [project wiki](https://github.com/icann/icann-rdap/wiki) for information on installation +and usage of this software. + License ------- diff --git a/icann-rdap-cli/README.md b/icann-rdap-cli/README.md index de14785..4a43e92 100644 --- a/icann-rdap-cli/README.md +++ b/icann-rdap-cli/README.md @@ -1,6 +1,12 @@ ICANN RDAP CLI ============== +This package consists of the following commands: +* The [`rdap`](https://github.com/icann/icann-rdap/wiki/RDAP-command) command is a general-purpose RDAP command line client. +* The [`rdap-test`](https://github.com/icann/icann-rdap/wiki/RDAP-TEST-command) command is a testing tool for RDAP. + +![Example of rdap command](https://github.com/icann/icann-rdap/wiki/images/rdap_command.png) + This is a command-line interface (CLI) client for the Registration Data Access Protocol (RDAP) written and sponsored by the Internet Corporation for Assigned Names and Numbers [(ICANN)](https://www.icann.org). RDAP is standard of the [IETF](https://ietf.org/), and extensions @@ -8,145 +14,11 @@ to RDAP are a current work activity of the IETF's [REGEXT working group](https:/ More information on ICANN's role in RDAP can be found [here](https://www.icann.org/rdap). General information on RDAP can be found [here](https://rdap.rcode3.com/). -Installing the RDAP Client --------------------------- - -### Pre-Built Binaries - -Pre-built binaries are available for most mainstream systems: x86_64 and Arm 64bit for Linux GNU systems, x86_64 and Arm 64bit -macOS, and x86_64 for Windows. You may find the pre-built binaries on the [Releases](https://github.com/icann/icann-rdap/releases) -page. - -For non-Ubuntu Linux, compiling from crates.io or source (both are easy) is recommended to avoid issues with dynamic linking to OpenSSL. - -### Compiling from crates.io - -If you have [Rust](https://www.rust-lang.org/) installed on your system, then compiling from source is -very straightforward. If you do not have Rust installed on your system, it is usually very easy to do: -see [Rustup](https://rustup.rs/). - -If you are on a Linux system, you will need OpenSSL development files. For Debian and Ubuntu, this is -usually done via `apt install pkg-config libssl-dev`. For other Linux systems, consult your packaging -documentation. - -For macOS and Windows, the native TLS libraries are used, and there are no steps needed to install them. - -To build and install: `cargo install icann-rdap-cli`. - -### Compiling from Source - -If you have [Rust](https://www.rust-lang.org/) installed on your system, then compiling from source is -very straightforward. If you do not have Rust installed on your system, it is usually very easy to do: -see [Rustup](https://rustup.rs/). - -If you are on a Linux system, you will need OpenSSL development files. For Debian and Ubuntu, this is -usually done via `apt install pkg-config libssl-dev`. For other Linux systems, consult your packaging -documentation. - -For macOS and Windows, the native TLS libraries are used, and there are no steps needed to install them. - -Run the tests: `cargo test` - -Then build the software: `cargo build --release`. The 'rdap' executable binary will be available in the `target/release` directory. - -Using the RDAP Client ---------------------- - -The basic usage is `rdap XXX` where XXX is a domain name, IP address, AS number, etc... - -For more advanced usage, run `rdap --help` which should yield the extensive help guide. - -Paging Output -------------- - -The client has a built-in (embedded) pager. Use of this pager is controlled via the `RDAP_PAGING` -environment variable and the `-P` command argument. - -It takes three values: - -* "embedded" - use the built-in pager -* "auto" - use the built-in pager if the program is being run from a terminal -* "none" - use no paging - -For example, `-P embedded` will default to using the built-in pager. - -By default, the client will not use a pager. - -When set to "auto", the client determines if a pager is appropriate. -This is done by attempting to determine if the terminal is interactive or not. If the terminal -is not interactive, paging will be turned off otherwise it will be on. - -Output Format -------------- - -By default, the client will attempt to determine the output format of the information. If it determines the shell -is interactive, output will be in `rendered-markdown`. Otherwise, the output will be JSON. - -You can explicitly control this behavior using the `-O` command argument or the `RDAP_OUTPUT` environment variable -(see below). - -Directing Queries To A Specific Server --------------------------------------- - -By default, the client will use the RDAP bootstrap files provided by IANA to determine the authoritative server -for the information being requested. These IANA files have the "base URLs" for the RDAP servers. - -You can override this behavior by either specifying a base "object tag" from the IANA object tags registry or with -an explicit URL. - -An object tag can be specified with the `-b` command argument or the `RDAP_BASE` environment variable (see below). -For example, `-b arin` will direct the client to find the ARIN server in the RDAP object tag registry. - -An explicit base URL can be specified using the `-B` command or the `RDAP_BASE_URL` environment variable. - -Caching -------- - -By default, the client will cache data based on the request URL and "self" links provided in the RDAP results. - -This can be turned off with the `-N` command parameter or by setting the `RDAP_NO_CACHE` environment variable to "true". - -Logging -------- - -The client logs errors, warning, and other information on its processing. This can be controlled with the -`--log-level` command argument or the `RDAP_LOG` environment variable. - -Secure Connections ------------------- - -By default, the client will use secure connections. The following arguments and environment variables can be used -to modify this behavior: - -* `-T` or `RDAP_ALLOW_HTTP` : RDAP servers should be using HTTPS. When given or set to true, HTTP will be allowed. -* `-K` or `RDAP_ALLOW_INVALID_HOST_NAMES` : Allows HTTPS connections in which the host name does not match the certificate. -* `-I` or `RDAP_ALLOW_INVALID_CERTIFICATES` : Allows HTTPS connections in which the TLS certificate is invalid. - -Configuration -------------- - -Configuration of this program may be set using environment variables or -using an environment variables configuration file in the configuration -directory of this program. An example is automatically written to the -configuration directory. This configuraiton file may be customized by -uncommenting out the provided environment variable settings. - -The location of the configuration file is platform dependent. - -On Linux, this file is located at $XDG_CONFIG_HOME/rdap/rdap.env or -$HOME/.config/rdap/rdap.env. - -On macOS, this file is located at -$HOME/Library/Application Support/rdap/rdap.env. - -On Windows, this file is located at -{FOLDERID_RoamingAppData}\rdap\config\rdap.env. - -Resetting ---------- +Installation and Usage +---------------------- -Use the `--reset` argument to reset all client state. This will remove the RDAP and IANA caches and -reset the `rdap.env` file (see above) to the default. +See the [project wiki](https://github.com/icann/icann-rdap/wiki) for information on installation +and usage of this software. License diff --git a/icann-rdap-srv/README.md b/icann-rdap-srv/README.md index f6e80c3..a4110dc 100644 --- a/icann-rdap-srv/README.md +++ b/icann-rdap-srv/README.md @@ -1,185 +1,14 @@ ICANN RDAP Server ================= -This server was created to aid in the development of the ICANN RDAP Command Line Interface client. -It can be used as a library or as a server started within its own process. It currently has in-memory -storage, though its storage layer is architected to accomodate a PostgreSQL backend if that is needed -in the future. +This is an RDAP server that stores information in-memory and is +subsequently very fast. -This software is written and sponsored -by the Internet Corporation for Assigned Names and Numbers [(ICANN)](https://www.icann.org). -RDAP is standard of the [IETF](https://ietf.org/), and extensions -to RDAP are a current work activity of the IETF's [REGEXT working group](https://datatracker.ietf.org/wg/regext/documents/). -More information on ICANN's role in RDAP can be found [here](https://www.icann.org/rdap). -General information on RDAP can be found [here](https://rdap.rcode3.com/). +Installation and Usage +---------------------- -RDAP core support in this server is as follows: - -- [X] LDH Domain lookup (`/domain/ldh`) -- [X] IDN U-Label lookup (`/domain/unicode`) -- [X] Entity lookup (`/entity/handle`) -- [X] Nameserver lookup (`/nameserver/fqdn`) -- [X] Autnum lookup (`/autnum/123`) -- [X] IP address lookup (`/ip/ip_address`) -- [X] CIDR lookup (`/ip/prefix/len`) -- [ ] Domain search -- [ ] Nameserver search -- [ ] Entity search -- [X] Help (`/help`) - -### Compiling from crates.io - -If you have [Rust](https://www.rust-lang.org/) installed on your system, then compiling from source is -very straightforward. If you do not have Rust installed on your system, it is usually very easy to do: -see [Rustup](https://rustup.rs/). - -If you are on a Linux system, you will need OpenSSL development files. For Debian and Ubuntu, this is -usually done via `apt install pkg-config libssl-dev`. For other Linux systems, consult your packaging -documentation. - -For macOS and Windows, the native TLS libraries are used, and there are no steps needed to install them. - -To build and install: `cargo install icann-rdap-srv`. - -## Compiling from Source - -If you have [Rust](https://www.rust-lang.org/) installed on your system, then compiling from source is -very straightforward. If you do not have Rust installed on your system, it is usually very easy to do: -see [Rustup](https://rustup.rs/). - -If you are on a Linux system, you will need OpenSSL development files. For Debian and Ubuntu, this is -usually done via `apt install pkg-config libssl-dev`. For other Linux systems, consult your packaging -documentation. - -For macOS and Windows, the native TLS libraries are used, and there are no steps needed to install them. - -Run the tests: `cargo test` - -Then build the software: `cargo build --release`. The 'rdap-srv' executable binary will be available -in the `target/release` directory. - -## Quick Start - -Create a `.env` file in the directory where you intend to run the commands, and put the following in that file: - - RDAP_SRV_LOG=debug - RDAP_SRV_DATA_DIR=/tmp/rdap-srv/data - RDAP_BASE_URL=http://localhost:3000/rdap - -Create directory in /tmp to hold server data files: - - mkdir -p /tmp/rdap-srv/data - -Create the default server help: - - ./target/release/rdap-srv-data srv-help --notice "this is a test server" - -Create some data: - - ./target/release/rdap-srv-data entity --handle foo1234 --email joe@example.com --full-name "Joe User" - ./target/release/rdap-srv-data nameserver --ldh ns1.example.com --registrant foo1234 - -Start the server: - - ./target/release/rdap-srv - -Query the server with the client in another terminal: - - ./target/release/rdap -T -B http://localhost:3000/rdap ns1.example.com - -While the server is running, do the following in a separate terminal to add some more data: - - ./target/release/rdap-srv-data domain --ldh example.com --registrant foo1234 --ns ns1.example.com - ./target/release/rdap-srv-store --update - -Query the server for the new data: - - ./target/release/rdap -T -B http://localhost:3000/rdap example.com - -For more information on the options available, use the `--help` option. - -## Running the Server - -The server is configured via environment variables. These variables can be configured in a shell -script or whatever normal means are used to set environment variables. Additionally, they may be -placed in a `.env` in the current directory. - -* "RDAP_SRV_LOG" - can be the values 'info', 'error', 'debug', 'warn' or 'trace'. Defualts to 'info'. -* "RDAP_SRV_LISTEN_ADDR" - the IP address of the interface to listen on. Defaults to 127.0.0.1. -* "RDAP_SRV_LISTEN_PORT" - the port to listen on. Defaults to 3000. -* "RDAP_SRV_STORAGE" - either "mem" or "pg", but "pg" doesn't do anything. -* "RDAP_SRV_DB_URL" - database URL when using "pg" storage. -* "RDAP_SRV_DATA_DIR" - the directory containing the files used for storage. - -## Memory Storage - -The data for the memory storage is specified by the "RDAP_SRV_DATA_DIR" environment variable. -Files in this directory are either valid RDAP JSON files, or template files containing valid -RDAP JSON. Files ending in `.json` are considered to be RDAP JSON, and files ending in `.template` -are considered to be template files. - -Memory storage supports hot reloading. This can be done by "touching" either the file -named "update" or "reload" in the data directory. The "update" file triggers an update -but does not remove any previous data unless that data exists in the data directory files. -The "reload" file triggers a full reload, removing all previous data and replacing it with -the data from the files in the data directory. - -Alternatively, you can use the `rdap-srv-store` command to touch the files to trigger -reloads and updates: `rdap-srv-store --update` or `rdap-srv-store --reload`. - -## Create Data - -RDAP data can often be tricky to create, but the `rdap-srv-data` command makes it easier. -This command does not cover all possible RDAP expressions, but it does cover the common -scenarios and can be used as a starting point for those who require more complex RDAP data. - -This command has 5 sub-commands, each with its own specific set of command line arguments. -Use the `--help` option to see the arguments for each sub-command. - - rdap-srv-data entity --help - rdap-srv-data nameserver --help - rdap-srv-data domain --help - rdap-srv-data autnum --help - rdap-srv-data network --help - -## Templates - -Template files allow for the creation of many RDAP objects by changing just the ID of the object. -The `rdap-srv-data` command can create a template file which can be used as a template. In other words, -one can use the `rdap-srv-data` command to create the template file and then edit the file with -the object ids desired. - -The following command creates an entity template using the `--template` option: - - rdap-srv-data --template entity --handle foo --full-name "Bob Smurd" - -The IDs array in the templates differ for every object class: - -* domain: `{"ldhName": "foo.example"}`. May optionally have a `unicodeName` as well. -* entity: `{"handle"; "XXXX"}` -* nameserver: `{"ldhName": "ns.foo.example"}`. May optionally have a `unicodeName` as well. -* autnum: `{"start_autnum": 1, "end_autnum": 99}` -* ip: either `{"networkId": {"startAddress": "xxx.xxx.xxx.xxx", "endAddress": "xxx.xxx.xxx.xxx"}}` or `{"networkId": "xxx.xxx.xxx.xxx/yyy"}` - -## Redirects - -Template files can also be used to create redirects (which are modeled by the server as RDAP errors though they are not). -Like other templates, more than one object ID can be used to create a redirect for many objects. - -The following command creates a redirect for an IP network: - - rdap-srv-data --redirect http://other.example/ip/11.0.0.0/16 network --cidr 11.0.0.0/16 - -## Use Your Data - -As mentioned above, the `rdap-srv-store` command can be used to signal a reload or update -of the server. This command can also be used to copy your own data into the data directory -by specifiing a directory: - - rdap-srv-store --update /my_data/rdap - -This command will perform checks on your data while copying them to ensure the data is -RDAP compliant. +See the [project wiki](https://github.com/icann/icann-rdap/wiki) for information on installation +and usage of this software. License ------- From c52e80d9d8a3233148a8c18b7bbb66d6e7647d40 Mon Sep 17 00:00:00 2001 From: Andy Newton Date: Sat, 25 Jan 2025 06:18:11 -0500 Subject: [PATCH 4/5] changes to info logs --- icann-rdap-cli/src/rt/exec.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/icann-rdap-cli/src/rt/exec.rs b/icann-rdap-cli/src/rt/exec.rs index ea69a41..892099e 100644 --- a/icann-rdap-cli/src/rt/exec.rs +++ b/icann-rdap-cli/src/rt/exec.rs @@ -93,7 +93,7 @@ pub async fn execute_tests<'a, BS: BootstrapStore>( QueryType::Url(url) => url.to_owned(), _ => { let base_url = qtype_to_bootstrap_url(&bs_client, bs, value, |reg| { - debug!("Fetching IANA registry {} for value {value}", reg.url()) + info!("Fetching IANA registry {} for value {value}", reg.url()) }) .await?; value.query_url(&base_url)? @@ -102,12 +102,13 @@ pub async fn execute_tests<'a, BS: BootstrapStore>( // if they URL to test is a referral if options.chase_referral { let client = create_client(client_config)?; + info!("Fetching referral from {query_url}"); let response_data = rdap_url_request(&query_url, &client).await?; query_url = get_related_links(&response_data.rdap) .first() .ok_or(TestExecutionError::NoReferralToChase)? .to_string(); - debug!("Chasing referral {query_url}"); + info!("Referral is {query_url}"); } let parsed_url = Url::parse(&query_url)?; From c4f7eab4582685de7de585664374f6efbd06b900 Mon Sep 17 00:00:00 2001 From: Andy Newton Date: Sat, 25 Jan 2025 06:31:34 -0500 Subject: [PATCH 5/5] bumping to v0.0.21 --- Cargo.lock | 8 ++++---- Cargo.toml | 2 +- icann-rdap-cli/Cargo.toml | 4 ++-- icann-rdap-client/Cargo.toml | 2 +- icann-rdap-srv/Cargo.toml | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c7983cd..4ccb67d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1427,7 +1427,7 @@ dependencies = [ [[package]] name = "icann-rdap-cli" -version = "0.0.20" +version = "0.0.21" dependencies = [ "anyhow", "assert_cmd", @@ -1463,7 +1463,7 @@ dependencies = [ [[package]] name = "icann-rdap-client" -version = "0.0.20" +version = "0.0.21" dependencies = [ "buildstructor", "chrono", @@ -1490,7 +1490,7 @@ dependencies = [ [[package]] name = "icann-rdap-common" -version = "0.0.20" +version = "0.0.21" dependencies = [ "buildstructor", "chrono", @@ -1510,7 +1510,7 @@ dependencies = [ [[package]] name = "icann-rdap-srv" -version = "0.0.20" +version = "0.0.21" dependencies = [ "ab-radix-trie", "assert_cmd", diff --git a/Cargo.toml b/Cargo.toml index 3522523..f3e4634 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,7 +8,7 @@ members = [ resolver = "2" [workspace.package] -version = "0.0.20" +version = "0.0.21" edition = "2021" license = "MIT OR Apache-2.0" repository = "https://github.com/icann/icann-rdap" diff --git a/icann-rdap-cli/Cargo.toml b/icann-rdap-cli/Cargo.toml index cbc813c..446e552 100644 --- a/icann-rdap-cli/Cargo.toml +++ b/icann-rdap-cli/Cargo.toml @@ -10,8 +10,8 @@ An RDAP Command Line Interface client. [dependencies] -icann-rdap-client = { version = "0.0.20", path = "../icann-rdap-client" } -icann-rdap-common = { version = "0.0.20", path = "../icann-rdap-common" } +icann-rdap-client = { version = "0.0.21", path = "../icann-rdap-client" } +icann-rdap-common = { version = "0.0.21", path = "../icann-rdap-common" } anyhow.workspace = true clap.workspace = true diff --git a/icann-rdap-client/Cargo.toml b/icann-rdap-client/Cargo.toml index 3af792f..9fe0a30 100644 --- a/icann-rdap-client/Cargo.toml +++ b/icann-rdap-client/Cargo.toml @@ -10,7 +10,7 @@ An RDAP client library. [dependencies] -icann-rdap-common = { version = "0.0.20", path = "../icann-rdap-common" } +icann-rdap-common = { version = "0.0.21", path = "../icann-rdap-common" } buildstructor.workspace = true cidr.workspace = true diff --git a/icann-rdap-srv/Cargo.toml b/icann-rdap-srv/Cargo.toml index 63268c9..036f60a 100644 --- a/icann-rdap-srv/Cargo.toml +++ b/icann-rdap-srv/Cargo.toml @@ -10,8 +10,8 @@ An RDAP Server. [dependencies] -icann-rdap-client = { version = "0.0.20", path = "../icann-rdap-client" } -icann-rdap-common = { version = "0.0.20", path = "../icann-rdap-common" } +icann-rdap-client = { version = "0.0.21", path = "../icann-rdap-client" } +icann-rdap-common = { version = "0.0.21", path = "../icann-rdap-common" } ab-radix-trie.workspace = true async-trait.workspace = true