cary huang: TLS setup on Postgres 15 – Common Practice

原文英文,约1100词,阅读约需4分钟。发表于:

1.0 Introduction TLS is one of the most commonly used security protocol in most applications but also least understood. In this blog, I will briefly explain the concept of TLS and how it can be configured to Postgres version 15 compiled with compatible OpenSSL library. 2.0 PostgreSQL Server Side Settings These are the TLS settings available in postgresql.conf related to TLS. Note that these parameters start with prefix SSL, which is a term used interchangeably with TLS (which is a newer term). Both refer to the same thing. #ssl = off #ssl_ca_file = '' #ssl_cert_file = 'server.crt' #ssl_crl_file = '' #ssl_crl_dir = '' #ssl_key_file = 'server.key' #ssl_ciphers = 'HIGH:MEDIUM:+3DES:!aNULL' # allowed SSL ciphers #ssl_prefer_server_ciphers = on #ssl_ecdh_curve = 'prime256v1' #ssl_min_protocol_version = 'TLSv1.2' #ssl_max_protocol_version = '' #ssl_dh_params_file = '' #ssl_passphrase_command = '' #ssl_passphrase_command_supports_reload = off Most of the time, you just need to fill in ssl, ssl_ca_file, ssl_cert_file, ssl_key_file and possibly ssl_passphrase_command. For example: ssl = on ssl_ca_file = '/home/user/cert/cacert.pem' ssl_cert_file = '/home/user/cert/server.pem' ssl_key_file = '/home/user/cert/server.key' ssl_passphrase_command = 'echo passphrase' These basic TLS parameters tell Postgres that you would like to enable TLS on your server and provide paths to Certificate Authority (CA) certificate file, entity certificate file and a private key file. These 3 files are normally referred as X509 certificates and are mainly used to guarantee trust between a client and a server. the CA certificate file (ssl_ca_file) is the root of trust and you can use openssl to generate one for your organization and use it to create and sign other entity certificates for your application to use. the entity certificate (ssl_cert_file) and private key (ssl_key_file) form a pair, in a sense that the certificate itself contains a public key while the private key file contains the private key. These keys[...]

TLS是最常用的安全协议,本文将简要介绍TLS的概念,以及如何在Postgres 15版本中配置TLS,需要填写ssl、ssl_ca_file、ssl_cert_file、ssl_key_file和ssl_passphrase_command等参数,并使用openssl生成和签署证书文件,还需要配置pg_hba.conf,以控制哪些连接需要TLS,哪些不需要,客户端连接时,需要指定证书和CA证书,以验证服务器证书。

cary huang: TLS setup on Postgres 15 – Common Practice
相关推荐 去reddit讨论
  1. Google 发布「AI 全家桶」反击 GPT-4o !搜索引擎罕见大更新, 121 句「AI」道尽焦虑
    Google在Google I/O发布会上推出了多种新产品和升级,包括Gemini大模型、Gemma多模态大模型、AI in Google Workspa...
  2. 简单是优势,但为何复杂性还受欢迎?
    文章探讨了简单性和复杂性的优劣。复杂性在某些情况下更受欢迎,因为它传达了努力、精通和创新的信号。然而,简单性更易理解、使用、构建和维护,具有较低的运营成本...
  3. 一目十行:上下文快速阅读法
    基于上下文关系的阅读方法强调理解文本的整体语境,通过识别句子、段落甚至整篇文章中的逻辑关系和线索,来解读文本的含义。实践方法包括上下文预测、语境线索、重点...
  4. 太贴心!OpenAI发布了类人化重大版本:GPT-4o
    OpenAI发布了GPT-4o,具有实时翻译、情绪检测、语音指令理解、声音合成和图像理解等功能。GPT-4o将通过API免费提供给用户。OpenAI还发布...
  5. Python中读写Parquet文件的方法
    Apache Parquet是一种流行的列式存储格式,使用pyarrow包可以轻松读写Parquet文件。可以转换DataFrame为Parquet文件,...
  6. 使用 braft 构建应用,应该关注哪些指标?
    本文介绍了使用braft构建应用时需要关注的指标。braft是一个C++ raft框架,开发者可以基于其抽象接口实现自己的业务逻辑。文章从metrics入...
  7. Python读取NetCDF文件-裁剪&计算
    这篇文章介绍了使用xarray包处理NetCDF文件的方法。xarray是基于pandas的数据结构构建的,可以方便地处理多维数组数据。文章还介绍了如何根...
  8. How to Use Stable Diffusion Effectively
    稳定扩散是一个由多个组件和参数组成的流水线,它们共同工作产生输出。模型是流水线中最重要的组件之一,不同版本的模型会对输出产生不同影响。选择合适的模型、采样...
  9. sqlx: 一个优秀的rust异步SQL库
    Rust生态圈中的sqlx库是一个功能齐全的数据库访问和查询构建器库,支持多种数据库。它具有异步、编译时检查查询、与数据库无关、纯Rust等特点。sqlx...
  10. Python 潮流周刊#50:我最喜欢的 Python 3.13 新特性!
    本期刊共分享了12篇文章、11个开源项目和2则音视频,涵盖Python 3.13新特性、Asyncio工作原理、Python文件处理、数据科学错误、加速N...