返回列表 发帖

CentOS6安装服务器安全狗、Nginx版网站安全狗

服务器安全狗功能涵盖了服务器杀毒、系统优化、服务器漏洞补丁修复、服务器程序守护、远程桌面监控、文件目录守护、系统帐号监控、DDOS防火墙、ARP防火墙、防CC攻击、防入侵防篡改、安全策略设置以及邮件实时告警等多方面模块,为用户的服务器在运营过程中提供完善的保护,使其免受恶意的攻击、破坏。

网站安全狗是一款服务器安全防护软件,是为IDC运营商、虚拟主机服务商、企业主机、服务器管理者等用户提供服务器安全防范的实用系统,是集网站内容安全防护、网站资源保护及网站流量保护功能为一体的服务器工具。作为服务器安全专家,这套软件已通过公安部信息安全产品检测中心的检测,并获检验合格证书。网站安全狗保护超过一百万个网站。


笺注:这是在 LNMP一键安装包(lnmp_CentOS6.9) 的基础上进行的。


查看Nginx的版本:(Nginx版的网站安全狗不是支持所有版本的Nginx)
[root@localhost ~]# nginx -v
nginx version: nginx/1.10.0

[root@localhost ~]# nginx -V
nginx version: nginx/1.10.0
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-23) (GCC)
built with OpenSSL 1.0.1e-fips 11 Feb 2013
TLS SNI support enabled
configure arguments: --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_v2_module --with-http_gzip_static_module --with-ipv6 --with-http_sub_module



要安装一些依赖软件包:
[root@localhost ~]# yum -y install wget zlib-devel libtool ncurses-devel libxml2-devel mlocate lsof dmidecode

关闭SELinux:
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config

重启服务器:
init 6



去官网下载最新的安全狗软件包:
[root@localhost ~]# wget http://down.safedog.cn/safedog_linux64.tar.gz

安装安全狗软件:(这是64位软件)
tar -zxvf safedog_linux64.tar.gz
cd safedog_an_linux64_2.8.21207/
chmod a+x *.py

[root@localhost safedog_an_linux64_2.8.21207]# ./install.py
extracting files ...

Warning: Web defense module will restart web process during installation!!:  
Web defense module select:  1.apache 2.nginx . Input(Ctrl-C to skip web defense module installation): 2  #输入2,按回车键

注释:
假如 Web defense module 选择nginx,则代表安装Nginx版网站安全狗;
假如 Web defense module 选择了apache,则代表安装Apache版网站安全狗;
假如 不安装网站安全狗 (Ctrl-C to skip web defense module installation)


step 1/3, start install common lib   [ok]
step 2/3, start Install Server Defense Module                                                      
  step 2.1, checking os release version...   [ok]
  step 2.2, installing file...   [ok]
  step 2.3, start service...   [ok]
  step 2.4, save safedog install info...
  Tips:
  (1)safedog install directory: /etc/safedog
  (2)install safedog version: 2.8.21207
install safedog completely

step 3/3,  start install Nginx Defense Module..
step 3.1, Nginx exe path:/usr/local/nginx/sbin/nginx
step 3.2, download nginx..   [ok]
step 3.3, copy libraries   [ok]
step 3.4, copy bin and set boot   [ok]
step 3.5, start the nginx server..   [ok]
Tips:
(1)If you want to change the configuration of nginx defense module, please modify the files in /etc/safedog/nginx/conf;
(2)If you want to check nginx defense module log, please use command: sdalog -n;
(3)If nginx defense module is failed to use, you can try to restart Nginx.
send command to server ok.
Installation is complete!

备注:安装Nginx版网站安全狗时,要连公网。



safedog install directory:
/etc/safedog
图片109.png


nginx defense module directory:
/etc/safedog/nginx/conf
图片108.png


备注:
安全狗默认会随操作系统的启动而自动启动的;
如无特殊要求,服务器安全狗、网站安全狗里的规则保持默认即可;


