浏览代码

Checking for ctrl-alt-del link

Bob Mottram 8 年前
父节点
当前提交
23f67f2426
共有 2 个文件被更改,包括 12 次插入4 次删除
  1. 7
    0
      src/freedombone-utils-setup
  2. 5
    4
      tests/check-ctrl-alt-del.sh

+ 7
- 0
src/freedombone-utils-setup 查看文件

424
     done
424
     done
425
 }
425
 }
426
 
426
 
427
+function disable_ctrl_alt_del {
428
+    ln -sf /dev/null /etc/systemd/system/ctrl-alt-del.target
429
+}
430
+
427
 function lockdown_permissions {
431
 function lockdown_permissions {
428
     # All commands owned by root
432
     # All commands owned by root
429
     if [ -d /bin ]; then
433
     if [ -d /bin ]; then
541
     read_config_param "PROJECT_REPO"
545
     read_config_param "PROJECT_REPO"
542
     write_config_param "PROJECT_REPO" "$PROJECT_REPO"
546
     write_config_param "PROJECT_REPO" "$PROJECT_REPO"
543
 
547
 
548
+    function_check disable_ctrl_alt_del
549
+    disable_ctrl_alt_del
550
+
544
     function_check dummy_nologin_command
551
     function_check dummy_nologin_command
545
     dummy_nologin_command
552
     dummy_nologin_command
546
 
553
 

+ 5
- 4
tests/check-ctrl-alt-del.sh 查看文件

1
 #!/bin/bash
1
 #!/bin/bash
2
 
2
 
3
 if [ -f /etc/systemd/system/ctrl-alt-del.target ];then
3
 if [ -f /etc/systemd/system/ctrl-alt-del.target ];then
4
-        if ! ls -l /etc/systemd/system/ctrl-alt-del.target | grep "/dev/null";then
5
-                exit 1
6
-        fi
7
-else
4
+    ctrl_alt_del=$(ls -l /etc/systemd/system/ctrl-alt-del.target)
5
+    if [[ "$ctrl_alt_del" !=  *"/dev/null" ]]; then
8
         exit 1
6
         exit 1
7
+    fi
8
+else
9
+    exit 1
9
 fi
10
 fi