feat(TSG-6739): 添加poweroff guard

添加poweroff guard功能,禁用shutdown、poweroff命令

https://jira.geedge.net/browse/TSG-6739
This commit is contained in:
songyanchao
2021-08-03 02:34:32 -04:00
parent d91c8a5c24
commit ec66a22439
3 changed files with 36 additions and 1 deletions

View File

@@ -233,4 +233,27 @@
src: "{{ role_path }}/templates/90-9000-dracut.rules.j2"
dest: /usr/lib/dracut/dracut.conf.d/90-9000-dracut.conf
mode: 0644
tags: template
tags: template
# poweroff guard
- name: "templates poweroff-guard.service.j2"
template:
src: "{{role_path}}/templates/poweroff-guard.service.j2"
dest: /usr/lib/systemd/system/poweroff-guard.service
tags: template
- name: "templates start-poweroff-guard.service.j2"
template:
src: "{{role_path}}/templates/start-poweroff-guard.service.j2"
dest: /usr/lib/systemd/system/start-poweroff-guard.service
tags: template
- name: 'poweroff-guard service start'
systemd:
name: poweroff-guard
enabled: yes
- name: 'start-poweroff-guard service start'
systemd:
name: start-poweroff-guard
enabled: yes

View File

@@ -0,0 +1,6 @@
[Unit]
Description=Poweroff Guard
[Service]
ExecStart=/bin/true
[Install]
RequiredBy=poweroff.target

View File

@@ -0,0 +1,6 @@
[Unit]
Description=Start Poweroff Guard
[Service]
ExecStart=/bin/systemctl enable poweroff-guard
[Install]
WantedBy=multi-user.target