]> git.ipfire.org Git - thirdparty/FORT-validator.git/commitdiff
Fix bugs (RRDP processing, unclosed file), add new docs for routers.
authorpcarana <pc.moreno2099@gmail.com>
Wed, 22 Jan 2020 23:40:56 +0000 (17:40 -0600)
committerpcarana <pc.moreno2099@gmail.com>
Wed, 22 Jan 2020 23:40:56 +0000 (17:40 -0600)
+Bug at RRDP processing: base64 content with middle spaces (or line breaks) wasn't decoded.
+Bug at file/dir validation during config: file wasn't closed on success.
+Add 'Routers' section at docs to indicate the basics on communication between routers and validator.

docs/_layouts/default.html
docs/routers.md [new file with mode: 0644]
src/common.c
src/rrdp/rrdp_parser.c

index c69afa329cec7b0c13856a435cc8f904ddc541bd..c5fd9d6fbad0e7bd359ed3f09c1701b181c4ee8e 100644 (file)
@@ -81,6 +81,9 @@
                                                <li>
                                                        <a class="item-menu{% if page.url == '/incidence.html' %} active{% endif %}" href="incidence.html">Incidences</a>
                                                </li>
+                                               <li>
+                                                       <a class="item-menu{% if page.url == '/routers.html' %} active{% endif %}" href="routers.html">Routers</a>
+                                               </li>
                                        </ul>
                                </aside>
                        </div>
