Skip to content

Commit

Permalink
Fixes RTD code blocks (thinkst#195)
Browse files Browse the repository at this point in the history
* Fixes RTD code blocks

* Fixes whitespace

* Fixes YAML structure
  • Loading branch information
joewesch committed Jun 29, 2022
1 parent 354d090 commit 78e124c
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 61 deletions.
82 changes: 43 additions & 39 deletions docs/alerts/webhook.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,17 @@ The following configuration options are optional:

Here is a basic configuration:

```json
"handlers": {
"Webhook": {
"class": "opencanary.logger.WebhookHandler",
"url": "http://domain.example.com/path",
"method": "POST",
"data": {"message": "%(message)s"},
"status_code": 200
.. code-block:: json
"handlers": {
"Webhook": {
"class": "opencanary.logger.WebhookHandler",
"url": "http://domain.example.com/path",
"method": "POST",
"data": {"message": "%(message)s"},
"status_code": 200
}
}
}
```
## Advanced Usage

Expand All @@ -42,54 +42,58 @@ The data payload that is sent to Python Requests can be as complex as your use c

For example, you can move the message to a nested section of the data payload:

```json
"data":{
"title": "OpenCanary Alert",
"data": {
"alert": "%(message)s"
.. code-block:: json
"data":{
"title": "OpenCanary Alert",
"data": {
"alert": "%(message)s"
}
}
}
```
### Advanced Ignore

The ignore option is just a list of strings that will not emit any log message that contains the pattern.

For example, if you use the following ignore list:

```json
"ignore": ["192.0.2."]
```
.. code-block:: json
"ignore": ["192.0.2."]
The following logs will drop:

```json
{"dst_host": "192.0.2.5", "dst_port": ...}
{"src_host": "192.0.2.20", "src_port": ...}
```
.. code-block:: json
{"dst_host": "192.0.2.5", "dst_port": ...}
{"src_host": "192.0.2.20", "src_port": ...}
### Advanced Additional Options

In addition to the options listed above, you can include any extra options that you may need in your HTTP request. These options are directly passed to `requests.request()`. Below I have included a few examples, but for a full list of options please see the [official documentation](https://docs.python-requests.org/en/latest/api/#requests.request).

Add headers:
```json
"headers": {
"Authorization": "Bearer 12345",
"Content-Type": "application/json"
}
```

.. code-block:: json
"headers": {
"Authorization": "Bearer 12345",
"Content-Type": "application/json"
}
> Note: If your data payload needs to be JSON serialized, you must include the `"Content-Type": "application/json"` (case sensitive) header.

Add query parameters. For example to add `?test=yes&redirect=no` you would use:
```json
"params": {
"test": "yes",
"redirect": "no"
}
```

.. code-block:: json
"params": {
"test": "yes",
"redirect": "no"
}
Disable SSL verification
```json
"verify": False
```

.. code-block:: json
"verify": False
44 changes: 22 additions & 22 deletions docs/starting/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -131,39 +131,39 @@ You can use environment variables in the configuration file to pass confidential

For example on your host machine you would export your password:

```bash
export TELNET_PASSWORD=TopsyKretts
```
.. code-block:: sh
export TELNET_PASSWORD=TopsyKretts
And in your config file you would reference it by name proceeded by a dollar sign (`$`):

```python
"telnet.honeycreds": [
{
"username": "admin",
"password": "$TELNET_PASSWORD"
}
]
```
.. code-block:: python
"telnet.honeycreds": [
{
"username": "admin",
"password": "$TELNET_PASSWORD"
}
]
> Note: For Windows, you can also use `%TELNET_PASSWORD%`

If you are using the Docker version, you would need to pass the environment variable to the container as well as part of the run command:

```bash
docker run -e TELNET_PASSWORD ...
```
.. code-block:: sh
docker run -e TELNET_PASSWORD ...
For Docker Compose, you would need to add it to the service definition:

```yaml
service:
opencanary:
image: "..."
environment:
- TELNET_PASSWORD
...
```
.. code-block:: yaml
service:
opencanary:
image: "..."
environment:
- TELNET_PASSWORD
...
Default Configuration
---------------------
Expand Down

0 comments on commit 78e124c

Please sign in to comment.