centos下redis安全相关
2024-10-18 08:50:30
博文背景:
由于发现众多同学,在使用云服务器时,安装的redis3.0+版本都关闭了protected-mode,因而都遭遇了挖矿病毒的攻击,使得服务器99%的占用率!!
因此我们在使用redis时候,最好更改默认端口,并且使用redis密码登录。
(1)redis没有用户概念,redis只有密码
(2)redis默认在工作在保护模式下。不允许远程任何用户登录的(protected-mode)
redis.conf设置
protected-mode yes #打开保护模式
port #更改默认启动端口
requirepass xxxxxx #设置redis启动密码,xxxx是自定义的密码
启动redis服务端
redis-server /opt/redis-4.0./redis.conf & #指定配置文件启动redis,且后台启动
使用密码登录redis,使用6380端口
方法1,使用这个
[root@oldboy_python ~ ::]#redis-cli -p
127.0.0.1:> auth xxxx
OK
方法2,此方案不安全,容易暴露密码
[root@oldboy_python ~ ::]#redis-cli -p -a xxxx
Warning: Using a password with '-a' option on the command line interface may not be safe.
127.0.0.1:> ping
PONG
补充
检查redis是否设置了密码
127.0.0.1:6380> CONFIG get requirepass
1) "requirepass"
2) "xxxxxx"
如果没有,也可以给redis设置密码(命令方式)
CONFIG set requirepass "xxxxxx"
因此你的redis就不容易被黑客入侵了。
我的博客即将搬运同步至腾讯云+社区,邀请大家一同入驻:https://cloud.tencent.com/developer/support-plan?invite_code=1a36zff5cc86l
最新文章
- H5 本地存储一
- tomcat优化
- 《你必须知道的.NET》读书笔记:从Hello World认识IL
- 【Java每日一题】20161208
- iOS 申请测试用的远程推送证书
- ios-model数据结构
- Leetcode: Minimum Number of Arrows to Burst Balloons
- php闭包支持
- matlab参数查询
- 常规SQL注入脚本
- oracle分布式事务总结-转载
- 【搬运】【备份】imrc文件
- Upstart概述引导方法事件驱动的任务和服务
- 2015西雅图微软总部MVP峰会
- 一个吊丝android个人开发者的逆袭之路
- 中软卓越IT培训:给IT程序员的18个忠告
- (三):C++分布式实时应用框架——系统管理模块
- Node Express 初探
- Settings >; Editor >; Live Templates 中自定义快速输入
- redis-sentinel高可用配置(2)
热门文章
- uvm设计分析——reg
- php年会抽奖
- Delphi7打开项目提示'one or more lines were too long and has been truncated'
- pypi上传问题
- IntelliJ Idea 使用笔记
- Six advantages of Nissan consult 3 diagnostic tool
- 忘记mysql密码时对密码进行更改
- 什么是DNS攻击?它是如何工作的?
- opencv学习之路(25)、轮廓查找与绘制(四)——正外接矩形
- UVA11995 I Can Guess the Data Structure!