Command-line utility for Postgres-compatible SCRAM-SHA-256 passwords

scram-password -- Command-line utility for Postgres-compatible SCRAM-SHA-256 passwords

SCRAM-SHA-256 (see RFC-7677, Salted Challenge Response Authentication Mechanism) is a password based challenge-response authentication mechanism.

Postgres 14 uses it to avoid needing to store or transmit plaintext passwords.

This repository contains a simple command-line utility to hash passwords into a Postgres-compatible format. It may work with other SCRAM-using server software, but the actual storage format is not a standard.

$ go install -v  eagain.net/go/scram-password@latest
[...]
$ scram-password jdoe </secrets/postgres-password-for-jdoe
SCRAM-SHA-256$4096:QmQ2A1cjD16nIqNIDV7h8zjEG1B2h3mc$Cg0t5o2dPlN7gjE4v023hrhGIegBF1aOLksORwBiTgA=:UEs8KN9wbs03QE6oyglm8egxWqNh6laUfNtvVoChtRM=

If you need similar helpers to easily generate the actual passwords, see https://github.com/tv42/entropy and https://github.com/tv42/zbase32:

$ entropy 32 | zbase32-encode
rijwsgiuedt4bx86b5qsamxs1iyobbjdr7f9mieattztbgauxngo

Acknowledgements

The library that does all actual work: https://github.com/xdg-go/scram

Configuration and usage advice: https://hacksoclock.blogspot.com/2018/10/how-to-set-up-scram-sha-256.html

More advice (including a Python script with unclear licensing that was not used to create this project): https://blog.crunchydata.com/blog/how-to-upgrade-postgresql-passwords-to-scram

Note in Postgres docker image documentation that says POSTGRES_INITDB_ARGS=--auth-host=scram-sha-256 might be needed for SCRAM to work: https://github.com/docker-library/docs/commit/00ad08f4335b71b70cfed616ca81ab6dfc015f12

Similar Resources

Hosty is a command-line utility that allows for fast inspection and editing of /etc/hosts-like files

Hosty Description Hosty is a command-line utility that allows for fast inspection and editing of /etc/hosts-like files. It is written in golang and us

Sep 3, 2021

πŸ”„ A command-line utility to export Protocol Buffers (proto) files to YAML, and JSON

proto2yaml πŸ”„ A command-line utility to export Protocol Buffers (proto) files to YAML, and JSON. Currently supported exports are for: Packages Service

Nov 10, 2022

Aces is a command line utility that lets you encode any file to a character set of your choice.

Aces Any Character Encoding Set Aces is a command line utility that lets you encode any file to a character set of your choice. For example, you could

Nov 28, 2022

A command line utility and library for generating professional looking invoices in Go.

A command line utility and library for generating professional looking invoices in Go.

ginvoicer A command line utility and library for generating professional looking invoices in Go. This is a very rough draft and there could still be b

Dec 15, 2022

πŸ“ˆ A command-line utility to interact with TradingView

tvctl πŸ“ˆ A command-line utility to interact with TradingView. This utility aims to improve usability of tedius and repetative tasks, such as watchlist

Oct 18, 2022

ls Xtended : A command line utility which lets you navigate through terminal like a pro 😎.

ls Xtended : A command line utility which lets you navigate through terminal like a pro 😎.

Navigate through terminal like a pro 😎 πŸ’» Demo β€’ βš—οΈ Installation β€’ 🐜 Contribution β€’ ❗ Known Issues ❓ Why? It's a pain to cd and ls multiple times to

Dec 14, 2022

Portal is a quick and easy command-line file transfer utility from any computer to another πŸ–₯️ 🌌 πŸ’»

Portal is a quick and easy command-line file transfer utility from any computer to another πŸ–₯️ 🌌 πŸ’»

Portal is a quick and easy command-line file transfer utility from any computer to another πŸ–₯️ 🌌 πŸ’»

Dec 27, 2022

A command line utility for labeling GitHub issues and pull requests

A command line utility for labeling GitHub issues and pull requests

Jan 8, 2023

Command-line utility to grab Github gists from your own account.

Command-line utility to grab Github gists from your own account.

gistfetch Command-line utility to grab Github gists from your own account. How do I use this? Add an API token with permissions to read Gists Fetch th

Dec 14, 2021
linenoise-classic is a command-line tool that generates strings of random characters that can be used as reasonably secure passwords.

linenoise-classic is a command-line tool that generates strings of random characters that can be used as reasonably secure passwords.

Aug 21, 2022
Simple to do list API with Gin and Gorm (with Postgres)Simple to do list API with Gin and Gorm (with Postgres)

go-todo Simple to do list API with Gin and Gorm (with Postgres) Docker Clone this repository and run: docker-compose up You can then hit the followin

Aug 29, 2022
pgCenter is a command-line admin tool for observing and troubleshooting Postgres.
pgCenter is a command-line admin tool for observing and troubleshooting Postgres.

Command-line admin tool for observing and troubleshooting Postgres.

Dec 29, 2022
A client for managing authzed or any API-compatible system from your command line.

zed A client for managing authzed or any API-compatible system from your command line. Installation zed is currently packaged by as a head-only Homebr

Dec 31, 2022
An open-source GitLab command line tool bringing GitLab's cool features to your command line
An open-source GitLab command line tool bringing GitLab's cool features to your command line

GLab is an open source GitLab CLI tool bringing GitLab to your terminal next to where you are already working with git and your code without switching

Dec 30, 2022
A command line tool that builds and (re)starts your web application everytime you save a Go or template fileA command line tool that builds and (re)starts your web application everytime you save a Go or template file

# Fresh Fresh is a command line tool that builds and (re)starts your web application everytime you save a Go or template file. If the web framework yo

Nov 22, 2021
A command line tool to prompt for a value to be included in another command line.

readval is a command line tool which is designed for one specific purposeβ€”to prompt for a value to be included in another command line. readval prints

Dec 22, 2021
πŸ“· Command-line utility to download all photos from Instagram
πŸ“· Command-line utility to download all photos from Instagram

Instagram Downloader This is a simple command-line tool, written in Go, to download all images from an Instagram account. Getting Started Install inst

Sep 9, 2022
A command line utility for generating language-specific project structure.
A command line utility for generating language-specific project structure.

hydra hydra is a command line utility for generating language-specific project structures. ⏬ ✨ Features Build project templates with just one command

Oct 8, 2021
A small utility command line application that can recursively download Notion pages

notionbackup A small utility command line application that can recursively download Notion pages. I needed something scriptable that could periodicall

Dec 5, 2022