系统信息日志配置/etc/syslog.conf

 

输出消息的类型  格式:   facility.level; facility.level.                      输入消息的位置

*.err;kern.notice;auth.notice                                                                          /dev/sysmsg
*.err;kern.debug;daemon.notice;mail.crit                                                      /var/adm/messages

重启syslog

/etc/init.d/syslog stop

/etc/init.d/syslog start

 

The selector field is a semicolon-separated list of priority specifications in the following format: facility.level; facility.level.

  •  The facility field can contain only 16 codes:
    • kern Messages generated by the kernel.
    • user Messages generated by user processes.
    • mail The mail system.
    • daemon System daemons, such as the in.ftpd and the telnetd daemons.
    • auth The authorization system, including the login and su commands.
    • syslog Messages generated internally by the syslogd daemon.
    • lpr The line printer spooling system, such as the lpr and lpc commands.
    • news Files reserved for the USENET network news system.
    • uucp  (obsolete) The UNIX-to-UNIX copy (UUCP) system does not use the syslog function.
    • cron The cron and at facilities, including crontab, at, and cron.
    • local0-7 Eight user-defined codes.
  • the level selector specifies the severity or importance of the message. Each level includes all the levels above (of a higher severity).  To remember the sequence for the certification exam you can use an appropriately constructed phase like "Every alerted cardriver escapes warning notice"
    • emerg 0 Panic conditions that are normally broadcast to all users
    • alert 1 Conditions that should be corrected immediately, such as a corrupted system database. Only sysadmin of a particular server needs to be informed by mail or paged.
    • crit 2 Warnings about critical conditions, such as hard device errors. 
    • err 3 Errors other than hard device errors
    • warning 4 Warning messages, that generally does not interfere with normal operation.
    • notice 5 Non-error conditions that might require special handling
    • info 6 Purely informational messages (usually does not require any handling)
    • debug 7 Messages that are normally used only when debugging a program
    • none 8 Messages are not sent from the indicated facility to the selected file
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
逐条注释 ``` if grep -q "chroot_list_file=/etc/vsftpd/chroot_list" /etc/vsftpd/vsftpd.conf then sed -i '/chroot_list_file=/etc/vsftpd/chroot_list/s/^/#/' /etc/vsftpd/vsftpd.conf echo 'chroot_list_file=/etc/vsftpd/chroot_list' >> /etc/vsftpd/vsftpd.conf else echo 'chroot_list_file=/etc/vsftpd/chroot_list' >> /etc/vsftpd/vsftpd.conf fi if grep -q "anonymous_enable" /etc/vsftpd/vsftpd.conf then sed -i '/anonymous_enable=YES/s/^/#/' /etc/vsftpd/vsftpd.conf sed -i '/anonymous_enable=NO/s/^/#/' /etc/vsftpd/vsftpd.conf echo 'anonymous_enable=NO' >> /etc/vsftpd/vsftpd.conf else echo 'anonymous_enable=NO' >> /etc/vsftpd/vsftpd.conf fi fi touch /etc/vsftpd/chroot_list chmod 750 /etc/vsftpd/chroot_list service vsftpd restart systemctl restart vsftpd.service mv /etc/issue /etc/issue.bak mv /etc/issue.net /etc/issue.net.bak touch /etc/motd chmod 644 /etc/motd rpm -e telnet-server systemctl stop telnet.socket if grep -q "Authorized only. All activity will be monitored and reported" /etc/motd then echo 'have' else echo "Authorized only. All activity will be monitored and reported" >> /etc/motd fi if [ -f "/etc/syslog.conf" ];then echo 'authpriv.* /var/log/secure' >> /etc/syslog.conf echo 'cron.*' >> /etc/syslog.conf echo '*.* @133.64.93.31' >> /etc/syslog.conf service syslog restart fi if [ -f "/etc/rsyslog.conf" ];then echo 'authpriv.* /var/log/secure' >> /etc/rsyslog.conf echo 'cron.*' >> /etc/rsyslog.conf echo '*.* @133.64.97.31' >> /etc/rsyslog.conf service rsyslog restart systemctl restart rsyslog.service fi echo 'ok' ```
07-20
这段脚本的作用是修改一些vsftpd和系统配置,并重新启动相应的服务。具体解释如下: ```shell if grep -q "chroot_list_file=/etc/vsftpd/chroot_list" /etc/vsftpd/vsftpd.conf then sed -i '/chroot_list_file=/etc/vsftpd/chroot_list/s/^/#/' /etc/vsftpd/vsftpd.conf echo 'chroot_list_file=/etc/vsftpd/chroot_list' >> /etc/vsftpd/vsftpd.conf else echo 'chroot_list_file=/etc/vsftpd/chroot_list' >> /etc/vsftpd/vsftpd.conf fi ``` - 检查/etc/vsftpd/vsftpd.conf文件中是否存在"chroot_list_file=/etc/vsftpd/chroot_list"这一行。 - 如果存在,则使用sed命令在该行的行首添加注释符号#,即禁用chroot_list_file功能。 - 然后在文件末尾添加一行"chroot_list_file=/etc/vsftpd/chroot_list"。 - 如果不存在,则在文件末尾添加一行"chroot_list_file=/etc/vsftpd/chroot_list"。 ```shell if grep -q "anonymous_enable" /etc/vsftpd/vsftpd.conf then sed -i '/anonymous_enable=YES/s/^/#/' /etc/vsftpd/vsftpd.conf sed -i '/anonymous_enable=NO/s/^/#/' /etc/vsftpd/vsftpd.conf echo 'anonymous_enable=NO' >> /etc/vsftpd/vsftpd.conf else echo 'anonymous_enable=NO' >> /etc/vsftpd/vsftpd.conf fi ``` - 检查/etc/vsftpd/vsftpd.conf文件中是否存在"anonymous_enable"这一行。 - 如果存在,则使用sed命令将"anonymous_enable=YES"和"anonymous_enable=NO"这两行的行首添加注释符号#,以禁用匿名用户登录。 - 然后在文件末尾添加一行"anonymous_enable=NO",即禁用匿名用户登录。 ```shell touch /etc/vsftpd/chroot_list chmod 750 /etc/vsftpd/chroot_list service vsftpd restart systemctl restart vsftpd.service ``` - 创建一个空的/etc/vsftpd/chroot_list文件。 - 修改/etc/vsftpd/chroot_list文件的权限为750,即只有所有者具有读、写和执行权限。 - 重新启动vsftpd服务,使配置生效。 ```shell mv /etc/issue /etc/issue.bak mv /etc/issue.net /etc/issue.net.bak touch /etc/motd chmod 644 /etc/motd ``` - 备份/etc/issue和/etc/issue.net文件,将其重命名为/etc/issue.bak和/etc/issue.net.bak。 - 创建一个空的/etc/motd文件。 - 修改/etc/motd文件的权限为644,即所有用户具有读权限,其他权限为空。 ```shell rpm -e telnet-server systemctl stop telnet.socket ``` - 卸载telnet-server软件包。 - 停止telnet服务。 ```shell if grep -q "Authorized only. All activity will be monitored and reported" /etc/motd then echo 'have' else echo "Authorized only. All activity will be monitored and reported" >> /etc/motd fi ``` - 检查/etc/motd文件中是否存在"Authorized only. All activity will be monitored and reported"这一行。 - 如果存在,则输出"have"。 - 如果不存在,则在文件末尾添加一行"Authorized only. All activity will be monitored and reported"。 ```shell if [ -f "/etc/syslog.conf" ];then echo 'authpriv.* /var/log/secure' >> /etc/syslog.conf echo 'cron.*' >> /etc/syslog.conf echo '*.* @133.64.93.31' >> /etc/syslog.conf service syslog restart fi ``` - 检查/etc/syslog.conf文件是否存在。 - 如果存在,则在文件末尾添加以下几行配置: - "authpriv.* /var/log/secure":将authpriv类别的日志记录到/var/log/secure文件。 - "cron.*":将cron类别的日志记录到默认位置。 - "*.* @133.64.93.31":将所有日志发送到IP地址为133.64.93.31的远程主机。 - 重新启动syslog服务,使配置生效。 ```shell if [ -f "/etc/rsyslog.conf" ];then echo 'authpriv.* /var/log/secure' >> /etc/rsyslog.conf echo 'cron.*' >> /etc/rsyslog.conf echo '*.* @133.64.97.31' >> /etc/rsyslog.conf service rsyslog restart systemctl restart rsyslog.service fi ``` - 检查/etc/rsyslog.conf文件是否存在。 - 如果存在,则在文件末尾添加以下几行配置: - "authpriv.* /var/log/secure":将authpriv类别的日志记录到/var/log/secure文件。 - "cron.*":将cron类别的日志记录到默认位置。 - "*.* @133.64.97.31":将所有日志发送到IP地址为133.64.97.31的远程主机。 - 重新启动rsyslog服务,使配置生效。 ```shell echo 'ok' ``` - 输出"ok",表示脚本执行完毕。 这段脚本的目的是修改一些vsftpd和系统配置,并重新启动相应的服务,以增强系统的安全性和稳定性。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值