thatstatsguy commented on code in PR #177:
URL: https://github.com/apache/arrow-cookbook/pull/177#discussion_r846670172


##########
python/source/flight.rst:
##########
@@ -605,3 +605,102 @@ Or if we use the wrong credentials on login, we also get 
an error:
     server.shutdown()
 
 .. _(HTTP) basic authentication: 
https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication#basic_authentication_scheme
+
+Authentication with certificates
+=================================
+
+Following on from the previous scenario where traffic to the server is managed 
via a username and password, 
+HTTPS (more specifically TLS) communication allows an additional layer of 
security by encrypting messages
+between the client and server. This is achieved using certificates. During 
development, the easiest 
+approach is developing with self-signed certificates. At startup, the server 
loads the public and private 
+key and the client client authenticates itself to the server with a public key.
+
+.. note:: In production environments it is recommended to make use of a 
certificate signed by a certificate authority.
+.. note:: This tutorial uses Windows to create a self-signed certificate. For 
Linux environments, other methods such as OpenSSL can be used.
+
+**Step 1 - Generating the Self Signed Certificate**  
+
+To generate a self-signed certificate, run command prompt as administrator and 
run the following commands.
+.. testcode::
+    dotnet dev-certs https --trust
+    dotnet dev-certs https -ep "<CertificateName>.pfx" -p <CertificatePassword>
+
+You will receive a prompt asking you confirm that you would like to trust this 
certificate, select yes. 
+You now have a self-signed certificate that your local environment trusts.
+
+**Step 2 - Converting the .pfx file into public and private keys** 
+
+Since `dotnet dev-certs` does not let you export Public and Private keys 
directly we need to convert the .pfx file. 
+There are several way to achieve this and this tutorial uses OpenSSL (using 
Windows Subsystem for Linux) 
+to perform the conversion as per this `IBM article`_.
+
+**Step 3 - Running a server with tls enabled**
+
+We're going to use the pyarrow server example available on the `GitHub repo`_. 
To run the server with TLS enabled, the python script should be 
+called with the path to the public and private keys.
+.. testcode::
+    python server.py --tls CERTFILE <PathToPublicCertificate> --tls KEYFILE 
<PathToPrivateKey>

Review Comment:
   Have put in a minimal server example. I removed all overrides except the 
code required to receive information from the client. Let me know if that's fine



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to