✨ feat(TSG-6739): 添加poweroff guard
添加poweroff guard功能,禁用shutdown、poweroff命令 https://jira.geedge.net/browse/TSG-6739
This commit is contained in:
@@ -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
|
||||
@@ -0,0 +1,6 @@
|
||||
[Unit]
|
||||
Description=Poweroff Guard
|
||||
[Service]
|
||||
ExecStart=/bin/true
|
||||
[Install]
|
||||
RequiredBy=poweroff.target
|
||||
@@ -0,0 +1,6 @@
|
||||
[Unit]
|
||||
Description=Start Poweroff Guard
|
||||
[Service]
|
||||
ExecStart=/bin/systemctl enable poweroff-guard
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
Reference in New Issue
Block a user