2019-07-15 10:36:01 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# BGPalerter
 
							 
						 
					
						
							
								
									
										
										
										
											2019-09-03 22:09:35 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								[](https://travis-ci.org/nttgin/bgpalerter)
							 
						 
					
						
							
								
									
										
										
										
											2019-07-15 10:36:01 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								## TL;DR
 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-15 13:31:56 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								>  This section is useful if you don't care about the source code but you just want to run the monitor.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								If you want to know more about the source code (which is completely open) please see the following sections.
							 
						 
					
						
							
								
									
										
										
										
											2019-07-15 10:36:01 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-14 13:08:14 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								1.  Download the executable from [`bin/` ](https://github.com/nttgin/BGPalerter/tree/master/bin ) (be sure to select the one for your OS)
							 
						 
					
						
							
								
									
										
										
										
											2019-07-15 10:36:01 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-09-15 21:00:25 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								2.  Download [`config.yml` ](https://raw.githubusercontent.com/nttgin/BGPalerter/master/config.yml ) and [`prefixes.yml` ](https://raw.githubusercontent.com/nttgin/BGPalerter/master/prefixes.yml ) and place them in the same directory of the executable (if you skip this step, some default configuration files will be generated during the first execution)
							 
						 
					
						
							
								
									
										
										
										
											2019-07-15 10:36:01 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-15 11:50:33 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								3.  Modify `prefixes.yml`  and add the prefixes you want to monitor (or see below how to auto generate this file)
							 
						 
					
						
							
								
									
										
										
										
											2019-07-15 10:36:01 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-14 12:58:28 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								4.  Run the executable
							 
						 
					
						
							
								
									
										
										
										
											2019-07-15 10:36:01 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-14 12:58:28 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								5.  See the alerts in `logs/reports-YYYY-MM-DD.log` 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-15 10:36:01 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-14 11:52:41 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								In `config.yml`  you can find other reporting mechanisms (e.g. email and slack) in addition to logging to files. 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								Please uncomment the related section and configure according to your needs.
							 
						 
					
						
							
								
									
										
										
										
											2019-07-15 10:36:01 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-15 10:30:16 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								If you enable email reporting, download also the directory `reports/email_templates`  in the same directory of the executable.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-15 11:50:33 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-14 12:58:28 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								## More information for users
 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-15 10:36:01 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-15 11:50:33 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								### Auto generate prefixes.yml
 
							 
						 
					
						
							
								
									
										
										
										
											2019-09-15 21:00:25 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								To auto generate the monitored prefixes file (by default called `prefixes.yml` ) execute:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								*  If you are using the binary `./bgpalerter-linux-x64 generate -a ASN(S) -o OUTPUT_FILE`  (e.g. `./bgpalerter-linux-x64 generate -a 2914 -o test.yml` ).
							 
						 
					
						
							
								
									
										
										
										
											2019-09-17 16:50:13 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								*  If you are using the source code `npm run generate-prefixes -- --a ASN(S) --o OUTPUT_FILE`  (e.g. `npm run generate-prefixes -- --a 2914 --o nttprefixes.yml` ).
							 
						 
					
						
							
								
									
										
										
										
											2019-08-15 11:50:33 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								The script will download the currently announced prefixes of the selected AS (according to RIPEstat data). A warning will be triggered in case of not valid RPKI prefixes.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-09-17 19:26:08 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								To exclude prefixes from being monitored, add to the command `-e prefix1,prefix2` .
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-09-15 21:00:25 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								Multiple ASns can be moniotred in the same file e.g.`npm run generate-prefixes -a 2914,4713 -o nttprefixes.yml`  (see comma-separated ASns). Additionally, multiple files can be monitored by adding them under `monitoredPrefixesFiles`  in `config.yml` .
							 
						 
					
						
							
								
									
										
										
										
											2019-08-15 11:50:33 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-15 10:36:01 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								### Composition
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								You can compose the tool with 3 main components: connectors, monitors, and reports.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-14 11:52:41 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								Connectors retrieve/listen to the data from different sources and transform them to a common format.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								Monitors analyze the data flow and produce alerts. Different monitors try to detect different issues.
							 
						 
					
						
							
								
									
										
										
										
											2019-07-15 10:36:01 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								Reports send/store the alerts, e.g. by email or to a file.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								##### connectors
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								Possible connectors are:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-14 12:58:28 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								*  _connectorRIS_, for real-time data from RIPE RIS (https://ris-live.ripe.net/)
							 
						 
					
						
							
								
									
										
										
										
											2019-07-15 10:36:01 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-14 12:58:28 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								*  _connectorTest_, for testing purposes, it provokes all types of alerting
							 
						 
					
						
							
								
									
										
										
										
											2019-07-15 10:36:01 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								##### monitors
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								Possible monitors are:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-14 12:58:28 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								*  _monitorHijack_, for monitoring hijacks
							 
						 
					
						
							
								
									
										
										
										
											2019-07-15 10:36:01 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-14 11:52:41 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								*  _monitorVisibility_, for monitoring prefixes' visibility (you will get notified when withdrawals make monitored routes disappear). A threshold can be specified in config.yml to trigger an alert only if the issue is visible from a certain amount of peers.
							 
						 
					
						
							
								
									
										
										
										
											2019-07-15 10:36:01 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-14 12:58:28 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								*  _monitorNewPrefix_, for monitoring if new more specifics (of the monitored prefixes) start to be announced
							 
						 
					
						
							
								
									
										
										
										
											2019-07-15 10:36:01 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								##### reports
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								Possible reports are:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-14 11:52:41 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								*  _reportEmail_, to send alerts by email. SMTP configurations are in config.yml
							 
						 
					
						
							
								
									
										
										
										
											2019-07-15 10:36:01 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-14 11:52:41 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								*  _reportFile_, to log the alerts to files. File directory, format, and log rotation configurations are in config.yml
							 
						 
					
						
							
								
									
										
										
										
											2019-07-15 10:36:01 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-14 11:52:41 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								*  _reportSlack_, to send alerts in Slack. Hook URL is configurable in config.yml
							 
						 
					
						
							
								
									
										
										
										
											2019-07-15 10:36:01 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-14 12:58:28 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								## More information for developers
 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-15 10:36:01 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-14 11:52:41 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								To start development:
							 
						 
					
						
							
								
									
										
										
										
											2019-07-15 10:36:01 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								1.  git clone this repo
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-14 12:58:28 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								2.  install Node.js (version >= 10.16) and npm ([installing node and npm ](https://nodejs.org/en/download/ ))
							 
						 
					
						
							
								
									
										
										
										
											2019-07-15 10:36:01 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-14 12:58:28 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								3.  execute `npm install`  or `yarn`  to install all dependencies ([installing yarn ](https://yarnpkg.com/lang/en/docs/install ))
							 
						 
					
						
							
								
									
										
										
										
											2019-07-15 10:36:01 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-14 12:58:28 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								4.  run `npm run watch-and-serve`  to run the application. At every file change it will self-reload.
							 
						 
					
						
							
								
									
										
										
										
											2019-07-15 10:36:01 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-14 12:58:28 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								### All npm commands
 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-15 10:36:01 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-14 12:58:28 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								*  `npm run watch-and-serve`  to run the application from source code and monitor for file changes
							 
						 
					
						
							
								
									
										
										
										
											2019-07-15 10:36:01 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-14 12:58:28 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								*  `npm run serve`  to run the application from the source
							 
						 
					
						
							
								
									
										
										
										
											2019-07-15 10:36:01 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-14 12:58:28 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								*  `npm run test`  to run the tests
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								*  `npm run build`  to compile and build OS native applications
							 
						 
					
						
							
								
									
										
										
										
											2019-07-15 10:36:01 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-09-17 16:50:13 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								*  `npm run generate-prefixes -- --a ASN(S) --o OUTPUT_FILE`  to generate the monitored prefixes file
							 
						 
					
						
							
								
									
										
										
										
											2019-08-15 13:10:23 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-15 10:36:01 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								### Composition
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								You can compose the tool with 3 main components: connectors, monitors, and reports.
							 
						 
					
						
							
								
									
										
										
										
											2019-08-15 13:31:56 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								>  **Important:**
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								All connectors MUST extend the class Connector. Monitors extend the class Monitor. Reports extend the class Report.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								From the superclass they will inherit various generic methods while some have to be implemented.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-14 12:58:28 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								Reports don't receive only alerts but also the data that provoked such alerts (so you can store the data and replay the accident later).
							 
						 
					
						
							
								
									
										
										
										
											2019-07-15 10:36:01 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-14 12:58:28 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								In `config.yml` , for each collection of components:
							 
						 
					
						
							
								
									
										
										
										
											2019-07-15 10:36:01 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-14 12:58:28 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								*  `file`  - refers to the file name which contains the class
							 
						 
					
						
							
								
									
										
										
										
											2019-07-15 10:36:01 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-14 12:58:28 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								*  `channels`  - refer to what channel(s) will be used to send or receive messages
							 
						 
					
						
							
								
									
										
										
										
											2019-07-15 10:36:01 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-14 11:52:41 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								*  `params`  - whatever parameters may be needed by the component at creation time
							 
						 
					
						
							
								
									
										
										
										
											2019-07-15 10:36:01 +00:00