Skip to content

Commit 30c6a10

Browse files
faisalahammadFaisal Ahammad
andauthored
fix(php): switch PHP repo from ppa:ondrej/php to packages.sury.org/php (#1680)
- Remove legacy ondrej/php Launchpad list and key from any host that provisioned with the old PPA so the relabelled InRelease cannot prompt on the next apt update. - Add https://packages.sury.org/php/ with a signed-by pinned key, suite follows the host's distribution release. - Verify the Sury signing key's OpenPGP fingerprint before trusting it. Fixes #1678 Co-authored-by: Faisal Ahammad <faisal@example.invalid>
1 parent b5cd2c3 commit 30c6a10

1 file changed

Lines changed: 37 additions & 2 deletions

File tree

roles/php/tasks/main.yml

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,42 @@
11
---
2-
- name: Add PHP PPA
2+
- name: Remove legacy ondrej/php Launchpad list
3+
file:
4+
path: "/etc/apt/sources.list.d/ondrej-ubuntu-php-{{ ansible_facts['distribution_release'] }}.list"
5+
state: absent
6+
7+
- name: Remove legacy ondrej/php Launchpad key
8+
file:
9+
path: /etc/apt/trusted.gpg.d/ondrej_ubuntu_php.gpg
10+
state: absent
11+
12+
- name: Ensure apt keyrings directory exists
13+
file:
14+
path: /etc/apt/keyrings
15+
state: directory
16+
mode: '0755'
17+
18+
- name: Download Sury PHP signing key
19+
get_url:
20+
url: https://packages.sury.org/php/apt.gpg
21+
dest: /etc/apt/keyrings/sury-php.gpg
22+
mode: '0644'
23+
24+
- name: Verify Sury PHP signing key fingerprint
25+
command: gpg --show-keys --with-fingerprint --with-colons /etc/apt/keyrings/sury-php.gpg
26+
register: sury_key_fpr
27+
changed_when: false
28+
check_mode: false
29+
30+
- name: Assert Sury PHP signing key fingerprint
31+
assert:
32+
that:
33+
- "'15058500A0235D97F5D10063B188E2B695BD4743' in sury_key_fpr.stdout"
34+
fail_msg: "Sury PHP signing key fingerprint does not match expected value."
35+
36+
- name: Add Sury PHP repository
337
apt_repository:
4-
repo: "ppa:ondrej/php"
38+
repo: "deb [signed-by=/etc/apt/keyrings/sury-php.gpg] https://packages.sury.org/php/ {{ ansible_facts['distribution_release'] }} main"
39+
filename: sury-php
540
update_cache: yes
641
register: result
742
until: result is success

0 commit comments

Comments
 (0)