Skip to content

Commit 778768b

Browse files
alexander-dammeiercesmarvin
authored andcommitted
Merge branch 'release/v14.15-2'
2 parents e2a870b + 421c1fb commit 778768b

File tree

5 files changed

+29
-30
lines changed

5 files changed

+29
-30
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [v14.15-2] - 2025-02-21
11+
### Changed
12+
- [#47] Do not restrict access via `pg_hba.conf` in multinode anymore because network policies do that.
13+
1014
## [v14.15-1] - 2025-01-23
1115
### Changed
1216
- [#42] Update Makefiles to 9.5.0

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ RUN set -x -o errexit \
1818
FROM registry.cloudogu.com/official/base:3.21.0-1
1919

2020
LABEL NAME="official/postgresql" \
21-
VERSION="14.15-1" \
21+
VERSION="14.15-2" \
2222
maintainer="[email protected]"
2323

2424
ENV LANG=en_US.utf8 \

batsTests/startup.bats

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,30 +13,29 @@ setup() {
1313
export STARTUP_DIR=/workspace/resources
1414
export WORKDIR=/workspace
1515
netstat="$(mock_create)"
16+
doguctl="$(mock_create)"
1617
export netstat
18+
export doguctl
1719
export PATH="${BATS_TMPDIR}:${PATH}"
1820
ln -s "${netstat}" "${BATS_TMPDIR}/netstat"
21+
ln -s "${doguctl}" "${BATS_TMPDIR}/doguctl"
1922
}
2023

2124
teardown() {
2225
unset STARTUP_DIR
2326
unset WORKDIR
2427
rm "${BATS_TMPDIR}/netstat"
28+
rm "${BATS_TMPDIR}/doguctl"
2529
}
2630

27-
@test "create_hba() should use cidr 16 if the dogu is running in a k8s cluster" {
28-
mock_set_output "${netstat}" "Kernel-IP-Routentabelle
29-
Ziel Router Genmask Flags MSS Fenster irtt Iface
30-
192.168.179.0 0.0.0.0 255.255.255.0 U 0 0 0 wlp0s20f3"
31-
31+
@test "create_hba() should accept all if the dogu is running in a k8s cluster" {
3232
source /workspace/resources/startup.sh
33-
local POD_NAMESPACE
34-
export POD_NAMESPACE="ecosystem"
33+
mock_set_output "${doguctl}" "true"
3534

3635
run create_hba
3736

3837
assert_success
39-
assert_equal "$(mock_get_call_num "${netstat}")" "1"
38+
assert_equal "$(mock_get_call_num "${doguctl}")" "1"
4039
assert_line '# generated, do not override'
4140
assert_line '# "local" is for Unix domain socket connections only'
4241
assert_line 'local all all trust'
@@ -45,10 +44,11 @@ Ziel Router Genmask Flags MSS Fenster irtt Iface
4544
assert_line '# IPv6 local connections:'
4645
assert_line 'host all all ::1/128 trust'
4746
assert_line '# container networks'
48-
assert_line "host all all 192.168.179.0/16 password"
47+
assert_line "host all all all password"
4948
}
5049

5150
@test "create_hba() should use regular cidr if the dogu is not running in a k8s cluster" {
51+
mock_set_output "${doguctl}" "false"
5252
mock_set_output "${netstat}" "Kernel-IP-Routentabelle
5353
Ziel Router Genmask Flags MSS Fenster irtt Iface
5454
192.168.179.0 0.0.0.0 255.255.255.0 U 0 0 0 wlp0s20f3"
@@ -59,6 +59,7 @@ Ziel Router Genmask Flags MSS Fenster irtt Iface
5959

6060
assert_success
6161
assert_equal "$(mock_get_call_num "${netstat}")" "1"
62+
assert_equal "$(mock_get_call_num "${doguctl}")" "1"
6263
assert_line '# generated, do not override'
6364
assert_line '# "local" is for Unix domain socket connections only'
6465
assert_line 'local all all trust'

dogu.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"Name": "official/postgresql",
3-
"Version": "14.15-1",
3+
"Version": "14.15-2",
44
"DisplayName": "PostgreSQL",
55
"Description": "PostgreSQL Database.",
66
"Url": "https://www.postgresql.org/",

resources/startup.sh

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -58,25 +58,19 @@ function create_hba() {
5858
echo '# IPv6 local connections:'
5959
echo 'host all all ::1/128 trust'
6060
echo '# container networks'
61-
for NETWITHMASK in $(netstat -nr | tail -n +3 | grep -v '^0' | awk '{print $1"/"$3}'); do
62-
local NET
63-
NET=$(echo "${NETWITHMASK}" | awk -F'/' '{print $1}')
64-
local MASK
65-
MASK=$(echo "${NETWITHMASK}" | awk -F'/' '{print $2}')
66-
local CIDR
67-
CIDR=$(mask2cidr "$MASK")
68-
local isNotRunningUnderK8s="${POD_NAMESPACE:-"not running k8s"}"
69-
local netmaskCidrValue
70-
if [ "${isNotRunningUnderK8s}" == "not running k8s" ]; then
71-
netmaskCidrValue="${NET}/${CIDR}"
72-
else
73-
# Hyper-scalers default to a CIDR of /32 which blocks any network traffic from others pods esp. from other nodes.
74-
# /16 allows traffic from a sufficiently large network range from the kubernetes cluster, independently how the
75-
# cluster is configured.
76-
netmaskCidrValue="${NET}/16"
77-
fi
78-
echo "host all all ${netmaskCidrValue} password"
79-
done
61+
if [[ "$(doguctl multinode)" = "false" ]]; then
62+
for NETWITHMASK in $(netstat -nr | tail -n +3 | grep -v '^0' | awk '{print $1"/"$3}'); do
63+
local NET
64+
NET=$(echo "${NETWITHMASK}" | awk -F'/' '{print $1}')
65+
local MASK
66+
MASK=$(echo "${NETWITHMASK}" | awk -F'/' '{print $2}')
67+
local CIDR
68+
CIDR=$(mask2cidr "$MASK")
69+
echo "host all all ${NET}/${CIDR} password"
70+
done
71+
else
72+
echo "host all all all password"
73+
fi
8074
}
8175

8276
function write_pg_hba_conf() {

0 commit comments

Comments
 (0)