重启服务器:
[root@localhost ~]# reboot


查看安全狗是否运行中:
[root@localhost ~]# service safedog status
safedog service is running
[root@localhost ~]#
[root@localhost ~]# ps -ef |grep sdsvrd |grep -v grep
root       2186   2106 14 23:05 ?        00:00:03 sdsvrd -d


关闭安全狗:
[root@localhost ~]# service safedog stop
stop sdsvrd server #####
safedog serivce stopped!


[root@localhost ~]# service safedog status
safedog serivce is not running
[root@localhost ~]#
[root@localhost ~]# ps -ef |grep sdsvrd |grep -v grep
[root@localhost ~]#


启动安全狗:
[root@localhost ~]# service safedog start

[root@localhost ~]# service safedog status
safedog service is running
[root@localhost ~]#
[root@localhost ~]# ps -ef |grep sdsvrd |grep -v grep
root       3976   2106 15 23:10 ?        00:00:01 sdsvrd -d



安装Nginx版网站安全狗后,Nginx的版本会发生变化:
[root@localhost ~]# nginx -v
safedog-nginx-waf version/2.4
developed by www.safedog.cn

nginx version: nginx/1.10.2

[root@localhost ~]# nginx -V
safedog-nginx-waf version/2.4
developed by www.safedog.cn

nginx version: nginx/1.10.2
built by gcc 4.1.2 20080704 (Red Hat 4.1.2-46)
built with OpenSSL 1.0.2k  26 Jan 2017
TLS SNI support enabled
configure arguments: --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_degradation_module --with-http_stub_status_module --with-mail --with-mail_ssl_module --with-ipv6 --with-http_auth_request_module --with-http_v2_module --with-pcre=../3th_lib/pcre-8.40 --with-openssl=../3th_lib/openssl-1.0.2k --with-cc-opt=-I../../../../Plugin_tag_before_yunyu/NginxSiteShield --with-ld-opt='-Wl,-rpath=/etc/safedog/libs/nginx -Wl,-rpath=/etc/safedog/libs/sdcommon -Wl,-rpath=/etc/safedog/libs/sdcc -Wl,-dynamic-linker=/etc/safedog/libs/sdcommon/ld-linux.so.2 -lstdc++ -lnginx_safedog_plugin -lWPCPlugin -lcurl -liconv -lSPModule -llog4cplus' _fuyun    --add-module=../module/3rd_part_module/ngx_cache_purge-2.3 --add-module=../module/3rd_part_module/nginx_upstream_check_module-master --add-module=../module/3rd_part_module/ngx_http_accounting_module-master --add-module=../module/3rd_part_module/testcookie-nginx-module-master





安全狗完成安装后,理应可进入操作界面:
[root@localhost ~]# sdui

使用 SecureCRT 执行命令 sdui 时可能会报错:
Error! Ncurses's initializition was failed!Please replace the ssh terminal with Xshell,Putty or SecureCRT.

解决方法:
这个是由于终端类型不匹配引起的,请按照以下步骤操作:
依次选择“选项”->“会话选项”->“终端”->“仿真”,
将终端类型修改为 Xterm,将ANSI颜色打勾,如下图:
图片3.png
笺注:最后还要重新登录此会话。



主界面:
图片4.png


图片5.png

图片6.png


按两下“Esc”键,进入主菜单栏:
图片7.png


[Firewall]->NetFireWall
图片8.png
备注:DDOS Firewall、CC Attack Defense默认是开启的。


进入主菜单栏后,再按一下“Esc”键,可退出操作界面:
图片9.png





######

加入服云,告别Linux传统字符界面,Windows客户端可通过浏览器管理安全狗:
http://www.safedog.cn
图片10.png


登录后,来到主页:
图片11.png


在主页右边点击 下载证书
图片12.png


下载文件:safedog_user.psf
图片13.png


