Skip to content

Commit

Permalink
Updated to fix issues with OPNsense API, re-wrote some of the other
Browse files Browse the repository at this point in the history
functions as well and swithed to configparser
  • Loading branch information
Richie Crews committed Sep 10, 2022
1 parent 0324684 commit e307527
Show file tree
Hide file tree
Showing 7 changed files with 146 additions and 297 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
config.yml
config.ini
62 changes: 27 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,12 @@

This is a script that makes an API connection to OPNsense and checks if there is any pending updates and if there are, it sends a message with details.

Based on the script by Bart J. Smit, 'ObecalpEffect' and Franco Fichtner, forked from https://github.com/bartsmit/opnsense-update-email.

Based on the script from Bryce Torcello, forked from https://github.com/losuler/opnsense-update-notify.
Idea is based on the script from Bryce Torcello, forked from https://github.com/losuler/opnsense-update-notify.


## TODO

- [ ] Add SMTP AUTH
- [ ] Add SMTP SSL
- [ ] Add SMTP Port

- TBD

## Setup

Expand All @@ -47,54 +42,51 @@ It's recommended to create a user with access restricted to the API endpoints re

## Config

The configuration file `config.yml` has three main sections (see `config.yml.example`). The already filled in values in the example config are the defaults.
The configuration file `config.ini` has three main sections (see `config.ini.example`). The already filled in values in the example config are the defaults.

### OPNsense

```yaml
opnsense:
host:
self_signed: true
api_key:
api_secret:
```ini
[opnsense]
url:
self_signed: true
api_key:
api_secret:
```

`host` is either the ip address or hostname of the OPNsense web interface.
** REQUIRED ** `url` is the full url (https://<IP or DNS NAME>/api/core/firmware/status) to the OPNsense web api interface.

`self_signed` refers to whether the TLS certificate is self signed or not, it maybe be either `true` or `false`. Since OPNsense creates it's own self signed cert by default, the default for this value is `true`.
** REQUIRED ** `self_signed` refers to whether the TLS certificate is self signed or not, it maybe be either `true` or `false`. Since OPNsense creates it's own self signed cert by default, the default for this value is `true`.

`api_key` and `api_secret` refers to the values provided in step 5 of the [Setup](#setup) section above.
** REQUIRED ** `api_key` and `api_secret` refers to the values provided in step 5 of the [Setup](#setup) section above.

### Emitters

```yaml
emitter: telegram
emitter: email
```ini
[emitter]
emitter: [pushover or telegram]
```

The `emitter` refers to one of the message services listed in the subsections below (only Telegram and Email for now).
** REQUIRED ** The `emitter` refers to one of the message services listed in the subsections below (only Telegram or Pushover for now, request more via issues). To use more than one supported emitter just create a new line after `emitter:` and indent for each desired emitter to be used.

#### Email
#### Pushover

```yaml
email:
from:
to:
host:
```ini
[pushover]
app_token:
user_token:
```

`from` is the Email address you want to tag as FROM when notifications are sent.

`to` is the Email address you want to tag as TO when notifications are sent to be received.
`app_token` is the custom application created for Pushover.

`host` is the SMTP host (TBD add auth and port).
`user_token` is the user token for your Pushover account.

#### Telegram

```yaml
telegram:
token:
chatid:
```ini
[telegram]
token:
chatid:
```

`token` is the token for the Telegram bot, which is provided by creating a bot by following the steps provided in the [Telegram bot API documentation](https://core.telegram.org/bots#3-how-do-i-create-a-bot).
Expand Down
21 changes: 0 additions & 21 deletions config.yml.example

This file was deleted.

Loading

0 comments on commit e307527

Please sign in to comment.