Skip to content

Commit 112e01c

Browse files
authored
v0.1.5: Add support for client TLS authentication, move to blocking reqwest client (#4)
* v0.1.5: Use blocking reqwest, add support for client TLS auth * v0.1.5: Update documentation
1 parent eb370b3 commit 112e01c

File tree

9 files changed

+258
-180
lines changed

9 files changed

+258
-180
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
.idea/
22
/target
3-
tarpaulin-report.*
3+
tarpaulin-report.*
4+
*.log

Cargo.lock

Lines changed: 70 additions & 82 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "netbox2netshot"
3-
version = "0.1.4"
3+
version = "0.1.5"
44
authors = ["Mathieu Poussin <[email protected]>"]
55
edition = "2018"
66
description = "Synchronization tool between netbox and netshot"
@@ -15,9 +15,8 @@ serde = { version = "1.0.125", features = ["derive"]}
1515
structopt = "0.3"
1616
log = "0.4"
1717
flexi_logger = "0.17"
18-
reqwest = { version = "0.11", features = ["json"]}
19-
tokio = { version = "1", features = ["full"] }
20-
anyhow = "1.0"
18+
reqwest = { version = "0.11", features = ["json", "native-tls", "blocking"]}
19+
anyhow = { version = "1.0", features = ["backtrace"]}
2120

2221
[dev-dependencies]
2322
mockito = "0.30"

README.md

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,18 @@ OPTIONS:
3636
--netbox-proxy <netbox-proxy>
3737
HTTP(s) proxy to use to connect to Netbox [env: NETBOX_PROXY=]
3838

39-
--netbox-token <netbox-token> The Netbox token [env: NETBOX_TOKEN] [default: ]
40-
--netbox-url <netbox-url> The Netbox API URL [env: NETBOX_URL=]
39+
--netbox-tls-client-certificate <netbox-tls-client-certificate>
40+
The TLS certificate to use to authenticate to Netbox (PKCS12 format) [env: NETBOX_TLS_CLIENT_CERTIFICATE=]
41+
42+
--netbox-tls-client-certificate-password <netbox-tls-client-certificate-password>
43+
The optional password for the netbox PKCS12 file [env: NETBOX_TLS_CLIENT_CERTIFICATE_PASSWORD=]
44+
45+
--netbox-token <netbox-token>
46+
The Netbox token [env: NETBOX_TOKEN]
47+
48+
--netbox-url <netbox-url>
49+
The Netbox API URL [env: NETBOX_URL=]
50+
4151
--netbox-vms-filter <netbox-vms-filter>
4252
The querystring to use to select the VM from netbox [env: NETBOX_VMS_FILTER=]
4353

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

50-
--netshot-token <netshot-token> The Netshot token [env: NETSHOT_TOKEN]
51-
--netshot-url <netshot-url> The Netshot API URL [env: NETSHOT_URL=]
52-
```
60+
--netshot-tls-client-certificate <netshot-tls-client-certificate>
61+
The TLS certificate to use to authenticate to Netshot (PKCS12 format) [env: NETSHOT_TLS_CLIENT_CERTIFICATE=]
62+
63+
--netshot-tls-client-certificate-password <netshot-tls-client-certificate-password>
64+
The optional password for the netshot PKCS12 file [env: NETSHOT_TLS_CLIENT_CERTIFICATE_PASSWORD=]
65+
66+
--netshot-token <netshot-token>
67+
The Netshot token [env: NETSHOT_TOKEN]
68+
69+
--netshot-url <netshot-url>
70+
The Netshot API URL [env: NETSHOT_URL=]```
5371
5472
The query-string format need to be like this (url query string without the `?`):
5573
5674
```bash
5775
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
5876
```
5977
78+
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:
79+
```bash
80+
openssl pkcs12 -export -out my.pfx -inkey my.key -in my.crt
81+
```

0 commit comments

Comments
 (0)