pgpasswd

command module
v0.0.0-...-0c6f18c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 22, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

README

= Encrypted PostgreSQL Password
:Author:    Oliver Eikemeier
:Email:     <eikemeier@fillmore-labs.com>
:Date:      2023-08
:Revision:  v0.1
:toc: macro

image:https://badge.buildkite.com/070c600f14498cd3d708e16c2df30e390d948c7fa9cd1a3fed.svg?branch=main[title="Buildkite build status",link=https://buildkite.com/fillmore-labs/postgresql-password/]

toc::[]

== Purpose

.The PostgreSQL https://www.postgresql.org/docs/current/sql-createrole.html[documentation] of `+CREATE ROLE+` mentions:
[quote]   
----
If the presented password string is already in MD5-encrypted or SCRAM-encrypted format, then it is stored as-is regardless of password_encryption (since the system cannot decrypt the specified encrypted password string, to encrypt it in a different format).
----

Which is not only useful during dump and restore, but also when initializing a new installation.

This is a simple tool to create SCRAM-SHA-256 encrypted passwords.

== Usage

[source,shell]
----
./pgpasswd.sh user pass
----

outputs

```sql
CREATE ROLE "user" WITH
  LOGIN
  PASSWORD 'SCRAM-SHA-256$4096:...';
```

which can be fed directly into PostgreSQL.

== References

- https://www.rfc-editor.org/rfc/rfc7677[RFC 7677] SCRAM-SHA-256
- https://www.rfc-editor.org/rfc/rfc5802#section-3[RFC 5802] SCRAM Algorithm Overview

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL