|
| 1 | +# Have I Been Pwned Notifier |
| 2 | +Notifies users when their details have been in a data breach based on the HIBP API. |
| 3 | + |
| 4 | +## How it works |
| 5 | +1. Checks the HIBP API to see what the latest breach is |
| 6 | +2. If the breach is the one mentioned in the configuration file, exit |
| 7 | +3. If it is a new breach, get all breached users from the domains endpoint for all domains in the config |
| 8 | +4. Check if a user has been in a breach that is not in the "notifiedBreaches" list |
| 9 | +5. If they're in that list, send them an email with the new breach and a list of old breaches their account has been in as well |
| 10 | + |
| 11 | +## Configuration |
| 12 | +```json |
| 13 | +{ |
| 14 | + # Have I been Pwned API Key |
| 15 | + "hibpApiKey": "", |
| 16 | + |
| 17 | + # Domains to check for breaches |
| 18 | + # All domains here have to be verified on the HIBP dashboard before usage |
| 19 | + "domains": [ |
| 20 | + "domain.com" |
| 21 | + ], |
| 22 | + |
| 23 | + # The latest breach that the script has notified users about |
| 24 | + "latestBreach": "VTech", |
| 25 | + |
| 26 | + # Breaches that the script has already notified users about |
| 27 | + "notifiedBreaches": [ |
| 28 | + "Spytech", |
| 29 | + "Adobe", |
| 30 | + "Badoo", |
| 31 | + "Kickstarter", |
| 32 | + "MyFitnessPal" |
| 33 | + ], |
| 34 | + |
| 35 | + # SMTP Settings |
| 36 | + "smtp": { |
| 37 | + "sender": "mailer@domain.com", |
| 38 | + "host": "smtp.domain.com", |
| 39 | + "port": 25, |
| 40 | + "secure": false, |
| 41 | + "starttls": true, |
| 42 | + "user": "username", |
| 43 | + "pass": "password" |
| 44 | + }, |
| 45 | + |
| 46 | + # Ignore breaches of certain types |
| 47 | + # To read more, visit https://haveibeenpwned.com/API/v3#BreachModel |
| 48 | + "ignore": { |
| 49 | + "unverified": false, |
| 50 | + "fabricated": false, |
| 51 | + "sensitive": false, |
| 52 | + "retired": false, |
| 53 | + "spamList": false, |
| 54 | + "malware": false |
| 55 | + }, |
| 56 | + |
| 57 | + # Settings for colors and texts in the email sent to the users |
| 58 | + # You can also provide your own custom email template. For substitutions, check below |
| 59 | + "email": { |
| 60 | + "colors": { |
| 61 | + "background": "#ff8000", |
| 62 | + "text": "#ffffff" |
| 63 | + }, |
| 64 | + "subject": "Your account might have been compromised", |
| 65 | + "body": { |
| 66 | + "header": "Your account might have been compromised", |
| 67 | + "texts": [ |
| 68 | + "In a recent scan, we found that your email address was mentioned in a recent breach of user information.", |
| 69 | + "This does not necessarily mean that your password has been compromised, but for security reasons we do recommend that you change it.", |
| 70 | + "For more information about the breach, click one of the links next to the relevant breaches below." |
| 71 | + ], |
| 72 | + "previous_breach_texts": [ |
| 73 | + "Your account has also been in previous, older breaches. You can find a complete list below." |
| 74 | + ] |
| 75 | + } |
| 76 | + } |
| 77 | +} |
| 78 | +``` |
| 79 | + |
| 80 | + |
| 81 | +## Email Template Substitutions |
| 82 | +| Placeholder | Description | Example | Value From | |
| 83 | +|-------------|-------------|---------|------------| |
| 84 | +| `{{text_color}}` | The color of the text in the email | `#ffffff` | config.json | |
| 85 | +| `{{bg_color}}` | The color of the background in the email | `#ff8000` | config.json | |
| 86 | +| `{{body_text}}` | The body text section from the configuration file | `In a recent scan, we found that your email address was mentioned in a recent breach of user information.` | config.json | |
| 87 | +| `{{previous_breaches_text}}` | The text that is shown before the list of previous breaches | `Your account has also been in previous, older breaches. You can find a complete list below.` | config.json | |
| 88 | +| `{{username}}` | The email of the user that was in the breach | `user@domain.com` | HIBP API | |
| 89 | +| `{{new_breach_rows}}` | The list of new breaches that the user was in | `<tr><td>BreachA</td><td>Link to BreachA</td></tr>` | HIBP API | |
| 90 | +| `{{previous_breaches_rows}}` | The list of previous breaches that the user was in | `<tr><td>BreachA</td><td>Link to BreachA</td></tr>` | HIBP API | |
0 commit comments