diff --git a/docs/routers.md b/docs/routers.md
new file mode 100644 (file)
index 0000000..2db73e4
--- /dev/null
@@ -0,0 +1,63 @@
+---
+title: Routers
+---
+# {{ page.title }}
+
+## Index
+
+1. [Introduction](#introduction)
+2. [Server configuration](#server-configuration)
+3. [Router configuration](#router-configuration)
+4. [Behavior](#behavior)
+       1. [(Re)start](#restart)
+       2. [Continuous validation](#continuous-validation)
+
+## Introduction
+
+Just as mentioned at [Introduction to Fort](intro-fort.html), the validated ROAs prefixes and BGPsec router certificates are served so that any router can request them. This is where the RTR protocol comes in.
+
+Fort validator supports RTR version 0 ([RFC 6810](https://tools.ietf.org/html/rfc6810)) and version 1 ([RFC 8210](https://tools.ietf.org/html/rfc8210)). It depends on the router RTR implementation which version to use during the data exchange.
+
+## Server configuration
+
+The most relevant program arguments for the communication of Fort validator with the routers are:
+- [`--mode`](usage.html#--mode): must have the value `server` in order to run FORT validator as RTR server.
+- [`--server.address`](usage.html#--serveraddress): network address where the server will listen for routers.
+- [`--server.port`](usage.html#--serverport): port or service (see `‘$ man services’`) where the server will listen for routers.
+- [`--server.backlog`](usage.html#--serverbacklog): max number of outstanding connections in the server listen queue.
+- [`--server.interval.validation`](usage.html#--serverintervalvalidation): wait time (in seconds) between validations cycles. It also affects on how often the server could send update notifications to the routers (if there are updates as result of the last validation cycle).
+- [`--server.interval.refresh`](usage.html#--serverintervalrefresh): "This parameter tells the router how long to wait before next attempting to poll the cache and between subsequent attempts" (definition of _"Refresh Interval"_ from [RFC 8210 section 6](https://tools.ietf.org/html/rfc8210#section-6)).
+- [`--server.interval.retry`](usage.html#--serverintervalretry): "This parameter tells the router how long to wait before retrying a failed Serial Query or Reset Query." (definition of _"Retry Interval"_ from [RFC 8210 section 6](https://tools.ietf.org/html/rfc8210#section-6)).
+- [`--server.interval.expire`](usage.html#--serverintervalexpire): "This parameter tells the router how long it can continue to use the current version of the data while unable to perform a successful subsequent query" (definition of _"Expire Interval"_ from [RFC 8210 section 6](https://tools.ietf.org/html/rfc8210#section-6)).
+
+## Router configuration
+
+Each router has its own way to configure its connection with an RTR server, but the basic data needed to configure this is:
+- **Server address and port**: where the RTR server is located (configured at [`--server.address`](usage.html#--serveraddress) and [`--server.port`](usage.html#--serverport)).
+- **Refresh interval**: how often does the router will ask for updates to the server.
+- **Preference**: if multiple RTR servers are allowed, this indicates the preference order of each one of them. This way the router will go for updates according to such order.
+
+Here are a few links to the RPKI configuration docs at some routers:
+- [FRR](http://docs.frrouting.org/en/latest/bgp.html#prefix-origin-validation-using-rpki)
+- [Cisco](https://www.cisco.com/c/en/us/td/docs/ios-xml/ios/iproute_bgp/command/irg-cr-book/bgp-a1.html#wp2807841905)
+- [Juniper](https://www.juniper.net/documentation/en_US/junos/topics/reference/configuration-statement/validation-edit-routing-options.html)
+- [BIRD](https://bird.network.cz/?get_doc&v=20&f=bird-6.html#ss6.13)
+
+## Behavior
+
+### (Re)start
+
+When Fort validator is run for the first time, the RTR server will wait for router connections at [`--server.address`](usage.html#--serveraddress):[`--server.port`](usage.html#--serverport) and will start its first validation cycle.
+
+If a router establishes a connection with Fort before the first validation cycle ends, Fort will respond with a **"No Data Available"** RTR error, causing the router to wait some time (this will depend on each router) before asking for updates again.
+
+Once FORT validator ends its first validation cycle, it will share the resulting data (also known as "Validated ROA Payloads" or VRPs) with any router that establishes an RTR connection.
+
+> ![img/warn.svg](img/warn.svg) **TIP:** When Fort validator is run for the first time, wait a couple of minutes to connect the router, so that it can fetch all the valid data once the connection is established.
+
+### Continuous validation
+
+FORT validator will keep fetching and validating the repositories data once every [`--server.interval.validation`](usage.html#--serverintervalvalidation) seconds. If there are any updates at the VRPs, FORT will notify the routers so that they can request the updates; it's up to the routers to attend or ignore this notification message.
+
+Beside the notifications sent by the RTR server, the routers can periodically ask for updates. This can be configured at the router (see [Router configuration](#router-configuration)) and/or at the server (see [`--server.interval.refresh`](usage.html#--serverintervalrefresh)).
index 54ccebd712d693650b3d17fd30acba682e268d6b..21c62931e939a1218b1418c10786dd3c1596c5f4 100644 (file)
@@ -191,7 +191,9 @@ valid_file_or_dir(char const *location)
 {
        FILE *file;
        struct stat attr;
+       bool result;
 
+       result = false;
        file = fopen(location, "rb");
        if (file == NULL) {
                pr_errno(errno, "Could not open location '%s'",
@@ -201,21 +203,20 @@ valid_file_or_dir(char const *location)
 
        if (fstat(fileno(file), &attr) == -1) {
                pr_errno(errno, "fstat(%s) failed", location);
-               goto fail;
+               goto end;
        }
 
        if (!S_ISREG(attr.st_mode) && !S_ISDIR(attr.st_mode)) {
                pr_err("'%s' does not seem to be a file or directory",
                    location);
-               goto fail;
+               goto end;
        }
 
-       return true;
-
-fail:
+       result = true;
+end:
        if (fclose(file) == -1)
                pr_errno(errno, "fclose() failed");
-       return false;
+       return result;
 }
 
 char const *
index 55bad006270a6fe8ce4d909b75cb22f13428172d..e831f17888029ee733efc240950756c0efebb9e2 100644 (file)
@@ -143,11 +143,11 @@ download_file(struct rpki_uri *uri, long last_update)
        } while (true);
 }
 
-/* Trim @from, setting the result at @result pointer */
+/* Left trim @from, setting the result at @result pointer */
 static int
-trim(char *from, char **result, size_t *result_size)
+ltrim(char *from, char **result, size_t *result_size)
 {
-       char *start, *end;
+       char *start;
        size_t tmp_size;
 
        start = from;
@@ -159,18 +159,6 @@ trim(char *from, char **result, size_t *result_size)
        if (*start == '\0')
                return pr_err("Invalid base64 encoded string (seems to be empty or full of spaces).");
 
-       end = start;
-       while (*end != '\0') {
-               if (!isspace(*end)) {
-                       end++;
-                       continue;
-               }
-               /* No middle spaces, newlines, etc. allowed */
-               *end = '\0';
-               tmp_size = end - start;
-               break;
-       }
-
        *result = start;
        *result_size = tmp_size;
        return 0;
@@ -194,7 +182,7 @@ base64_sanitize(char *content, char **out)
        int error;
 
        original_size = 0;
-       error = trim(content, &tmp, &original_size);
+       error = ltrim(content, &tmp, &original_size);
        if (error)
                return error;