Skip to content

Commit

Permalink
v0.1.5: Add support for client TLS authentication, move to blocking r…
Browse files Browse the repository at this point in the history
…eqwest client (#4)

* v0.1.5: Use blocking reqwest, add support for client TLS auth

* v0.1.5: Update documentation
  • Loading branch information
kedare authored Sep 9, 2021
1 parent eb370b3 commit 112e01c
Show file tree
Hide file tree
Showing 9 changed files with 258 additions and 180 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.idea/
/target
tarpaulin-report.*
tarpaulin-report.*
*.log
152 changes: 70 additions & 82 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "netbox2netshot"
version = "0.1.4"
version = "0.1.5"
authors = ["Mathieu Poussin <mpoussin@scaleway.com>"]
edition = "2018"
description = "Synchronization tool between netbox and netshot"
Expand All @@ -15,9 +15,8 @@ serde = { version = "1.0.125", features = ["derive"]}
structopt = "0.3"
log = "0.4"
flexi_logger = "0.17"
reqwest = { version = "0.11", features = ["json"]}
tokio = { version = "1", features = ["full"] }
anyhow = "1.0"
reqwest = { version = "0.11", features = ["json", "native-tls", "blocking"]}
anyhow = { version = "1.0", features = ["backtrace"]}

[dev-dependencies]
mockito = "0.30"
Expand Down
32 changes: 27 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,18 @@ OPTIONS:
--netbox-proxy <netbox-proxy>
HTTP(s) proxy to use to connect to Netbox [env: NETBOX_PROXY=]

--netbox-token <netbox-token> The Netbox token [env: NETBOX_TOKEN] [default: ]
--netbox-url <netbox-url> The Netbox API URL [env: NETBOX_URL=]
--netbox-tls-client-certificate <netbox-tls-client-certificate>
The TLS certificate to use to authenticate to Netbox (PKCS12 format) [env: NETBOX_TLS_CLIENT_CERTIFICATE=]

--netbox-tls-client-certificate-password <netbox-tls-client-certificate-password>
The optional password for the netbox PKCS12 file [env: NETBOX_TLS_CLIENT_CERTIFICATE_PASSWORD=]

--netbox-token <netbox-token>
The Netbox token [env: NETBOX_TOKEN]

--netbox-url <netbox-url>
The Netbox API URL [env: NETBOX_URL=]

--netbox-vms-filter <netbox-vms-filter>
The querystring to use to select the VM from netbox [env: NETBOX_VMS_FILTER=]

Expand All @@ -47,13 +57,25 @@ OPTIONS:
--netshot-proxy <netshot-proxy>
HTTP(s) proxy to use to connect to Netshot [env: NETSHOT_PROXY=]

--netshot-token <netshot-token> The Netshot token [env: NETSHOT_TOKEN]
--netshot-url <netshot-url> The Netshot API URL [env: NETSHOT_URL=]
```
--netshot-tls-client-certificate <netshot-tls-client-certificate>
The TLS certificate to use to authenticate to Netshot (PKCS12 format) [env: NETSHOT_TLS_CLIENT_CERTIFICATE=]

--netshot-tls-client-certificate-password <netshot-tls-client-certificate-password>
The optional password for the netshot PKCS12 file [env: NETSHOT_TLS_CLIENT_CERTIFICATE_PASSWORD=]

--netshot-token <netshot-token>
The Netshot token [env: NETSHOT_TOKEN]

--netshot-url <netshot-url>
The Netshot API URL [env: NETSHOT_URL=]```
The query-string format need to be like this (url query string without the `?`):
```bash
status=active&platform=cisco-ios&platform=cisco-ios-xe&platform=cisco-ios-xr&platform=cisco-nx-os&platform=juniper-junos&has_primary_ip=true&tenant_group=network
```
If you plan to use TLS authentication, please provide a PKCS12 formatted identity file (.pfx or .p12), they can be created from .pem/.key/.crt using the following command:
```bash
openssl pkcs12 -export -out my.pfx -inkey my.key -in my.crt
```
Loading

0 comments on commit 112e01c

Please sign in to comment.