Skip to content

Commit 38f0314

Browse files
committed
docs: update mTLS update docs
1 parent b9c608f commit 38f0314

File tree

1 file changed

+18
-14
lines changed

1 file changed

+18
-14
lines changed

docs/user/authentication.rst

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -68,34 +68,38 @@ mTLS - Mutual TLS Authentication (Certificate-Based Authentication)
6868

6969
The most ideal form of authentication for machine to machine communication. Follow `KB0993615 <https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0993615>`_ then:
7070

71+
7172
>>> client = ServiceNowClient(instance, cert=('/path/to/USER_x509.pem', '/path/to/USERPRIVATEKEY.key'))
7273

7374

7475
A quick example, using self-signed certificates:
7576

7677
1. Setup the CA (root) key
7778

78-
```bash
79-
# generate a root private key, if for some reason you don't have one already
80-
$ openssl genrsa -aes256 -out ca.key 2048
81-
# generate the CA certificate
82-
$ openssl req -x509 -new -nodes -key ca.key -out cert.pem -sha512 -days 365 -out cacert.pem
83-
```
79+
.. code-block:: bash
80+
81+
# generate a root private key, if for some reason you don't have one already
82+
openssl genrsa -aes256 -out ca.key 2048
83+
# generate the CA certificate
84+
openssl req -x509 -new -nodes -key ca.key -out cert.pem -sha512 -days 365 -out cacert.pem
8485
85-
2. Upload cacert.pem via /sys_ca_certificate.do
86+
2. Upload `cacert.pem` via `/sys_ca_certificate.do`
8687

8788
3. Setup the user key and CSR (we just generate them here for a POC example)
8889

89-
```bash
90-
# note: python requests (the underlying library) does not directly support keys with passwords!
91-
$ openssl req -nodes -newkey rsa:2048 -keyout USERPRIVATEKEY.key -out USERCSR.csr
92-
```
90+
.. code-block:: bash
91+
92+
openssl req -nodes -newkey rsa:2048 -keyout USERPRIVATEKEY.key -out USERCSR.csr
93+
94+
.. important::
95+
96+
Python requests (the underlying http library) does not directly support keys with passwords! See `requests#2519 <https://github.com/psf/requests/issues/2519>`_ for details.
9397

9498
4. Sign the CSR with the root, creating a X.509 for the user
9599

96-
```
97-
$ openssl x509 -req -days 365 -in USERCSR.csr -CA cacert.pem -CAkey ca.key -extfile <(printf "extendedKeyUsage=clientAuth") -out USER_x509.pem
98-
```
100+
.. code-block:: bash
101+
102+
openssl x509 -req -days 365 -in USERCSR.csr -CA cacert.pem -CAkey ca.key -extfile <(printf "extendedKeyUsage=clientAuth") -out USER_x509.pem
99103
100104
5. Attach `USER_x509.pem` to a new `/sys_user_certificate.do` record
101105

0 commit comments

Comments
 (0)