Skip to content

Commit c9283f8

Browse files
committed
chore: install gatekeeper with ansible
1 parent a13b166 commit c9283f8

File tree

3 files changed

+21
-5
lines changed

3 files changed

+21
-5
lines changed

ansible/tasks/setup-postgres.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -207,13 +207,11 @@
207207

208208
- name: create placeholder pam config
209209
file:
210-
path: '/etc/pam.d/{{ item }}'
210+
path: '/etc/pam.d/postgresql'
211211
state: touch
212212
owner: postgres
213213
group: postgres
214214
mode: 0664
215-
with_items:
216-
- 'postgresql'
217215
when: (debpkg_mode or nixpkg_mode) and not is_psql_15
218216

219217
# Add pg_hba.conf

ansible/tasks/stage2-setup-postgres.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,24 @@
147147
path: '/var/lib/postgresql/.nix-profile/bin/'
148148
register: 'nix_links'
149149

150+
- name: Check psql_version and install gatekeeper if not pg15
151+
block:
152+
- name: Check if psql_version is psql_15
153+
set_fact:
154+
is_psql_15: "{{ psql_version == 'psql_15' }}"
155+
156+
- name: Install gatekeeper from nix binary cache
157+
become: yes
158+
shell: |
159+
sudo -u postgres bash -c ". /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh && nix profile install github:supabase/postgres/{{ git_commit_sha }}#gatekeeper"
160+
when: stage2_nix and not is_psql_15
161+
162+
- name: Create symbolic link for linux-pam to find pam_jit_pg.so
163+
shell: >
164+
sudo ln -s /var/lib/postgresql/.nix-profile/lib/security/pam_jit_pg.so $(find /nix/store -type d -path "/nix/store/*-linux-pam-*/lib/security" -print -quit)/pam_jit_pg.s
165+
become: yes
166+
when: stage2_nix and not is_psql_15
167+
150168
- name: Create symlinks for Nix files into /usr/lib/postgresql/bin
151169
ansible.builtin.file:
152170
group: 'postgres'

nix/packages/gatekeeper.nix

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@ buildGoModule {
3030

3131
buildPhase = ''
3232
runHook preBuild
33-
go build -buildmode=c-shared -o pam_jwt_pg.so
33+
go build -buildmode=c-shared -o pam_jit_pg.so
3434
runHook postBuild
3535
'';
3636

3737
installPhase = ''
3838
runHook preInstall
3939
mkdir -p $out/lib/security
40-
cp pam_jwt_pg.so $out/lib/security/
40+
cp pam_jit_pg.so $out/lib/security/
4141
runHook postInstall
4242
'';
4343

0 commit comments

Comments
 (0)