Repository navigation
Listen on both loopback addresses, and name them - #4
Merged
Merged
Conversation
The layer shipped a database an appliance built on it could not reach
over IPv6, which is the address family this project builds for.
conf.d/main asserted Debian's default, listen_addresses = 'localhost',
on the grounds that it is the loopback of both families. It is not.
Debian's /etc/hosts maps ::1 to ip6-localhost and ip6-loopback and never
to localhost, so getaddrinfo("localhost") answers 127.0.0.1 alone and the
cluster binds the IPv4 loopback only. Measured on a container booted from
the published layer:
# ss -lntH 'sport = :5432'
LISTEN 0 200 127.0.0.1:5432 0.0.0.0:*
with ::1 up on lo and pg_hba.conf already carrying its scram-sha-256 line
for ::1/128, ready for a connection that could never arrive. That is what
failed firstboot.d/36pgsqlverify on the gate, and the hook was right:
35pgsqlpass had set the password over the unix socket and the database
was still unreachable at the address this layer says it serves.
The fix is two literal addresses, '::1,127.0.0.1', the same pair the
MariaDB layer writes into its bind-address. A literal address cannot
resolve into something else, which is the point: the previous line was
not wrong about what it wanted, it was wrong about what a name meant on
this machine. What it binds is now proved on the booted machine by the
boot test rather than assumed by a grep of the setting here, which is the
lesson of the defect: asserting the configuration is not asserting the
behaviour.
Measured on the build host, on a container booted from the published
chain with the line in place:
# ss -lntH 'sport = :5432'
LISTEN 0 200 127.0.0.1:5432 0.0.0.0:*
LISTEN 0 200 [::1]:5432 [::]:*
$ psql --username=postgres --host=::1 --port=5432 --no-password \
--command='SELECT 1, current_user, inet_server_addr()'
1|postgres|::1
with the declared password in PGPASSWORD, and with the wrong one
FATAL: password authentication failed for user "postgres"
The layer ships this, so the changelog gains an entry and the layer needs
a rebuild before its gate can go green.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The layer shipped a database an appliance built on it could not reach
over IPv6, which is the address family this project builds for.
conf.d/main asserted Debian's default, listen_addresses = 'localhost',
on the grounds that it is the loopback of both families. It is not.
Debian's /etc/hosts maps ::1 to ip6-localhost and ip6-loopback and never
to localhost, so getaddrinfo("localhost") answers 127.0.0.1 alone and the
cluster binds the IPv4 loopback only. Measured on a container booted from
the published layer:
with ::1 up on lo and pg_hba.conf already carrying its scram-sha-256 line
for ::1/128, ready for a connection that could never arrive. That is what
failed firstboot.d/36pgsqlverify on the gate, and the hook was right:
35pgsqlpass had set the password over the unix socket and the database
was still unreachable at the address this layer says it serves.
The fix is two literal addresses, '::1,127.0.0.1', the same pair the
MariaDB layer writes into its bind-address. A literal address cannot
resolve into something else, which is the point: the previous line was
not wrong about what it wanted, it was wrong about what a name meant on
this machine. What it binds is now proved on the booted machine by the
boot test rather than assumed by a grep of the setting here, which is the
lesson of the defect: asserting the configuration is not asserting the
behaviour.
Measured on the build host, on a container booted from the published
chain with the line in place:
with the declared password in PGPASSWORD, and with the wrong one
The layer ships this, so the changelog gains an entry and the layer needs
a rebuild before its gate can go green.