0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2025-01-03 15:41:54 +00:00
bird/proto/rpki/transport.h
Pavel Tvrdík 4661035431 RPKI protocol with one cache server per protocol
The RPKI protocol (RFC 6810) using the RTRLib
(http://rpki.realmv6.org/) that is integrated inside
the BIRD's code.

Implemeted transports are:
 - unprotected transport over TCP
 - secure transport over SSHv2

Example configuration of bird.conf:
  ...
  roa4 table r4;
  roa6 table r6;

  protocol rpki {
    debug all;

    # Import both IPv4 and IPv6 ROAs
    roa4 { table r4; };
    roa6 { table r6; };

    # Set cache server (validator) address,
    # overwrite default port 323
    remote "rpki-validator.realmv6.org" port 8282;

    # Overwrite default time intervals
    retry   10;         # Default 600 seconds
    refresh 60;         # Default 3600 seconds
    expire 600;         # Default 7200 seconds
  }

  protocol rpki {
    debug all;

    # Import only IPv4 routes
    roa4 { table r4; };

    # Set cache server address to localhost,
    # use default ports tcp => 323 or ssh => 22
    remote 127.0.0.1;

    # Use SSH transport instead of unprotected transport over TCP
    ssh encryption {
      bird private key "/home/birdgeek/.ssh/id_rsa";
      remote public key "/home/birdgeek/.ssh/known_hosts";
      user "birdgeek";
    };
  }
  ...
2016-05-26 13:57:19 +02:00

52 lines
1.8 KiB
C

/*
* BIRD -- The Resource Public Key Infrastructure (RPKI) to Router Protocol
*
* (c) 2015 CZ.NIC
*
* This file was a part of RTRlib: http://rpki.realmv6.org/
*
* Can be freely distributed and used under the terms of the GNU GPL.
*/
/*
* The RPKI transport sockets implement the communication channel
* (e.g., SSH, TCP, TCP-AO) between an RPKI server and client.
*
* Before using the transport socket, a tr_socket must be
* initialized based on a protocol-dependent init function (e.g.,
* rpki_tr_tcp_init()).
*
* The rpki_tr_* functions call the corresponding function pointers, which are
* passed in the rpki_tr_sock struct, and forward the remaining arguments.
*/
#ifndef _BIRD_RPKI_TRANSPORT_H_
#define _BIRD_RPKI_TRANSPORT_H_
#include <time.h>
/* The return values for tr_ functions */
enum tr_rtvals {
TR_SUCCESS = 0, /* Operation was successfull */
TR_ERROR = -1, /* Error occured */
TR_WOULDBLOCK = -2, /* No data is available on the socket */
TR_INTR = -3, /* Call was interrupted from a signal */
TR_CLOSED = -4 /* Connection closed */
};
/* A transport socket datastructure */
struct rpki_tr_sock {
void *data; /* Technology specific data */
sock *sk; /* Standard BIRD socket */
struct rpki_cache *cache; /* Cache server */
int (*open_fp)(struct rpki_tr_sock *); /* Pointer to a function that establishes the socket connection */
void (*close_fp)(struct rpki_tr_sock *); /* Pointer to a function that close and frees all memory allocated with this socket */
const char *(*ident_fp)(struct rpki_tr_sock *); /* Pointer to a function that returns an identifier for the socket endpoint */
};
int rpki_tr_open(struct rpki_tr_sock *tr);
void rpki_tr_close(struct rpki_tr_sock *tr);
const char *rpki_tr_ident(struct rpki_tr_sock *tr);
#endif