mirror of
https://github.com/nttgin/BGPalerter.git
synced 2024-05-19 06:50:08 +00:00
Merge branch 'dev' into patch-1
This commit is contained in:
@@ -4,6 +4,9 @@ FROM node:12-alpine as build
|
||||
WORKDIR /opt/bgpalerter
|
||||
COPY . .
|
||||
|
||||
# Makes the final image respect /etc/timezone configuration
|
||||
RUN apk add --no-cache tzdata
|
||||
|
||||
RUN npm install
|
||||
|
||||
ENTRYPOINT ["npm"]
|
||||
|
@@ -3,4 +3,5 @@
|
||||
* [RIPE RIS live](https://ris-live.ripe.net/)
|
||||
* [RIPEstat](http://stat.ripe.net/)
|
||||
* [NTT RPKI VRPs](https://rpki.gin.ntt.net/api/export.json)
|
||||
* [Cloudflare VRPs](https://rpki.cloudflare.com/)
|
||||
* [Cloudflare VRPs](https://rpki.cloudflare.com/)
|
||||
* [rpki-client.org VRPs](https://www.rpki-client.org/)
|
@@ -15,4 +15,9 @@ Please, let me know so I can add your company name here.
|
||||
* HEAnet (AS1213)
|
||||
* Tech Futures (AS394256)
|
||||
* Fastly (AS54113)
|
||||
* EDGOO Networks (AS47787)
|
||||
* IT.Gate (AS12779)
|
||||
* Sky (AS5607)
|
||||
* SBTAP (AS59715)
|
||||
* WiscNet (AS2381)
|
||||
* Artfiles GmbH (AS8893)
|
||||
|
@@ -17,7 +17,7 @@ Below you can see the parameters available:
|
||||
|---|---|
|
||||
|preCacheROAs| When this parameter is set to true (default), BGPalerter will download Validated ROA Payloads (VRPs) lists locally instead of using online validation. More info [here](https://github.com/massimocandela/rpki-validator).|
|
||||
|refreshVrpListMinutes| If `preCacheROAs` is set to true, this parameter allows to specify a refresh time for the VRPs lists (it has to be > 15 minutes) |
|
||||
|vrpProvider| A string indicating the provider of the VRPs list. Possible options are: `ntt` (default), `ripe`, `cloudflare`, `external`. Use external only if you wish to specify a file with `vrpFile`. More info [here](https://github.com/massimocandela/rpki-validator#options).|
|
||||
|vrpProvider| A string indicating the provider of the VRPs list. Possible options are: `ntt` (default), `cloudflare`, `rpkiclient`, `ripe`, `external`. Use external only if you wish to specify a file with `vrpFile`. More info [here](https://github.com/massimocandela/rpki-validator#options).|
|
||||
|vrpFile| A JSON file with an array of VRPs. See example below.|
|
||||
|markDataAsStaleAfterMinutes| The amount of minutes (integer) after which an unchanged VRP list is marked as stale. Set to 0 to disable the check. |
|
||||
|
||||
|
2
index.js
2
index.js
@@ -167,7 +167,7 @@ switch(params._[0]) {
|
||||
append: !!params.A,
|
||||
logger: null,
|
||||
getCurrentPrefixesList: () => {
|
||||
return Promise.resolve(yaml.safeLoad(fs.readFileSync(params.o, "utf8")));
|
||||
return Promise.resolve(yaml.load(fs.readFileSync(params.o, "utf8")));
|
||||
}
|
||||
};
|
||||
|
||||
|
1869
package-lock.json
generated
1869
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
24
package.json
24
package.json
@@ -41,12 +41,12 @@
|
||||
"measurements"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.12.10",
|
||||
"@babel/core": "^7.12.10",
|
||||
"@babel/node": "^7.12.10",
|
||||
"@babel/plugin-proposal-class-properties": "^7.12.1",
|
||||
"@babel/plugin-proposal-object-rest-spread": "^7.12.1",
|
||||
"@babel/preset-env": "^7.12.10",
|
||||
"@babel/cli": "^7.12.13",
|
||||
"@babel/core": "^7.12.13",
|
||||
"@babel/node": "^7.12.13",
|
||||
"@babel/plugin-proposal-class-properties": "^7.12.13",
|
||||
"@babel/plugin-proposal-object-rest-spread": "^7.12.13",
|
||||
"@babel/preset-env": "^7.12.13",
|
||||
"chai": "^4.2.0",
|
||||
"chai-subset": "^1.6.0",
|
||||
"mocha": "^8.2.1",
|
||||
@@ -55,7 +55,7 @@
|
||||
"syslogd": "^1.1.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"@sentry/node": "^5.27.6",
|
||||
"@sentry/node": "^6.0.4",
|
||||
"axios": "^0.21.1",
|
||||
"batch-promises": "^0.0.3",
|
||||
"brembo": "^2.0.4",
|
||||
@@ -65,17 +65,17 @@
|
||||
"inquirer": "^7.3.3",
|
||||
"ip-address": "^6.4.0",
|
||||
"ip-sub": "^1.0.17",
|
||||
"js-yaml": "^3.14.1",
|
||||
"js-yaml": "^4.0.0",
|
||||
"kafkajs": "^1.15.0",
|
||||
"md5": "^2.3.0",
|
||||
"moment": "^2.29.1",
|
||||
"nodemailer": "^6.4.16",
|
||||
"nodemailer": "^6.4.17",
|
||||
"path": "^0.12.7",
|
||||
"restify": "^8.5.1",
|
||||
"rpki-validator": "^2.2.12",
|
||||
"rpki-validator": "^2.3.0",
|
||||
"semver": "^7.3.4",
|
||||
"syslog-client": "^1.1.1",
|
||||
"ws": "^7.4.0",
|
||||
"ws": "^7.4.3",
|
||||
"yargs": "^16.2.0"
|
||||
},
|
||||
"pkg": {
|
||||
@@ -94,7 +94,7 @@
|
||||
]
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"bufferutil": "^4.0.2",
|
||||
"bufferutil": "^4.0.3",
|
||||
"utf-8-validate": "^5.0.3"
|
||||
}
|
||||
}
|
||||
|
11
src/env.js
11
src/env.js
@@ -155,7 +155,7 @@ const ymlBasicConfig = yaml.dump(config);
|
||||
|
||||
if (fs.existsSync(vector.configFile)) {
|
||||
try {
|
||||
config = yaml.safeLoad(fs.readFileSync(vector.configFile, 'utf8')) || config;
|
||||
config = yaml.load(fs.readFileSync(vector.configFile, 'utf8')) || config;
|
||||
} catch (error) {
|
||||
throw new Error("The file " + vector.configFile + " is not valid yml: " + error.message.split(":")[0]);
|
||||
}
|
||||
@@ -169,7 +169,7 @@ if (fs.existsSync(vector.configFile)) {
|
||||
})
|
||||
.then((response) => {
|
||||
fs.writeFileSync(vector.configFile, response.data);
|
||||
yaml.safeLoad(fs.readFileSync(vector.configFile, 'utf8')); // Test readability and format
|
||||
yaml.load(fs.readFileSync(vector.configFile, 'utf8')); // Test readability and format
|
||||
})
|
||||
.catch(() => {
|
||||
fs.writeFileSync(vector.configFile, ymlBasicConfig); // Download failed, write simple default config
|
||||
@@ -269,11 +269,16 @@ config.reports = (config.reports || [])
|
||||
|
||||
return {
|
||||
class: require("./reports/" + item.file).default,
|
||||
channels: [...item.channels, "software-update"],
|
||||
channels: item.channels,
|
||||
params: item.params
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
if (!config.reports.some(report => report.channels.includes("software-update"))) { // Check if software-update channel is declared
|
||||
config.reports.forEach(report => report.channels.push("software-update")); // If not, declare it everywhere
|
||||
}
|
||||
|
||||
config.connectors = config.connectors || [];
|
||||
|
||||
config.connectors.push({
|
||||
|
@@ -102,7 +102,7 @@ export default class InputYml extends Input {
|
||||
if (fs.existsSync(file)) {
|
||||
fileContent = fs.readFileSync(file, 'utf8');
|
||||
try {
|
||||
monitoredPrefixesFile = yaml.safeLoad(fileContent) || {};
|
||||
monitoredPrefixesFile = yaml.load(fileContent) || {};
|
||||
this._watchPrefixFile(file);
|
||||
} catch (error) {
|
||||
reject(new Error("The file " + prefixesFile + " is not valid yml: " + error.message.split(":")[0]));
|
||||
|
@@ -60,7 +60,9 @@ export default class reportTelegram extends ReportHTTP {
|
||||
message: `${this.name} reporting is not enabled: no botUrl provided`
|
||||
});
|
||||
this.enabled = false;
|
||||
} else if (!params.chatIds["default"]) {
|
||||
}
|
||||
|
||||
if (!params.chatIds || !params.chatIds["default"]) {
|
||||
this.logger.log({
|
||||
level: 'error',
|
||||
message: `${this.name} reporting is not enabled: no default chat id provided`
|
||||
|
@@ -15,7 +15,7 @@ export default class RpkiUtils {
|
||||
|
||||
const defaultMarkDataAsStaleAfterMinutes = 60;
|
||||
|
||||
const providers = ["ntt", "ripe", "cloudflare", "external"]; // First provider is the default one
|
||||
const providers = ["ntt", "ripe", "cloudflare", "rpkiclient", "external"]; // First provider is the default one
|
||||
|
||||
if (this.params.vrpFile) {
|
||||
this.params.vrpProvider = "external";
|
||||
|
@@ -70,8 +70,8 @@ describe("Prefix List", function() {
|
||||
const result = fs.readFileSync(outputFile, 'utf8');
|
||||
fs.unlinkSync(outputFile);
|
||||
const original = fs.readFileSync(originalFile, 'utf8');
|
||||
const resultJson = yaml.safeLoad(result) || {};
|
||||
const originalJson = yaml.safeLoad(original) || {};
|
||||
const resultJson = yaml.load(result) || {};
|
||||
const originalJson = yaml.load(original) || {};
|
||||
|
||||
expect(resultJson).to.contain.keys(Object.keys(originalJson));
|
||||
expect(Object.keys(resultJson).length).to.equal(Object.keys(originalJson).length);
|
||||
@@ -109,8 +109,8 @@ describe("Prefix List", function() {
|
||||
const result = fs.readFileSync(outputFile, 'utf8');
|
||||
fs.unlinkSync(outputFile);
|
||||
const original = fs.readFileSync(originalFile, 'utf8');
|
||||
const resultJson = yaml.safeLoad(result) || {};
|
||||
const originalJson = yaml.safeLoad(original) || {};
|
||||
const resultJson = yaml.load(result) || {};
|
||||
const originalJson = yaml.load(original) || {};
|
||||
|
||||
expect(resultJson).to.contain.keys(Object.keys(originalJson));
|
||||
expect(Object.keys(resultJson).length).to.equal(Object.keys(originalJson).length);
|
||||
@@ -141,7 +141,7 @@ describe("Prefix List", function() {
|
||||
append: true,
|
||||
logger: () => {},
|
||||
getCurrentPrefixesList: () => {
|
||||
const content = yaml.safeLoad(fs.readFileSync(outputFile, "utf8"));
|
||||
const content = yaml.load(fs.readFileSync(outputFile, "utf8"));
|
||||
return Promise.resolve(content);
|
||||
}
|
||||
}
|
||||
@@ -154,8 +154,8 @@ describe("Prefix List", function() {
|
||||
const result = fs.readFileSync(outputFile, 'utf8');
|
||||
fs.unlinkSync(outputFile);
|
||||
const original = fs.readFileSync(originalFile, 'utf8');
|
||||
const resultJson = yaml.safeLoad(result) || {};
|
||||
const originalJson = yaml.safeLoad(original) || {};
|
||||
const resultJson = yaml.load(result) || {};
|
||||
const originalJson = yaml.load(original) || {};
|
||||
|
||||
expect(resultJson).to.contain.keys(Object.keys(originalJson));
|
||||
expect(Object.keys(resultJson).length).to.equal(Object.keys(originalJson).length);
|
||||
|
Reference in New Issue
Block a user