1*5ffbcedbSclaudio.\" $OpenBSD: bgplgd.8,v 1.12 2024/12/03 10:38:06 claudio Exp $ 2e76e7180Sclaudio.\" 3e76e7180Sclaudio.\" Copyright (c) 2021 Claudio Jeker <claudio@openbsd.org> 4e76e7180Sclaudio.\" 5e76e7180Sclaudio.\" Permission to use, copy, modify, and distribute this software for any 6e76e7180Sclaudio.\" purpose with or without fee is hereby granted, provided that the above 7e76e7180Sclaudio.\" copyright notice and this permission notice appear in all copies. 8e76e7180Sclaudio.\" 9e76e7180Sclaudio.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10e76e7180Sclaudio.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11e76e7180Sclaudio.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12e76e7180Sclaudio.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13e76e7180Sclaudio.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14e76e7180Sclaudio.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15e76e7180Sclaudio.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16e76e7180Sclaudio.\" 17*5ffbcedbSclaudio.Dd $Mdocdate: December 3 2024 $ 18e76e7180Sclaudio.Dt BGPLGD 8 19e76e7180Sclaudio.Os 20e76e7180Sclaudio.Sh NAME 21e76e7180Sclaudio.Nm bgplgd 22e76e7180Sclaudio.Nd a bgpctl FastCGI server 23e76e7180Sclaudio.Sh SYNOPSIS 24e76e7180Sclaudio.Nm 25e76e7180Sclaudio.Op Fl d 26e76e7180Sclaudio.Op Fl p Ar path 27e76e7180Sclaudio.Op Fl S Ar socket 28e76e7180Sclaudio.Op Fl s Ar socket 29e76e7180Sclaudio.Op Fl U Ar user 3067a9111eSjob.Op Fl V 31e76e7180Sclaudio.Sh DESCRIPTION 32e76e7180Sclaudio.Nm 33e76e7180Sclaudiois a server which implements the FastCGI Protocol to execute 34e76e7180Sclaudio.Xr bgpctl 8 35e76e7180Sclaudiocommands. 36e76e7180Sclaudio.Nm 37e76e7180Sclaudiois a simple server that implements a simple web API to query 38e76e7180Sclaudio.Xr bgpd 8 . 39e76e7180Sclaudio.Pp 40e76e7180Sclaudio.Nm 41e76e7180Sclaudioopens a socket at 42e76e7180Sclaudio.Pa /var/www/run/bgplgd.sock , 43e76e7180Sclaudioowned by www:www, 44e76e7180Sclaudiowith permissions 0660. 45760a8f95SclaudioIt will then drop privileges to user 46760a8f95Sclaudio.Qq _bgplgd , 47e76e7180Sclaudio.Xr unveil 2 48e76e7180Sclaudiothe 49e76e7180Sclaudio.Xr bgpctl 8 50e76e7180Sclaudiobinary 51e76e7180Sclaudioand restrict itself with 52e76e7180Sclaudio.Xr pledge 2 . 53e76e7180Sclaudio.Pp 54e76e7180SclaudioThe options are as follows: 55e76e7180Sclaudio.Bl -tag -width Ds 56e76e7180Sclaudio.It Fl d 57e76e7180SclaudioDo not daemonize. 58e76e7180SclaudioIf this option is specified, 59e76e7180Sclaudio.Nm 60e76e7180Sclaudiowill run in the foreground and log to stderr. 61e76e7180Sclaudio.It Fl p Ar path 62e76e7180SclaudioUse 63e76e7180Sclaudio.Ar path 64e76e7180Sclaudioinstead of 65e76e7180Sclaudio.Xr bgpctl 8 66e76e7180Sclaudioto query 67e76e7180Sclaudio.Xr bgpd 8 . 68e76e7180Sclaudio.It Fl S Ar socket 69e76e7180SclaudioUse 70e76e7180Sclaudio.Ar socket 71e76e7180Sclaudioinstead of the default 72e76e7180Sclaudio.Pa /var/run/bgpd.rsock 73e76e7180Sclaudioto communicate with 74e76e7180Sclaudio.Xr bgpd 8 . 75e76e7180Sclaudio.It Fl s Ar socket 76e76e7180SclaudioCreate and bind to alternative local socket at 77e76e7180Sclaudio.Ar socket . 78e76e7180Sclaudio.It Fl U Ar user 79e76e7180SclaudioChange the owner of 80e76e7180Sclaudio.Pa /var/www/run/bgplgd.sock 81e76e7180Sclaudioto 82e76e7180Sclaudio.Ar user 83e76e7180Sclaudioand its primary group instead of the default www:www. 8467a9111eSjob.It Fl V 8567a9111eSjobShow the version and exit. 86e76e7180Sclaudio.El 87e76e7180Sclaudio.Pp 88e76e7180Sclaudio.Nm 89e76e7180Sclaudioprovides the following API endpoints. 90e76e7180SclaudioUnless further specified the endpoints do not take any parameters: 91*5ffbcedbSclaudio.Pp 92*5ffbcedbSclaudio.Bl -tag -width "/interfaces" -compact 93e76e7180Sclaudio.It Pa /interfaces 94e76e7180SclaudioShow the interface states. 95e76e7180Sclaudio.It Pa /memory 96e76e7180SclaudioShow RIB memory statistics. 97fe299990Sclaudio.It Pa /metrics 98fe299990SclaudioOutput various statistics in OpenMetrics format. 99e76e7180Sclaudio.It Pa /neighbors 100e76e7180SclaudioShow detailed neighbors information. 101e76e7180SclaudioThe output can be limited with the following parameters: 102e76e7180Sclaudio.Pp 103e76e7180Sclaudio.Bl -tag -width "neighbor=peer" -compact 104e76e7180Sclaudio.It Cm neighbor Ns = Ns Ar peer 1057e354e24SjsgShow information for a specific neighbor. 106e76e7180Sclaudio.Ar peer 107e76e7180Sclaudiomay be the neighbor's address or description. 108e76e7180Sclaudio.It Cm group Ns = Ns Ar name 109e76e7180SclaudioShow only entries from the specified peer group. 110e76e7180Sclaudio.El 111e76e7180Sclaudio.It Pa /nexthops 112e76e7180SclaudioShow the list of BGP nexthops and the result of their validity check. 113e76e7180Sclaudio.It Pa /rib 114*5ffbcedbSclaudio.It Pa /rib/in 115*5ffbcedbSclaudio.It Pa /rib/out 116e76e7180SclaudioShow routes from the bgpd(8) Routing Information Base. 117*5ffbcedbSclaudioFor 118*5ffbcedbSclaudio.Pa /rib/in 119*5ffbcedbSclaudiothe 120*5ffbcedbSclaudio.Ar Adj-RIB-In 121*5ffbcedbSclaudiowill be queried and for 122*5ffbcedbSclaudio.Pa /rib/out 123*5ffbcedbSclaudiothe 124*5ffbcedbSclaudio.Ar Adj-RIB-out . 125e76e7180SclaudioThe following parameters can be used to filter the output: 126e76e7180Sclaudio.Pp 127e76e7180Sclaudio.Bl -tag -width "neighbor=peer" -compact 128e76e7180Sclaudio.It Cm neighbor Ns = Ns Ar peer 1297e354e24SjsgShow information for a specific neighbor. 130e76e7180Sclaudio.Ar peer 131e76e7180Sclaudiomay be the neighbor's address or description. 132e76e7180Sclaudio.It Cm group Ns = Ns Ar name 133e76e7180SclaudioShow only entries from the specified peer group. 134e76e7180Sclaudio.It Cm as Ns = Ns Ar number 135e76e7180SclaudioShow only entries with the specified source AS number. 136e76e7180Sclaudio.It Cm community Ns = Ns Ar string 137e76e7180Sclaudio.It Cm ext-community Ns = Ns Ar string 138e76e7180Sclaudio.It Cm large-community Ns = Ns Ar string 139e76e7180SclaudioShow only entries that match the specified community. 140e76e7180Sclaudio.It Xo 141e76e7180Sclaudio.Ic af Ns = Ns 142e76e7180Sclaudio.Pq Ic ipv4 | ipv6 | vpnv4 | vpnv6 143e76e7180Sclaudio.Xc 144e76e7180SclaudioShow only entries that match the specified address family. 145e76e7180Sclaudio.It Cm rib Ns = Ns Ar name 146e76e7180SclaudioShow only entries from the RIB with name 147e76e7180Sclaudio.Ar name . 148*5ffbcedbSclaudioCan only be used with the 149*5ffbcedbSclaudio.Pa /rib 150*5ffbcedbSclaudioendpoint. 151e76e7180Sclaudio.It Xo 152e76e7180Sclaudio.Ic ovs Ns = Ns 153e76e7180Sclaudio.Pq Ic valid | not-found | invalid 154e76e7180Sclaudio.Xc 155e76e7180SclaudioShow only prefixes that match the specified Origin Validation State. 156a35a1b73Sjmc.It Xo 157600dedbfSjob.Ic avs Ns = Ns 158600dedbfSjob.Pq Ic valid | invalid | unknown 159600dedbfSjob.Xc 160600dedbfSjobShow only prefixes that match the specified ASPA Validation State. 161e76e7180Sclaudio.It Cm best Ns = Ns 1 162e76e7180SclaudioShow only selected routes. 163e76e7180Sclaudio.It Cm error Ns = Ns 1 164e76e7180SclaudioShow only prefixes which are marked invalid and were treated as withdrawn. 165fac3be8eSclaudio.It Cm filtered Ns = Ns 1 166fac3be8eSclaudioShow only prefixes which are marked filtered by the input filter. 167cb563a9eSclaudio.It Cm invalid Ns = Ns 1 168cb563a9eSclaudioShow only prefixes which are not eligible. 169cb563a9eSclaudio.It Cm leaked Ns = Ns 1 170cb563a9eSclaudioShow only prefixes where a route leak was detected. 171e76e7180Sclaudio.It Cm prefix Ns = Ns Ar addr 172e76e7180SclaudioShow only entries that match prefix either as the best matching route or 173e76e7180Sclaudioshow the entry for this CIDR prefix. 174e76e7180Sclaudio.It Cm all Ns = Ns 1 175e76e7180SclaudioShow all entries in the specified prefix range. 176e76e7180Sclaudio.It Cm or-shorter Ns = Ns 1 177e76e7180SclaudioShow all entries covering and including the specified prefix. 178e76e7180Sclaudio.El 179e76e7180Sclaudio.It Pa /rtr 180e76e7180SclaudioShow a list of all RTR sessions. 181e76e7180Sclaudio.It Pa /sets 182e76e7180SclaudioShow a list summarizing all roa-set, as-set, prefix-set, and origin-set tables. 183e76e7180Sclaudio.It Pa /summary 184e76e7180SclaudioShow a list of all neighbors, including information about the session state 185e76e7180Sclaudioand message counters. 186e76e7180Sclaudio.El 187e76e7180Sclaudio.Sh EXAMPLES 188620bdc4bSdenisAdd the following to 189620bdc4bSdenis.Pa /etc/bgpd.conf 190620bdc4bSdenisto have 191620bdc4bSdenis.Xr bgpd 8 192620bdc4bSdenisopen a second, restricted, control socket: 193620bdc4bSdenis.Pp 194620bdc4bSdenis.Dl socket \&"/var/run/bgpd.rsock\&" restricted 195620bdc4bSdenis.Pp 196e76e7180SclaudioAn example setup in 197e76e7180Sclaudio.Xr httpd 8 198e76e7180Sclaudiois: 199e76e7180Sclaudio.Bd -literal -offset indent 200e76e7180Sclaudio location "/bgplgd/*" { 201e76e7180Sclaudio fastcgi socket "/run/bgplgd.sock" 202e76e7180Sclaudio request strip 1 203e76e7180Sclaudio } 204e76e7180Sclaudio.Ed 205e76e7180Sclaudio.Sh SEE ALSO 206e76e7180Sclaudio.Xr bgpctl 8 , 207e76e7180Sclaudio.Xr bgpd 8 , 208e76e7180Sclaudio.Xr httpd 8 209e76e7180Sclaudio.Sh HISTORY 210e76e7180SclaudioThe 211e76e7180Sclaudio.Nm 212e76e7180Sclaudioserver first appeared in 213e76e7180Sclaudio.Ox 7.2 . 214e76e7180Sclaudio.Sh AUTHORS 215e76e7180Sclaudio.An Claudio Jeker Aq Mt claudio@openbsd.org 216