AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 777480
Accepted
Peter Souter
Peter Souter
Asked: 2016-05-19 01:27:52 +0800 CST2016-05-19 01:27:52 +0800 CST 2016-05-19 01:27:52 +0800 CST

使用日志记录在 systemd 中禁用 ctrl+alt+delete

  • 772

我正在尝试更新一些在 RHEL 机器上禁用 CAD 的 Puppet 清单。

现在我正在 systemd 上以最高级的方式进行操作:屏蔽(即链接到 /dev/null)

$ctrlaltdel_process = '/usr/bin/logger -p security.info "Control-Alt-Delete pressed"'

  # Every version of RHEL has a different way of doing this! :)
  case $::operatingsystemmajrelease {
    '4','5': {
      augeas { 'disable-inittab-ctrlaltdel':
        context => '/files/etc/inittab',
        lens    => 'inittab.lns',
        incl    => '/etc/inittab',
        changes => "set *[action = 'ctrlaltdel']/process '${ctrlaltdelprocess}'",
      }
    }
    '6': {
      file { '/etc/init/control-alt-delete.conf':
        ensure  => file,
        content => $ctrlaltdel_process,
      }
    }
    '7': {
      file { '/etc/systemd/system/ctrl-alt-del.target':
        ensure => 'link',
        target => '/dev/null',
      }
    }
    default: {
      fail("Module ${module_name} is not supported on this ${::operatingsystemmajrelease}")
    }
  }

正如你所看到的,在其他系统上,我实际上正在编写一个安全日志,说明 CAD 被按下,但我不会在 systemd 机器上得到这个。

我喜欢在日志中实际设置陷阱的想法,这样我们就可以追踪人们是否正在这样做。

有人可以给我一个 ctrl+alt+delete 的示例 systemd 配置文件,它会做同样的事情吗?

puppet systemd
  • 1 1 个回答
  • 786 Views

1 个回答

  • Voted
  1. Best Answer
    sourcejedi
    2017-08-01T07:20:18+08:002017-08-01T07:20:18+08:00
    # ctrl-alt-del.target
    [Unit]
    DefaultDependencies=no  # Do not affect the system through dependencies
    Requires=ctrl-alt-del.service
    StopWhenUneeded=yes
    
    # ctrl-alt-del.service
    [Service]
    DefaultDependencies=no  # Do not affect the system through dependencies
    Type=oneshot
    ExecStart=/usr/bin/logger -p security.info "Control-Alt-Delete pressed"
    
    • 2

相关问题

  • 如何修复 Puppet 完全限定的参数路径错误?

  • puppet:修改配置文件后强制重启服务

  • 木偶模块资源

  • 傀儡主机名问题

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve