Skip to content

Commit

Permalink
Update converge.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
vitabaks committed Dec 8, 2024
1 parent b5805bc commit b748744
Showing 1 changed file with 6 additions and 37 deletions.
43 changes: 6 additions & 37 deletions automation/molecule/default/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,52 +4,22 @@
gather_facts: true

tasks:
# Проверяем PAM конфигурацию для sudo
- name: Check PAM configuration for sudo
command: cat /etc/pam.d/sudo
register: pam_sudo_config
changed_when: false

- name: Debug PAM configuration for sudo
debug:
var: pam_sudo_config.stdout

# Обновляем PAM конфигурацию для sudo
- name: Update PAM configuration to disable password for sudo
- name: Update PAM configuration for sudo to disable authentication
ansible.builtin.lineinfile:
path: /etc/pam.d/sudo
regexp: '^auth'
line: 'auth sufficient pam_permit.so'
state: present

# Проверяем system-auth
- name: Check system-auth configuration
command: cat /etc/pam.d/system-auth
register: pam_system_auth_config
changed_when: false

- name: Debug system-auth configuration
debug:
var: pam_system_auth_config.stdout

# Проверяем SELinux статус
- name: Check SELinux status
command: getenforce
register: selinux_status
- name: Check updated PAM configuration for sudo

Check failure on line 14 in automation/molecule/default/converge.yml

View workflow job for this annotation

GitHub Actions / build

fqcn[action-core]

Use FQCN for builtin module actions (command).
command: cat /etc/pam.d/sudo
register: pam_sudo_updated
changed_when: false
ignore_errors: yes

- name: Debug SELinux status
- name: Debug updated PAM configuration for sudo

Check failure on line 19 in automation/molecule/default/converge.yml

View workflow job for this annotation

GitHub Actions / build

fqcn[action-core]

Use FQCN for builtin module actions (debug).
debug:
var: selinux_status.stdout

# Отключаем SELinux, если он включён
- name: Disable SELinux if enabled
command: setenforce 0
when: selinux_status.stdout == "Enforcing"
ignore_errors: yes
var: pam_sudo_updated.stdout

# Тестируем sudo без пароля
- name: Test sudo without password

Check failure on line 23 in automation/molecule/default/converge.yml

View workflow job for this annotation

GitHub Actions / build

fqcn[action-core]

Use FQCN for builtin module actions (command).
command: sudo -n true
register: sudo_test
Expand All @@ -60,7 +30,6 @@
debug:
var: sudo_test

# Проверяем логи PAM на ошибки
- name: Check authentication logs for PAM errors

Check failure on line 33 in automation/molecule/default/converge.yml

View workflow job for this annotation

GitHub Actions / build

fqcn[action-core]

Use FQCN for builtin module actions (shell).
shell: "grep -Ei 'pam|auth' /var/log/secure || true"
register: pam_log_check
Expand Down

0 comments on commit b748744

Please sign in to comment.