Skip to content

Commit

Permalink
Merge branch 'dev' into debian-ci
Browse files Browse the repository at this point in the history
  • Loading branch information
massimocandela committed Dec 24, 2023
2 parents 7c0efcd + 57686bc commit 482cb0c
Show file tree
Hide file tree
Showing 34 changed files with 2,269 additions and 1,431 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ jobs:
steps:

- name: Set up Javascript/Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18.14.0
node-version: 18.19.0

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

Expand Down Expand Up @@ -49,12 +49,12 @@ jobs:
steps:

- name: Set up nodejs
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18.14.0
node-version: 18.19.0

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

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -- trivial container for BGPalerter
FROM node:18.14.0-alpine as build
FROM node:18.19.0-alpine as build

WORKDIR /opt/bgpalerter
COPY . .
Expand Down
6 changes: 3 additions & 3 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ npm ci --silent

npm run compile

./node_modules/.bin/pkg ./dist/package.json --targets node18-win-x64 --output bin/bgpalerter-win-x64 --loglevel=error
./node_modules/.bin/pkg ./dist/package.json --options "no-warnings,max-old-space-size=4096" --targets node18-win-x64 --output bin/bgpalerter-win-x64 --loglevel=error

./node_modules/.bin/pkg ./dist/package.json --targets node18-linux-x64 --output bin/bgpalerter-linux-x64 --loglevel=error
./node_modules/.bin/pkg ./dist/package.json --options "no-warnings,max-old-space-size=4096" --targets node18-linux-x64 --output bin/bgpalerter-linux-x64 --loglevel=error

./node_modules/.bin/pkg ./dist/package.json --targets node18-macos-x64 --output bin/bgpalerter-macos-x64 --loglevel=error
./node_modules/.bin/pkg ./dist/package.json --options "no-warnings,max-old-space-size=4096" --targets node18-macos-x64 --output bin/bgpalerter-macos-x64 --loglevel=error

echo "--> BGPalerter compiled in bin/ (ignore the warnings about files that cannot be resolved)."

Expand Down
1 change: 1 addition & 0 deletions config.yml.example
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ monitors:
channel: misconfiguration
name: asn-monitor
params:
skipPrefixMatch: false
thresholdMinPeers: 3

- file: monitorRPKI
Expand Down
3 changes: 2 additions & 1 deletion docs/friends.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,5 @@ Please, let me know so I can add your company name here.
* Speakup (AS49627)
* Nick Bouwhuis (AS202585)
* IX.br (AS26162, AS263044, AS20121)
* Cyberfusion (AS204983)
* Cyberfusion (AS204983)
* EscapeNet (AS7600)
2 changes: 1 addition & 1 deletion docs/linux-service.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ fi
# Delete log file if larger than 5MB
find $LOGS -type f -name "upgrade.log" -size +5M -delete

exec 1> $LOGS/upgrade.log 2>&1
exec 1>> $LOGS/upgrade.log 2>&1

cd $DIR

Expand Down
6 changes: 3 additions & 3 deletions docs/research.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,11 @@ export default class myMonitor extends Monitor { // It MUST extend Monitor
* This is where the real analysis happens and when the alerts are generated. Place here your complex filtering/analysis.
* The 'filter' function described before is needed to avoid useless calls to the 'monitor' function, which is much more expensive in terms of memory. */
const matchedRule = this.getMoreSpecificMatch(message.prefix); //The method getMoreSpecificMatch is inherited from the super class, it provides the rule in prefixes.yml that matches the current BGP message.
const matchedRules = this.getMoreSpecificMatches(message.prefix); //The method getMoreSpecificMatches is inherited from the super class, it provides the rule in prefixes.yml that matches the current BGP message.
if (matchedRule) { // We matched something in prefixes.yml
for (let matchedRule of matchedRules) { // We matched something in prefixes.yml
const signature = message.originAS.getId() + "-" + message.prefix; // All messages with the same origin AS and prefix will be bundled together. Read above the squash method to understand why.
this.publishAlert(signature, // The method publishAlert is inherited from the super class.
message.prefix, // The monitored resource subject of the alert (it can be an AS or a prefix)
matchedRule, // The monitored rule that was matched (from prefixes.yml)
Expand Down
11 changes: 11 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import yargs from 'yargs';
import fs from "fs";
import yaml from "js-yaml";
import os from "os";

const params = yargs
.usage('Usage: $0 <command> [options]')
Expand All @@ -51,6 +52,11 @@ const params = yargs
.nargs('t', 0)
.describe('t', 'Test the configuration with fake BGP updates')

.alias('M', 'skip-memory-check')
.nargs('M', 0)
.describe('M', 'Skip memory check')


.alias('d', 'data-volume')
.nargs('d', 1)
.describe('d', 'A directory where configuration and data is persisted')
Expand Down Expand Up @@ -194,6 +200,11 @@ switch(params._[0]) {
break;

default: // Run monitor

if (!params.M && os.totalmem() < 4294967296) {
throw new Error("You need 4GB or RAM to run BGPalerter");
}

global.DRY_RUN = !!params.t;
if (global.DRY_RUN) console.log("Testing BGPalerter configuration. WARNING: remove -t option for production monitoring.");
const Worker = require("./src/worker").default;
Expand Down
Loading

0 comments on commit 482cb0c

Please sign in to comment.