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

网站导航栏制作设计帮官网

网站导航栏制作,设计帮官网,江宁网站建设价位,建设网站招标文件现在用redis缓存热数据越来越常见了#xff0c;甚至一些配置#xff0c;开关等等的东西也写到redis里。原因就是redis简单高效。redis里的数据也越来越重要了#xff0c;例如一些业务的中间数据会暂时存放在redis里#xff0c;所以限制redis的访问还是很有必要。 本文通过…现在用redis缓存热数据越来越常见了甚至一些配置开关等等的东西也写到redis里。原因就是redis简单高效。redis里的数据也越来越重要了例如一些业务的中间数据会暂时存放在redis里所以限制redis的访问还是很有必要。 本文通过几个手段说一下生产环境中redis的访问权限控制。 1、绑定网卡bind redis的配置文件redis.conf中对于网络安全部分有这样一段话 ################################## NETWORK ###################################### By default, if no bind configuration directive is specified, Redis listens # for connections from all the network interfaces available on the server. # It is possible to listen to just one or multiple selected interfaces using # the bind configuration directive, followed by one or more IP addresses. # # ~~~ WARNING ~~~ If the computer running Redis is directly exposed to the # internet, binding to all the interfaces is dangerous and will expose the # instance to everybody on the internet. So by default we uncomment the # following bind directive, that will force Redis to listen only into # the IPv4 lookback interface address (this means Redis will be able to # accept connections only from clients running into the same computer it # is running). 这段话的意思道出了bind的深意bind的意思是你的redis实例绑定在哪个interface上可以理解成绑定在哪个网卡上。那么我们有几个网卡呢可以看一下。 $ ifconfig eth0 Link encap:Ethernet HWaddr 6C:92:BF:22:D7:FC inet addr:10.93.84.53 Bcast:10.93.84.127 Mask:255.255.255.128lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0这里就两个一个是eth0以太网卡(10.93.84.53)一个是本地回路lo(127.0.0.1)。 那么会有这两种情况 1) bind 10.93.84.53 #同一网段的所有主机都可以连接redis 2) bind 127.0.0.1 #本地回路那么只有你redis实例所在的主机能访问redis 你可以根据你的需要进行使用: 1) 如果你的机器直接暴露给互联网那么你还是慎重的将bind设置为127.0.0.1吧否则你相当于暴露了你的redis给外部所有攻击。 2) 如果你再生产环境中那么你一般会需要绑在网卡上以便其他主机也能访问redis那么我们会有一些其他的方式保证redis数据的安全。 2、设置密码requirepass redis.conf里有这样的配置设置了密码之后。 #requirepass yourpassword requirepass mypass 重启redis服务后你的客户端都需要通过密码的方式访问redis # 密码正确 $ redis-cli -h 10.93.84.53 -p 6379 -a mypass ping PONG# 密码错误 $ redis-cli -h 10.93.84.53 -p 6379 -a hehe ping (error) NOAUTH Authentication required. 3、nologin降低账号权限 以较低权限账号运行Redis服务且禁用该账号的登录权限。另外可以限制攻击者往敏感写入文件但是Redis数据还是能被黑客访问到或者被黑客恶意删除。 禁止Linux用户登录的方法一般是修改用户的shell类型为/sbin/nologin 这种方式会更加人性化一点因为不仅可以禁止用户登录还可以在禁用登陆时给提示告诉它这么做的原因。 修改/etc/nologin.txt没有的话就手动新建一个在里面添加给被禁止用户的提示(这种方式的所有用户的锁定信息都在这个文件中在登陆时给与提示)。 其实就是把/etc/passwd文件里的/bin/bash对应改成/sbin/nologin [roothost-192-168-1-117 ~]# useradd wangshibo [roothost-192-168-1-117 ~]# echo 123456|passwd --stdin wangshibo Changing password for user wangshibo. passwd: all authentication tokens updated successfully. [roothost-192-168-1-117 ~]# cat /etc/passwd|grep wangshibo wangshibo:x:500:500::/home/wangshibo:/bin/bash [roothost-192-168-1-117 ~]# sed -i s#/home/wangshibo:/bin/bash#/home/wangshibo:/sbin/nologin#g /etc/passwd [roothost-192-168-1-117 ~]# cat /etc/passwd|grep wangshibo wangshibo:x:500:500::/home/wangshibo:/sbin/nologin[roothost-192-168-1-117 ~]# touch /etc/nologin.txt [roothost-192-168-1-117 ~]# cat /etc/nologin.txt In order to protect the system security, this type of user is locked! 4、iptables设置防火墙 在生产环境中设置防火墙还是很有必要的。如果正常业务中Redis服务需要被其他服务器来访问可以设置iptables策略仅允许指定的IP来访问Redis服务。 在你redis实例所在的主机执行如下命令。 # 查看iptables规则配置的规则 $ iptables -nL --line-number # 禁止所有的主机访问本机6379端口 $ iptables -I INPUT -p TCP --dport 6379 -j DROP # 打开如下的机器-s指定这些机器可以访问本机的6379端口 $ iptables -I INPUT -s 10.93.21.21 -p tcp --dport 6379 -j ACCEPT $ iptables -I INPUT -s 10.93.18.34 -p tcp --dport 6379 -j ACCEPT $ iptables -I INPUT -s 10.93.18.35 -p tcp --dport 6379 -j ACCEPT $ iptables -I INPUT -s 10.93.84.53 -p tcp --dport 6379 -j ACCEPT # 保存iptables配置 $ service iptables save iptables: Saving firewall rules to /etc/sysconfig/iptables:[ OK ] # 重启防火墙 $ service iptables restart iptables: Setting chains to policy ACCEPT: filter [ OK ] iptables: Flushing firewall rules: [ OK ] iptables: Unloading modules: [ OK ] iptables: Applying firewall rules: [ OK ] 设置成功后只有配置的那四台机器可以访问redis实例。
http://www.hkea.cn/news/14436789/

