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

Updating auth logic #222

Merged
merged 2 commits into from
Mar 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ COPY ./bin/* /fly/bin/
FROM wrouesnel/postgres_exporter:latest AS postgres_exporter
FROM postgres:${PG_VERSION}
ENV PGDATA=/data/postgresql
ENV PGPASSFILE=/data/.pgpass
ARG VERSION
ARG PG_MAJOR_VERSION
ARG POSTGIS_MAJOR=3
Expand Down
1 change: 1 addition & 0 deletions Dockerfile-timescaledb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ FROM wrouesnel/postgres_exporter:latest AS postgres_exporter

FROM postgres:${PG_VERSION}
ENV PGDATA=/data/postgresql
ENV PGPASSFILE=/data/.pgpass
ARG VERSION
ARG PG_MAJOR_VERSION
ARG POSTGIS_MAJOR=3
Expand Down
4 changes: 2 additions & 2 deletions internal/flypg/pg.go
Original file line number Diff line number Diff line change
Expand Up @@ -471,14 +471,14 @@ func (c *PGConfig) setDefaultHBA() error {
Database: "replication",
User: c.repmgrUsername,
Address: "fdaa::/16",
Method: "trust",
Method: "md5",
},
{
Type: "host",
Database: fmt.Sprintf("replication,%s", c.repmgrDatabase),
User: c.repmgrUsername,
Address: "fdaa::/16",
Method: "trust",
Method: "md5",
},
{
Type: "host",
Expand Down
2 changes: 2 additions & 0 deletions internal/flypg/repmgr.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ func (r *RepMgr) initialize() error {
if err := os.WriteFile(r.PasswordConfigPath, []byte(passStr), 0600); err != nil {
return fmt.Errorf("failed to write file %s: %s", r.PasswordConfigPath, err)
}

if err := utils.SetFileOwnership(r.PasswordConfigPath, "postgres"); err != nil {
return fmt.Errorf("failed to set file ownership: %s", err)
}
Expand Down Expand Up @@ -178,6 +179,7 @@ func (r *RepMgr) setDefaults() error {
"priority": 100,
"node_rejoin_timeout": 30,
"standby_reconnect_timeout": 30,
"passfile": fmt.Sprintf("'%s'", r.PasswordConfigPath),
}

if !r.eligiblePrimary() {
Expand Down
Loading