把证书放到服务器的指定目录上:
[root@localhost ~]# mv safedog_user.psf /etc/safedog/sdcc/
[root@localhost ~]# ll /etc/safedog/sdcc/
图片14.png



刷新页面,理应就可以看到新添加的服务器了:
安全管理》服务器管理
图片15.png
注释:可以看到服务器的公网IP、内网IP。


服务器安全防护:
图片16.png


图片17.png

设置文件实时防护的“规则设置”:
图片18.png
备注:记得点击此页面底下的“保存”按钮。



网站安全防护:(安装了网站安全狗才会有以下选项)
图片19.png
备注:漏洞防护要设置为“记录并拦截”


网站防护》HTTP安全检测:
图片20.png


测试Nginx版网站安全狗的HTTP安全检测功能:
http://192.168.168.130/?order%20by
图片21.png


在服务器上查看Nginx版网站安全狗的防护日志:
[root@localhost ~]# sdalog -n

Total 1 records!
Time                |Type             |AttackIP        |FullUrl                                  |AttackContent                              |PhysicalPath                  
2021-02-17 23:26:03 |SQL injection    |192.168.168.138 |192.168.168.130/?order%20by              |防止order by函数利用,可疑内容:192.168.16.. |   






######

某台服务器退出服云:(不能删除在线的服务器,该服务器要先关机)
图片22.png


图片23.png





######
######

卸载服务器安全狗、Nginx版网站安全狗:
[root@localhost ~]# cd /root/safedog_an_linux64_2.8.21207/
[root@localhost ~]# ./uninstall.py
Would you like to backup the files of isolation?[y/n](default:y):n
remove files of isolation
Would you like to backup safedog logs?[y/n](default:y):n
remove safedog logs
Collecting setup information   [ok]
Uninstall Server Defense Module   [ok]
Uninstall Server Defense Module Compeletely
Apache Defense Module is not installed

stop nginx server...   [ok]
restore nginx.bak to nginx...   [ok]
remove file of Nginx Defense Module...   [ok]
start nginx server...   [ok]
uninstall nginx defense module succeed..
Uninstall Common Module   [ok]
Uninstall completely!



卸载Nginx版网站安全狗后,Nginx的版本会恢复原来的样子:
[root@localhost ~]# nginx -v
nginx version: nginx/1.10.0

[root@localhost ~]# nginx -V
nginx version: nginx/1.10.0
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-23) (GCC)
built with OpenSSL 1.0.1e-fips 11 Feb 2013
TLS SNI support enabled
configure arguments: --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_v2_module --with-http_gzip_static_module --with-ipv6 --with-http_sub_module



本站点的服务器也安装了服务器安全狗和Nginx版的网站安全狗



Nginx/1.12.2也可以安装Nginx版网站安全狗,可参考:更新Nginx版本+Nginx版网站安全狗





相关文章:
Oracle Linux6安装服务器安全狗、Nginx版网站安全狗
CentOS6安装服务器安全狗、Apache版网站安全狗

服务器安全狗、Nginx版网站安全狗的日常维护
Nginx版网站安全狗配置资源防盗链

Windows2008r2_服务器安全狗_V5.0
Windows2012r2_服务器安全狗_V5.0

CentOS8_云锁+Nginx




#################################
#################################
亲,学习研究也要劳逸结合哦,来我微店逛逛,买点东西好好犒劳犒劳自己和家人吧^_^^_^

FaSoLa免磨陶瓷刀具 抗氧化厨房切菜刀水果刀切肉刀 寿命长
dao.png

【宝家洁】喷雾喷水拖把平板拖把大号 高档木地板除尘 不用手洗的创意拖把 懒人必备
tuoba.png

薇语馨 (促销价)6833#夏季新款收腰显瘦蝙蝠袖露肩复古雪纺连衣裙波浪裙子邻家女孩 好质量 支持无理由退货
duoyi.png

薇语馨1852真丝连衣裙套装裙两件套系带宽松大码不规则裙子女
danyi.png

返回列表