Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apm 9103 bgp alerter upgrade feature #10

Merged
merged 4 commits into from
Dec 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"./view",
"./tests",
"./logs",
"./build",
"./bin.js"
"./dist",
"./build"
]
}
8 changes: 8 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: 2
updates:
- package-ecosystem: npm
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10
target-branch: dev
117 changes: 117 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
name: Main

on:
push:
branches: [ "*" ]
pull_request:
branches: [ "*" ]

jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:

- name: Set up Javascript/Node
uses: actions/setup-node@v2
with:
node-version: '12'

- name: Check out code
uses: actions/checkout@v2
with:
fetch-depth: '0'

- name: Cache multiple paths
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-

- name: Build
run: |
npm install
npm run compile

- name: Upload Artifact
uses: actions/upload-artifact@v2
if: ${{ always() }}
with:
name: logs
path: ~/.npm/_logs/*
retention-days: 14

test:
name: Test
runs-on: ubuntu-latest
steps:

- name: Set up Javascript/Node
uses: actions/setup-node@v2
with:
node-version: '12'

- name: Check out code
uses: actions/checkout@v2
with:
fetch-depth: '0'

- name: Cache multiple paths
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-

- name: Install
run: |
npm install

- name: Tests
run: |
npm run test-core
npm run test-generate
npm run test-reports
npm run test-neighbor
npm run test-dump

- name: Tests RPKI
run: |
rm -f -R .cache/
./node_modules/.bin/mocha --exit tests/rpki_tests/tests.default.js --require @babel/register
./node_modules/.bin/mocha --exit tests/rpki_tests/tests.external.js --require @babel/register
rm -f -R .cache/ && ./node_modules/.bin/mocha --exit tests/rpki_tests/tests.external-roas.js --require @babel/register

- name: Tests Proxy
run: |
npm install -g anyproxy
nohup anyproxy --port 8001 &
ANYPROXY_PID=$!
npm run test-proxy
kill $ANYPROXY_PID

- name: Tests NPM
run: |
npm run test-npm

- name: Tests Kafka
run: |
sudo apt-get -y install tar
sudo apt-get -y install wget
wget https://mirror.lyrahosting.com/apache/kafka/2.6.0/kafka_2.13-2.6.0.tgz
tar -xzf kafka_2.13-2.6.0.tgz
nohup ./kafka_2.13-2.6.0/bin/zookeeper-server-start.sh ./kafka_2.13-2.6.0/config/zookeeper.properties &
nohup ./kafka_2.13-2.6.0/bin/kafka-server-start.sh ./kafka_2.13-2.6.0/config/server.properties &
nohup ./kafka_2.13-2.6.0/bin/kafka-topics.sh --create --topic bgpalerter --bootstrap-server 0.0.0.0:9092 &
sleep 20 && npm run test-kafka

- name: Upload Artifact
uses: actions/upload-artifact@v2
if: ${{ always() }}
with:
name: logs
path: ~/.npm/_logs/*
retention-days: 14
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
config.yml
prefixes.yml
groups.yml
.idea/
node_modules/
bin/
dist/
build/
logs/
.DS_Store
bgpalerter.pid
alertdata/
.npmrc
.cache/
volumetests/
tests/rpki_tests/vrp.json
tests/rpki_tests/roas.json
tests/generate_tests/prefixes.yml
export.json
tests/kafka_tests/kafka_2.13-2.6.0/
tests/kafka_tests/kafka_2.13-2.6.0.tgz
tests/kafka_tests/nohup.out
27 changes: 27 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
config.yml
prefixes.yml
groups.yml
.idea/
node_modules/
bin/
build/
src/
logs/
.DS_Store
bgpalerter.pid
alertdata/
.npmrc
.cache/
volumetests/
tests/
Dockerfile
.travis.yml
docs/
prefixes.yml.example
config.yml.example
build.sh
index.js
.github/
.hound.yml
.eslintrc.json
.babelrc
9 changes: 0 additions & 9 deletions .travis.yml

This file was deleted.

50 changes: 26 additions & 24 deletions AUTHORS
Original file line number Diff line number Diff line change
@@ -1,24 +1,26 @@
BGPalerter was originally created at the beginning of 2019 at NTT Ltd.

Here is a list of authors and contributors who patched or extended the code.
If this list is not up to date, please contact NTT or one of the authors.

- AUTHORS -

Massimo Candela <[email protected]>
NTT
https://massimocandela.com/

- CONTRIBUTORS -
Damian Zaremba, Fastly
Mircea Ulinic, DigitalOcean
Alan Haynes, Harbin Clinic


A special THANK YOU goes to:

Job Snijders <[email protected]> for pushing for this project to happen.

The RIPE RIS project for the amazing real-time streaming service.


BGPalerter was originally created at the beginning of 2019 at NTT Ltd.

Here is a list of authors and contributors who patched or extended the code.
If this list is not up to date, please contact NTT or one of the authors.

- AUTHORS -

Massimo Candela <[email protected]>
NTT
https://massimocandela.com/

- CONTRIBUTORS -
Damian Zaremba, Fastly
Mircea Ulinic, DigitalOcean
Alan Haynes, Harbin Clinic
Florian Domain, Criteo
Louis Poinsignon, Cloudflare


A special THANK YOU goes to:

Job Snijders <[email protected]> for pushing for this project to happen.

The RIPE RIS project for the amazing real-time streaming service.


10 changes: 9 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
FROM ubuntu
# -- trivial container for BGPalerter
FROM node:14-alpine as build

COPY setup_build_environment.sh /app/setup_build_environment.sh
RUN /app/setup_build_environment.sh
WORKDIR /app

# Makes the final image respect /etc/timezone configuration
RUN apk add --no-cache tzdata

RUN npm ci

ENTRYPOINT ["npm"]
CMD ["run", "serve"]
78 changes: 59 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,41 @@
[![Build Status](https://travis-ci.org/nttgin/BGPalerter.svg?branch=master)](https://travis-ci.org/nttgin/BGPalerter)
![Dependabot Status](https://badgen.net/dependabot/nttgin/BGPalerter/?icon=dependabot)
[![Build Status](https://github.com/nttgin/BGPalerter/workflows/Main/badge.svg)](https://github.com/nttgin/BGPalerter/actions?query=workflow%3AMain)
[![Reviewed by Hound](https://img.shields.io/badge/Reviewed_by-Hound-8E64B0.svg)](https://houndci.com)

# BGPalerter
Real-time BGP monitoring tool, pre-configured for visibility loss and hijacks detection.
Self-configuring BGP monitoring tool, which allows you to monitor in **real-time** if:
* any of your prefixes loses visibility;
* any of your prefixes is hijacked;
* your AS is announcing RPKI invalid prefixes (e.g., not matching prefix length);
* your AS is announcing prefixes not covered by ROAs;
* any of your ROAs is expiring;
* ROAs covering your prefixes are no longer reachable;
* RPKI Trust Anchors malfunctions;
* a ROA involving any of your prefixes or ASes was deleted/added/edited;
* your AS is announcing a new prefix that was never announced before;
* an unexpected upstream (left-side) AS appears in an AS path;
* an unexpected downstream (right-side) AS appears in an AS path;
* one of the AS paths used to reach your prefix matches a specific condition defined by you.

You just run it. You don't need to provide any data source or connect it to anything in your network since it connects to public repos.
You just run it. You don't need to provide any data source or connect it to anything in your network since it connects to [public repos](docs/datasets.md).

It can deliver alerts on files, by email, on slack, and more.
It can deliver alerts on files, email, kafka, slack, and more.

![BGPalerter](https://massimocandela.com/img/bgpalerter_github_image.png)
![BGPalerter](http://massimocandela.com/img/bgpalerter_github_image.png)

> BGPalerter connects to public BGP data repos (not managed by NTT), and the entire monitoring is done directly in the application (there are no NTT servers involved).

## TL;DR (1 minute setup)
> This section is useful if you don't care about the source code but you just want to run the monitor.
Instead, if you want to run the source code (which is completely open) or develop, please read directly the documentation.

1. Download the binary [here](https://github.com/nttgin/BGPalerter/releases) (be sure to select the one for your OS)

2. Execute the binary (e.g. `chmod 700 bgpalerter-linux-x64 && ./bgpalerter-linux-x64`)
2. Execute the binary (e.g., `chmod +x bgpalerter-linux-x64 && ./bgpalerter-linux-x64`)
The first time you run it, the auto-configuration will start.


If something happens (e.g. a hijack) you will see the alerts in `logs/reports-YYYY-MM-DD.log`.
In `config.yml` you can find other reporting mechanisms (e.g. email and slack) in addition to logging on files.
If something happens (e.g., a hijack) you will see the alerts in `logs/reports.log`.
In `config.yml` you can find other reporting mechanisms (e.g., email, Slack, Kafka) in addition to logging on files.
Please uncomment the related section and configure according to your needs.

If the installation doesn't go smoothly, read [here](docs/installation.md).
Expand All @@ -34,22 +47,49 @@ Read the documentation below for more options.
- [Run from binary](docs/installation.md#running-bgpalerter-from-binaries)
- [Run from source code](docs/installation.md#running-bgpalerter-from-the-source-code)
- [Run in Docker](docs/installation.md#running-bgpalerter-in-docker)
- [Run as a Linux service](docs/linux-service.md)
- [Command line options](docs/installation.md#bgpalerter-parameters)
- [Monitored prefixes list](docs/prefixes.md#prefixes)
- [Generate prefix list](docs/prefixes.md#generate)
- [Prefix attributes description](docs/prefixes.md#prefixes-fields)
- [Configuration](docs/configuration.md)
- [Composition](docs/configuration.md#composition)
- [Connectors](docs/configuration.md#connectors)
- [Monitors](docs/configuration.md#monitors)
- [Reports](docs/configuration.md#reports)
- [reportFile](docs/configuration.md#reportfile)
- [reportEmail](docs/configuration.md#reportemail)
- [reportSlack](docs/configuration.md#reportslack)
- [reportKafka](docs/configuration.md#reportkafka)
- [reportSyslog](docs/configuration.md#reportsyslog)
- [reportAlerta](docs/configuration.md#reportalerta)
- [reportWebex](docs/configuration.md#reportwebex)
- [Monitor for](docs/configuration.md#monitors)
- [Hijacks](docs/configuration.md#monitorhijack)
- [Path neighbors (downstream/upstream peers)](docs/path-neighbors.md)
- [Visibility loss](docs/configuration.md#monitorvisibility)
- [RPKI invalid announcements](docs/configuration.md#monitorrpki)
- [RPKI ROAs diffs, ROAs expirations, and TA malfunctions](docs/configuration.md#monitorroas)
- [Announcements of more specifics](docs/configuration.md#monitornewprefix)
- [Announcements of new prefixes](docs/configuration.md#monitoras)
- [Path matching](docs/configuration.md#monitorpath)
- [Send alerts to](docs/reports.md#reports)
- [File](docs/reports.md#reportfile)
- [E-mail](docs/reports.md#reportemail)
- [Slack](docs/reports.md#reportslack)
- [Kafka](docs/reports.md#reportkafka)
- [Syslog](docs/reports.md#reportsyslog)
- [Alerta dashboard](docs/reports.md#reportalerta)
- [Webex](docs/reports.md#reportwebex)
- [HTTP URL (push)](docs/reports.md#reporthttp)
- [Telegram](docs/reports.md#reporttelegram)
- [Mattermost](docs/reports.md#mattermost)
- [Pushover](docs/report-http.md#pushover)
- [Microsoft Teams](docs/report-http.md#ms-teams)
- [REST API (pull)](docs/reports.md#reportpullapi)
- [Test report configuration](docs/installation.md#bgpalerter-parameters)
- [Process/Uptime monitoring](docs/process-monitors.md)
- [Notification user groups](docs/usergroups.md)
- [RPKI configuration](docs/rpki.md)
- [Staging/testing ROAs](docs/rpki.md#stagingtesting-roas)
- [HTTP/HTTPS proxy](docs/http-proxy.md)
- [Update to latest version](docs/update.md)
- [More information for developers](docs/develop.md)
- [All npm commands](docs/develop.md#all-npm-commands)
- [Reports/alerts templates](docs/context.md)
- [Release process and Git flow](docs/release-process.md)
- [BGPalerter for researchers](docs/research.md)



If you are using BGPalerter, feel free to sign here: [Who is using BGPalerter](docs/friends.md)
Loading