zoukankan      html  css  js  c++  java
  • ssh日志记录

     
    上天查看了服务器安全日志,防火墙屏蔽了处理了一些暴力破解ssh密码的ip(其中一个ip地址为北京一家有名的CDN服务提供商),然后删除了所有的/var/log/secure* 日志文件。
    今天再来查看日志的时候,发现/var/log/secure竟然没有记录,才想到直接删除日志文件的时候,对应的服务需要重启。运行命令:service syslog restart ;service sshd restart 后正常。
    顺便复习下ssh在syslog中的设置的知识。
     
    1、/etc/ssh/sshd_config 中的设置:(即:SyslogFacility 设为AUTHPRIV)
    [root@mail ~]# more /etc/ssh/sshd_config
    #Port 22
    # Logging
    # obsoletes QuietMode and FascistLogging
    #SyslogFacility AUTH
    <strong>SyslogFacility AUTHPRIV</strong>
    #LogLevel INFO
    #就是把sshd的日志定义在authriv.info级别。
    2、配合/etc/syslog.conf中的设置:
    [root@mail ~]# more /etc/syslog.conf
    # Log all kernel messages to the console.
    # Logging much else clutters up the screen.
    #kern.* /dev/console
    # Log anything (except mail) of level info or higher.
    # Dont log private authentication messages!
    *.info;mail.none;authpriv.none;cron.none /var/log/messages
    # The authpriv file has restricted access.
    <strong>authpriv.* /var/log/secur</strong>e
     
    重新启动sshd和syslog

  • 相关阅读:
    原型链与继承
    js错误处理Try-catch和throw
    函数柯里化
    js函数节流
    事件委托
    innerHTML属性的内存和性能问题
    微信小程序左滑显示按钮demo
    this的作用
    前端工作面试经典问题(超级全)
    HTML5入门指南
  • 原文地址:https://www.cnblogs.com/ruiy/p/log.html
Copyright © 2011-2022 走看看