Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/61.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 强制验证的Redis服务器,但未配置为requirepass_Ruby On Rails_Authentication_Redis_Resque_Digital Ocean - Fatal编程技术网

Ruby on rails 强制验证的Redis服务器,但未配置为requirepass

Ruby on rails 强制验证的Redis服务器,但未配置为requirepass,ruby-on-rails,authentication,redis,resque,digital-ocean,Ruby On Rails,Authentication,Redis,Resque,Digital Ocean,我有一个Rails应用程序,它使用Redis进行后台工作(通过Resque)。这一切在开发和生产(在VM上)中都运行良好已有相当一段时间了。最近,在尝试访问生产中的resque web Sinatra站点以管理后台任务时,我遇到了一条内部服务器错误消息。查看web服务器日志,我可以看到错误源于Redis,因为它似乎需要用于身份验证的密码: Redis::CommandError - NOAUTH Authentication required 奇怪的是,我的redis-conf文件(/etc/

我有一个Rails应用程序,它使用Redis进行后台工作(通过Resque)。这一切在开发和生产(在VM上)中都运行良好已有相当一段时间了。最近,在尝试访问生产中的resque web Sinatra站点以管理后台任务时,我遇到了一条
内部服务器错误
消息。查看web服务器日志,我可以看到错误源于Redis,因为它似乎需要用于身份验证的密码:

Redis::CommandError - NOAUTH Authentication required
奇怪的是,我的redis-conf文件(
/etc/redis/6379.conf
)没有(据我所知,从未)启用任何身份验证(注意,这两行都被注释掉):

所以我眼前的问题是我的Redis服务器设置了密码,我不知道它是什么。我需要让它重新工作


第二个问题是,我不知道这个密码是如何设置的。该应用程序部署在DigitalOcean虚拟机上。查看redis日志没有发现任何可疑之处。我使用了推荐的SSH和自定义端口设置来提供一点访问安全性,但当然它永远不会完全安全。这个应用程序是我的一个附带项目,实际上没有任何敏感信息。然而,我确实想找出发生了什么,并阻止它再次发生。

这里的答案似乎最能解释发生了什么:


值得注意的是,这一问题的最新日期也是如此。似乎我们都是同一安全漏洞的受害者。我现在正在向Redis服务器添加密码,并将阻止VM上的Redis端口。

问题:

这个问题

service redis_6379 restart
Stopping ...
(error) NOAUTH Authentication required.
Waiting for Redis to shutdown ...
Waiting for Redis to shutdown ...
Waiting for Redis to shutdown ...
Waiting for Redis to shutdown ...
Waiting for Redis to shutdown ...
Waiting for Redis to shutdown ...
[...]
。。。发生的原因是在停止/重新启动时配置了密码身份验证而未配置密码

解决方案:

打开文件

/etc/init.d/redis_6379
。。。并更换线路

#!/bin/sh
。。。与

#!/bin/bash
# NOTE: We use that workaround because the password authentication is configured, and the pass    word is not configured at restart! By Questor
REQUIREPASS=$(sed -n 's/.*requirepass *  *\([^ ]*.*\)/\1/p' < "$CONF")
IFS=' ' read -r -a MATCH_ARRAY <<< $REQUIREPASS
$CLIEXEC -a "${MATCH_ARRAY[1]}" -p $REDISPORT shutdown

# $CLIEXEC -p $REDISPORT shutdown
。。。并更换线路

#!/bin/sh
“$CLIEXEC-p$REDISPORT关机”

。。。与

#!/bin/bash
# NOTE: We use that workaround because the password authentication is configured, and the pass    word is not configured at restart! By Questor
REQUIREPASS=$(sed -n 's/.*requirepass *  *\([^ ]*.*\)/\1/p' < "$CONF")
IFS=' ' read -r -a MATCH_ARRAY <<< $REQUIREPASS
$CLIEXEC -a "${MATCH_ARRAY[1]}" -p $REDISPORT shutdown

# $CLIEXEC -p $REDISPORT shutdown
#注意:我们使用这种解决方法是因为密码身份验证已配置,而密码在重新启动时未配置!奎斯托
REQUIREPASS=$(sed-n's/*REQUIREPASS**\([^]*.\)/\1/p'<“$CONF”)
IFS=''read-r-a MATCH_数组可能重复