Skip to content

Commit 9d26683

Browse files
committed
doc(grpc): secure channels
1 parent 014385a commit 9d26683

File tree

3 files changed

+103
-0
lines changed

3 files changed

+103
-0
lines changed
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
Generating certificates
2+
=======================
3+
4+
With the release of Ansys product service packs adding enhanced security to
5+
gRPC communication, the PyAnsys ecosystem enables various transport modes for
6+
securing gRPC connections. Mutual TLS (mTLS) is one such mode that provides
7+
secure communication by requiring both the client and server to authenticate
8+
each other using digital certificates.
9+
10+
.. important::
11+
12+
As a user,y ou are responsible for managing and securing your own certificates.
13+
14+
`OpenSSL <https://www.openssl.org/>`__ can be used to generate the necessary
15+
certificates for mTLS. The following files are required for both the server and
16+
the client:
17+
18+
.. table::
19+
:widths: auto
20+
21+
====== ======================= ==========================================
22+
Side Required Files Purpose
23+
====== ======================= ==========================================
24+
Server server.crt Server identity
25+
server.key Server private key
26+
ca.crt To verify client certificates
27+
Client client.crt Client identity
28+
client.key Client private key
29+
ca.crt To verify server certificates
30+
====== ======================= ==========================================
31+
32+
Generate a certificate authority
33+
--------------------------------
34+
35+
.. code-block:: bash
36+
37+
# Generate private key for CA
38+
openssl genrsa -out ca.key 4096
39+
40+
# Generate self-signed CA certificate
41+
openssl req -x509 -new -nodes -key ca.key -sha256 -days 3650 -out ca.crt \
42+
-subj "/CN=MyRootCA"
43+
44+
Generate the server certificate
45+
-------------------------------
46+
47+
.. code-block:: bash
48+
49+
# Generate server private key
50+
openssl genrsa -out server.key 4096
51+
52+
# Generate a certificate signing request (CSR) for the server
53+
openssl req -new -key server.key -out server.csr \
54+
-subj "/CN=localhost"
55+
56+
# Generate server certificate signed by the CA
57+
openssl x509 -req -in server.csr -CA ca.crt -CAkey ca.key -CAcreateserial \
58+
-out server.crt -days 365 -sha256
59+
60+
Generate the client certificate
61+
-------------------------------
62+
63+
.. code-block:: bash
64+
65+
# Generate client private key
66+
openssl genrsa -out client.key 4096
67+
68+
# Generate a certificate signing request (CSR) for the client
69+
openssl req -new -key client.key -out client.csr \
70+
-subj "/CN=grpc-client"
71+
72+
# Generate client certificate signed by the CA
73+
openssl x509 -req -in client.csr -CA ca.crt -CAkey ca.key -CAcreateserial \
74+
-out client.crt -days 365 -sha256
75+
76+
Verify certificates
77+
-------------------
78+
79+
.. code-block:: bash
80+
81+
# Verify server certificate
82+
openssl verify -CAfile ca.crt server.crt
83+
84+
# Verify client certificate
85+
openssl verify -CAfile ca.crt client.crt

doc/source/how-to/grpc-api-packages.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,23 @@ underlying implementations.
276276
For each client library release, only a single gRPC API version should be wrapped
277277
to maintain a consistent API abstraction expectation for the supporting server instances.
278278

279+
Securing connections
280+
~~~~~~~~~~~~~~~~~~~~
281+
282+
It is possible to secure connections between the Python client library and the
283+
product servers.
284+
285+
For developers, use the `cyberchannel`_ module provided in the
286+
`ansys-tools-common`_ to implement secure connections. This ensures compliance
287+
with the latest security standards defined by PyAnsys.
288+
289+
For users, refer to the `certificates`_ section for creating and managing
290+
all necessary certificates for secure connections.
291+
292+
.. _cyberchannel: https://tools.docs.pyansys.com/version/stable/user_guide/secure_grpc.html#the-cyberchannel-module
293+
.. _ansys-tools-common: https://tools.docs.pyansys.com
294+
.. _certificates: https://tools.docs.pyansys.com/version/0.3/user_guide/secure_grpc.html#generating-certificates-for-mtls
295+
279296
Public versus private Python API package
280297
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
281298

doc/source/how-to/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ and app APIs.
122122
contributing
123123
packaging
124124
grpc-api-packages
125+
generating-certificates
125126
logging
126127
documenting
127128
testing

0 commit comments

Comments
 (0)