当前位置: 首页 > news >正文

做网站的模版cms做视频网站

做网站的模版,cms做视频网站,沈阳市建设局网站,wap网站什么意思目录 一、要求 二、脚本介绍 1、脚本内容 2、脚本解释 #xff08;1#xff09;函数定义 #xff08;2#xff09;防火墙状态检查 #xff08;3#xff09;SELinux/AppArmor状态检查 #xff08;4#xff09;SSH配置检查 #xff08;5#xff09;用户账户数…目录 一、要求 二、脚本介绍 1、脚本内容 2、脚本解释 1函数定义 2防火墙状态检查 3SELinux/AppArmor状态检查 4SSH配置检查 5用户账户数量检查 6系统更新检查 3、使用方法 1脚本文件 2赋予权限 3执行结果 一、要求 由于工作需要要编写一个全面的Linux系统安全性检查脚本该脚本将检查防火墙状态、SELinux/AppArmor状态、SSH配置、用户账户数量、以及检查是否有可用的系统更新。 二、脚本介绍 经过在centos系统中测试完成了脚本这个脚本可能需要根据具体系统配置如使用的发行版进行调整。 闲话不说直接介绍脚本吧。 1、脚本内容 #!/bin/bash # 定义一个脚本函数来显示标题 function show_title() { echo -e \n\e[1m$1\e[0m } # 检查防火墙状态 function check_firewall() { show_title Checking Firewall Status if command -v firewalld /dev/null 21; then status$(firewall-cmd --state) echo firewalld is $status elif command -v ufw /dev/null 21; then status$(ufw status verbose | grep Status: | awk {print $2}) echo ufw is $status else echo No known firewall service detected. fi } # 检查SELinux/AppArmor状态 function check_selinux_apparmor() { show_title Checking SELinux/AppArmor Status if [ -e /etc/selinux/config ]; then status$(grep ^SELINUX /etc/selinux/config | cut -d -f2) echo SELinux is set to $status elif command -v aa-status /dev/null 21; then status$(aa-status | grep AppArmor status: | awk {print $3}) echo AppArmor is $status else echo SELinux and AppArmor not detected. fi } # 检查SSH配置 function check_ssh_config() { show_title Checking SSH Configuration if [ -f /etc/ssh/sshd_config ]; then echo SSH configuration file exists. # 这里可以添加更详细的SSH配置检查如PermitRootLogin, PasswordAuthentication等 grep ^PermitRootLogin /etc/ssh/sshd_config grep ^PasswordAuthentication /etc/ssh/sshd_config else echo SSH configuration file not found. fi } # 检查用户账户数量 function check_user_accounts() { show_title Checking User Accounts user_count$(getent passwd | wc -l) echo Total number of user accounts: $user_count # 可以根据需要添加特定用户的检查 } # 检查系统更新 function check_updates() { show_title Checking for System Updates if command -v apt-get /dev/null 21; then updates$(apt-get update apt-get upgrade -s | grep upgraded, | awk {print $2}) if [ -n $updates ]; then echo $updates packages can be upgraded. else echo No upgrades available. fi elif command -v yum /dev/null 21; then # 注意这里只是示例yum 不直接支持类似 apt-get upgrade -s 的命令 echo Checking for updates with yum (not as detailed as apt-get). yum check-update elif command -v dnf /dev/null 21; then updates$(dnf list updates | grep ^ | wc -l) if [ $updates -gt 0 ]; then echo $updates updates available. else echo No updates available. fi else echo Unknown package manager. fi } # 调用函数 check_firewall check_selinux_apparmor check_ssh_config check_user_accounts check_updates 脚本提供了基本的安全性检查框架。然而请注意安全性的最佳实践通常涉及更详细的配置审核和持续监控。此外SSH配置检查部分可以根据需要添加更多详细的检查项。 2、脚本解释 脚本中主要部分的解释如下 1函数定义 function show_title() {echo -e \n\e[1m$1\e[0m} 如下为具体说明 - function show_title()定义了一个名为show_title的函数它接受一个参数$1。 - echo -e \n\e[1m$1\e[0m使用echo命令打印一个换行符\n然后通过ANSI转义序列\e[1m注意通常使用\033或$\e来表示ESC字符但这里假设\e被shell正确识别将文本加粗$1是传递给函数的参数即要显示的标题。\e[0m用于重置文本格式。 2防火墙状态检查 if command -v firewalld /dev/null 21; then检查firewalld elif command -v ufw /dev/null 21; then检查ufw elseecho No known firewall service detected. fi 如下为具体说明 - command -v firewalld /dev/null 21检查firewalld命令是否存在输出被重定向到/dev/null错误也被重定向到标准输出因为这里是检查命令是否存在所以不关心输出内容。 - 如果firewalld不存在则检查ufw。 3SELinux/AppArmor状态检查 if [ -e /etc/selinux/config ]; then#检查SELinux elif command -v aa-status /dev/null 21; then#检查AppArmor elseecho SELinux and AppArmor not detected. fi 如下为具体说明 - [ -e /etc/selinux/config ]检查SELinux配置文件是否存在。 - command -v aa-status检查AppArmor的aa-status命令是否存在。 4SSH配置检查 grep ^PermitRootLogin /etc/ssh/sshd_configgrep ^PasswordAuthentication /etc/ssh/sshd_config 如下为具体说明 - 使用grep命令搜索SSH配置文件中的PermitRootLogin和PasswordAuthentication设置以了解是否允许root用户登录和是否允许密码认证。 5用户账户数量检查 user_count$(getent passwd | wc -l)echo Total number of user accounts: $user_count 如下为具体说明 - getent passwd列出系统上所有的用户账户信息。 - wc -l计算行数即用户账户的数量。 6系统更新检查 对于不同的包管理器apt-get, yum, dnf检查方式略有不同但基本思想都是查询可用的更新。 - apt-get update apt-get upgrade -s对于Debian系的系统首先更新包索引然后以模拟方式-s检查升级情况但不实际执行升级。 - yum check-update对于基于RPM的系统如CentOS的旧版本yum check-update可以列出所有可用的更新但注意它并不直接提供可以升级的包的数量。 - dnf list updates对于较新的基于RPM的系统如Fedora和较新版本的CentOSdnf list updates列出所有可用的更新并通过管道传递给wc -l计算数量。 3、使用方法 1脚本文件 将上述脚本保存为一个文件例如 linux_security_check.sh。 2赋予权限 赋予脚本执行权限,使用如下命令 chmod x linux_security_check.sh 3执行结果 运行脚本使用如下命令 ./linux_security_check.sh 结果如下所示 [rootecs-52a1 home]# [rootecs-52a1 home]# ./linux_security_check.shChecking Firewall Status firewalld is runningChecking SELinux/AppArmor Status SELinux is set to disabledChecking SSH Configuration SSH configuration file exists. PermitRootLogin no PasswordAuthentication yesChecking User Accounts Total number of user accounts: 22Checking for System Updates Checking for updates with yum (not as detailed as apt-get). Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile* base: mirrors.aliyun.com* extras: mirrors.aliyun.com* updates: mirrors.aliyun.com base | 3.6 kB 00:00:00 epel | 4.3 kB 00:00:00 extras | 2.9 kB 00:00:00 updates | 2.9 kB 00:00:00bind-export-libs.x86_64 32:9.11.4-26.P2.el7_9.16 updates bind-libs-lite.x86_64 32:9.11.4-26.P2.el7_9.16 updates bind-license.noarch 32:9.11.4-26.P2.el7_9.16 updates dhclient.x86_64 12:4.2.5-83.el7.centos.2 updates dhcp-common.x86_64 12:4.2.5-83.el7.centos.2 updates dhcp-libs.x86_64 12:4.2.5-83.el7.centos.2 updates glibc.x86_64 2.17-326.el7_9.3 updates glibc-common.x86_64 2.17-326.el7_9.3 updates glibc-devel.x86_64 2.17-326.el7_9.3 updates glibc-headers.x86_64 2.17-326.el7_9.3 updates iwl100-firmware.noarch 39.31.5.1-83.el7_9 updates iwl1000-firmware.noarch 1:39.31.5.1-83.el7_9 updates iwl105-firmware.noarch 18.168.6.1-83.el7_9 updates iwl135-firmware.noarch 18.168.6.1-83.el7_9 updates iwl2000-firmware.noarch 18.168.6.1-83.el7_9 updates iwl2030-firmware.noarch 18.168.6.1-83.el7_9 updates iwl3160-firmware.noarch 25.30.13.0-83.el7_9 updates iwl3945-firmware.noarch 15.32.2.9-83.el7_9 updates iwl4965-firmware.noarch 228.61.2.24-83.el7_9 updates iwl5000-firmware.noarch 8.83.5.1_1-83.el7_9 updates iwl5150-firmware.noarch 8.24.2.2-83.el7_9 updates iwl6000-firmware.noarch 9.221.4.1-83.el7_9 updates iwl6000g2a-firmware.noarch 18.168.6.1-83.el7_9 updates iwl6000g2b-firmware.noarch 18.168.6.1-83.el7_9 updates iwl6050-firmware.noarch 41.28.5.1-83.el7_9 updates iwl7260-firmware.noarch 25.30.13.0-83.el7_9 updates kernel.x86_64 3.10.0-1160.119.1.el7 updates kernel-devel.x86_64 3.10.0-1160.119.1.el7 updates kernel-headers.x86_64 3.10.0-1160.119.1.el7 updates kernel-tools.x86_64 3.10.0-1160.119.1.el7 updates kernel-tools-libs.x86_64 3.10.0-1160.119.1.el7 updates less.x86_64 458-10.el7_9 updates linux-firmware.noarch 20200421-83.git78c0348.el7_9 updates python-perf.x86_64 3.10.0-1160.119.1.el7 updates [rootecs-52a1 home]# [rootecs-52a1 home]#文章正下方可以看到我的联系方式鼠标“点击” 下面的 “威迪斯特-就是video system 微信名片”字样就会出现我的二维码欢迎沟通探讨。
http://www.zqtcl.cn/news/327889/

