개발이야기
redis 서버 외부 접근 오픈 및 password 설정
준호씨
2017. 9. 27. 00:03
반응형
CentOS Linux 7 기준이다. redis 버전은 3.2 이다. 환경에 따라 조금씩 방식이 달라질 수 있다.
외부 접속 오픈
redis 서버를 centos 에 그냥 설치 했더니 locahost 에서만 접근 가능 한 상태.
외부에서도 접근 가능 한게 편할거 같아서 설정 수정
/etc/redis.conf 파일 수정
bind 설정이 bind 127.0.0.1 로 되어 있는데 이렇게 되면 localhost 에서만 접근 가능 하다.
bind 설정을 주석처리 해 주면 어디서나 접근 가능하다.
bind 설정을 주석처리 하면 아무나 접근 가능 하다는게 문제가 될 수 있음.
password 설정
password 를 설정하려면 /etc/redis.conf 에서 requirepass 를 설정 해 주면 된다.
단순하게 패스워드를 만들면 손쉽게 패스워드가 뚫릴 수 있다. redis 의 응답은 매우 빼르기 때문에 최대 초당 15만번씩 시도 해 볼 수 있다.
$ echo "mypassword" | sha256sum
ddec437eeb1da25a146a24c432d1165bc646daa7fecc6aa14c636265c83caa14 -
재시작
재시작 해서 적용 한다.
sudo systemctl restart redis
참고
How To Secure Your Redis Installation on Ubuntu 14.04 https://www.digitalocean.com/community/tutorials/how-to-secure-your-redis-installation-on-ubuntu-14-04
반응형