相关文章:

  • 企业网站建设是什么实现的物质基础和技术支撑拼车平台网站开发
  • 浙江省建设质量协会网站五大跨境电商平台对比分析
  • 二手房公司网站源码公司网站展示有哪些
  • 天柱建设局网站郑州企业网站排行
  • 长沙多用户商城网站建设wordpress营销主题
  • 2345电影新网站模板网站开发人员岗位描述
  • wordpress如何启用全站ssl诊所网站模板
  • 做外贸网站注册什么邮箱我国数字经济报告
  • 政务公开做的好的网站有哪些个人网站怎么建立
  • 松岗网站的建设推广普通话的语文活动
  • 做网站1000以下哪家好站长之家网站查询
  • 如何做好网站的优化的监测评价通过php获取手机网站访客的手机号码
  • 商城网站功能列表wppay wordpress
  • 怎样做建网站做淘客大连网站设计公司
  • 网站的盈利模式wordpress获取评论回复
  • 网站挂马怎么办电商怎么做营销推广天气预报
  • 做网站怎样赚钱合肥搜索引擎优化
  • 贾汪网站开发重庆网站制作定制
  • 做贷款网站犯法吗怎么做服装网站
  • 南京软件网站建设公司用asp做的一个网站实例源代码
  • 外贸视频网站做网站用什么软件编辑
  • 网站服务器配置参考指南怎么做下载类的网站吗
  • dede 如何做视频网站长辛店网站建设
  • 网站后角色管理权限怎么设置?制作网站能挣钱
  • 05网站门户网站的大数据应用
  • 网站做目录中python 网站开发实例教程
  • vi设计网站有哪些wordpress如何评论
  • 山东新昌隆建设咨询有限公司网站在线网页制作平台
  • 访问不到自己做的网站朝阳改版网站
  • 微小店网站建设哪家好广州住房和城乡建设部网站首页