Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: fix Postgre DSN sample #8774

Merged
merged 1 commit into from
Apr 14, 2024

Conversation

kenjis
Copy link
Member

@kenjis kenjis commented Apr 13, 2024

Description
See #8771

The following setting

'DSN' => 'Postgre://postgres:postgres@localhost:5432/test?charset=utf8&connect_timeout=5&sslmode=1',    

causes the error:

CodeIgniter\Database\Exceptions\DatabaseException: Unable to connect to the database.
Main connection [Postgre]: pg_connect(): Unable to connect to PostgreSQL server: invalid sslmode value: "1"

See "Table 33.1. SSL Mode Descriptions"
in https://www.postgresql.org/docs/12/libpq-ssl.html#LIBPQ-SSL-PROTECTION

Checklist:

  • Securely signed commits
  • [] Component(s) with PHPDoc blocks, only if necessary or adds value
  • [] Unit testing, with >80% coverage
  • User guide updated
  • [] Conforms to style guide

@kenjis kenjis added the documentation Pull requests for documentation only label Apr 13, 2024
Copy link
Contributor

@datamweb datamweb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any statistics to know what percentage of servers have ssl configuration set as default.

@kenjis
Copy link
Member Author

kenjis commented Apr 14, 2024

I have confirmed the following works:
'DSN' => 'Postgre://postgres:postgres@localhost:5432/test?charset=utf8&connect_timeout=5&sslmode=disable',

@kenjis
Copy link
Member Author

kenjis commented Apr 14, 2024

By Claude 3 Haiku:
Unfortunately, I do not have access to comprehensive statistics on the percentage of PostgreSQL servers that have SSL/TLS configuration set as the default. The usage of SSL/TLS in PostgreSQL deployments can vary widely depending on factors such as industry, organization size, security requirements, and geographic region.

However, here are a few insights that may be helpful:

  1. PostgreSQL Documentation Recommendation: The official PostgreSQL documentation strongly recommends using SSL/TLS for all client-server communications, stating that "it is strongly recommended that all PostgreSQL installations use SSL connections by default."

  2. Industry Trends and Compliance: Many industries, such as finance, healthcare, and government, have regulatory requirements that mandate the use of encryption for data in transit, including database connections. This has likely driven increased adoption of SSL/TLS in PostgreSQL deployments within these sectors.

  3. Open-Source Community Practices: The PostgreSQL open-source community is generally security-conscious and tends to advocate for the use of SSL/TLS. Many PostgreSQL deployment guides and best practices recommend enabling SSL/TLS by default.

  4. Cloud-based PostgreSQL Services: Cloud-based PostgreSQL services, such as Amazon RDS for PostgreSQL and Google Cloud SQL for PostgreSQL, often have SSL/TLS encryption enabled by default to meet security standards and provide a more secure out-of-the-box experience.

While precise statistics are not readily available, it is safe to assume that the adoption of SSL/TLS in PostgreSQL deployments has been steadily increasing over time, driven by industry trends, compliance requirements, and security-conscious best practices. However, the actual percentage can vary significantly depending on the specific use case and deployment environment.

@kenjis
Copy link
Member Author

kenjis commented Apr 14, 2024

By default, RDS for PostgreSQL uses and expects all clients to connect using SSL/TLS, but you can also require it. RDS for PostgreSQL supports Transport Layer Security (TLS) versions 1.1, 1.2, and 1.3.
https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/PostgreSQL.Concepts.General.SSL.html

@kenjis kenjis merged commit 3b12c44 into codeigniter4:develop Apr 14, 2024
8 checks passed
@kenjis kenjis deleted the docs-fix-Postgre-DSN branch April 14, 2024 02:18
@kenjis kenjis added the bug Verified issues on the current code behavior or pull requests that will fix them label Apr 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Verified issues on the current code behavior or pull requests that will fix them documentation Pull requests for documentation only
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants