feat(security): update apt source lists to use https instead of http
This commit is contained in:
parent
8a8d69d173
commit
a577af133d
3 changed files with 27 additions and 0 deletions
|
@ -1,5 +1,8 @@
|
|||
---
|
||||
security:
|
||||
apt:
|
||||
force_https: true
|
||||
https_ignore_list: []
|
||||
clamav:
|
||||
version: 1.2.1
|
||||
|
||||
|
|
|
@ -31,3 +31,9 @@
|
|||
name: clamav-clamd.service
|
||||
enabled: true
|
||||
state: restarted
|
||||
|
||||
- name: '[apt] update sources'
|
||||
become: true
|
||||
ansible.builtin.apt:
|
||||
update_cache: true
|
||||
force_apt_get: true
|
||||
|
|
|
@ -9,6 +9,24 @@
|
|||
security: "{{ security | combine(custom_security, recursive=recursive_combine) }}"
|
||||
changed_when: false
|
||||
|
||||
- name: '[apt] force HTTPS sources'
|
||||
become: true
|
||||
when: security.apt.force_https is truthy
|
||||
block:
|
||||
- name: '[apt] fetch apt information'
|
||||
ansible.builtin.command:
|
||||
cmd: find /etc/apt -maxdepth 2 -path \*sources.list -o -path \*sources.list.d\* -type f
|
||||
register: apt_source_files
|
||||
changed_when: false
|
||||
- name: '[apt] updating sources'
|
||||
ansible.builtin.replace:
|
||||
path: "{{ item }}"
|
||||
regexp: 'http://'
|
||||
replace: 'https://'
|
||||
loop: "{{ apt_source_files.stdout_lines | difference(security.apt.https_ignore_list) }}"
|
||||
notify:
|
||||
- 'security : [apt] update sources'
|
||||
|
||||
- name: '[ssh] hardening sshd'
|
||||
become: true
|
||||
block:
|
||||
|
|
Loading…
Add table
Reference in a new issue