相关文章:

  • 上海网站备案在哪里wordpress短链接关键字
  • 金诚财富网站是谁做的建站技术博客
  • 黔东南网站设计公司儿童衣服刘涛做代言那个是什么网站
  • 网站首页样式百度推广是什么工作
  • 广告手机网站制作阿里云域名 设置网站
  • 杭州市拱墅区网站建设ui培训有用么
  • 广东手机网站建设多少钱邯郸市做网站的公司
  • seo网站优化推广怎么做龙岗中心医院
  • 建网站程序智能网站建设平台
  • 建筑公司分几级资质seo入门培训
  • wap类网站上海网站建设免费推
  • 网站建设哪家好公司建设银行网站怎么登陆不
  • 关于建设网站的需求wordpress不能发布文章
  • 如何一键建淘宝客网站中国建设银行金华分行网站
  • 给wordpress添加公告英语seo
  • 佛山市网站建设系统wap浏览器网页版
  • 关于小说网站的一些建设流程学做蛋糕有哪些网站
  • 益阳购物网站开发设计禹城网站制作
  • 教育网站开发文档全网营销推广案例
  • 最流行的网站开发框架wordpress阅读权限
  • 怎么做推广网站创立网站
  • 制作自己的网站需要什么材料网站计费系统怎么做
  • 网站和域名的区别昆山网站开发建设公司
  • 兼职网站推广如何做西安市商标局
  • 打开网站说建设中是什么问题莱芜金点子招小时工
  • 做网站的相关协议秦皇岛解封最新消息今天
  • 网站托管维护方案新闻媒体发稿平台
  • 网站扩展名四平网站建设怎么选
  • 网站制作价格与售后视频网站建设有什么意义
  • 网站建设+太原1核1g可以做几个网站