반응형

Redis ERR Client sent AUTH, but no password is set


이런 에러가 나올때가 있다.  


Request for authentication in a password-protected Redis server. Redis can be instructed to require a password before allowing clients to execute commands. This is done using the requirepass directive in the configuration file.

If password matches the password in the configuration file, the server replies with the OK status code and starts accepting commands. Otherwise, an error is returned and the clients needs to try a new password.

Note: because of the high performance nature of Redis, it is possible to try a lot of passwords in parallel in very short time, so make sure to generate a strong and very long password so that this attack is infeasible.


(출처 : https://redis.io/commands/auth)


내용을 살펴 보자면 Redis는 Client 가 command를 실행하기 위해서 password를 요구할수 있다. 그리고 그 패스워드는 configuration file 에 requirepass로 저장되어 있다. 바로 저 requiredpass가 없을때 위와 같은 에러메세지가 나온다. 


1
2
3
4
5
6
7
8
9
10
11
12
13
$ redis-cli -6379
127.0.0.1:6379> config get requirepass
1"requirepass"
2""
127.0.0.1:6379> config set requirepass mypass
OK
127.0.0.1:6379> config get requirepass
(error) NOAUTH Authentication required.
127.0.0.1:6379> auth mypass
OK
127.0.0.1:6379> config get requirepass
1"requirepass"
2"mypass"
cs


값을 설정하기 위해서는 위와 같은 절차로 진행 하면 된다. 

redis-cli -p 6379 를 통해서 redis 접속후에 config get requirepass 명령어를 실행해본다. requirepass 가 위와 같이 빈값으로 나올 경우 set 명령어를 통해서 requirepass를 설정해준다. 그리고 설정해준 password 에 auth 설정을 해주면 모든 절차는 끝났다. 그리고 다시 실행해보면 에러는 발생하지 않는다. 



728x90
반응형

+ Recent posts