Answer the question
In order to leave comments, you need to log in
Redis in Docker container (accessible from the Internet) suddenly starts writing to var/spool/cron how to solve this problem?
Just yesterday I installed a Redis 6 server in a Docker container (the container is available from the Internet). After a few hours, the container has such a problem, it starts trying to work with the var/spool/cron directory. After restarting the container, everything works fine, after a few hours the problem recurs.
I was looking for a similar problem, they write that this is supposedly due to the fact that Redis is hacked:
Link
Is this so, or is it a problem in the configuration of the dockerfile or something else, how to solve such a problem?
FROM redis:6.0-alpine
WORKDIR /usr/src/app
RUN apk add --no-cache tzdata
ENV TZ=Europe/Moscow
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
COPY redis.conf /usr/local/etc/redis/redis.conf
CMD [ "redis-server", "/usr/local/etc/redis/redis.conf" ]
RUN chmod 0755 /usr/src/app/
RUN chmod 0755 /etc/crontabs/
RUN chmod 0755 /data/
# bind 192.168.1.100 10.0.0.1
# bind 127.0.0.1 ::1
protected-mode no # Без этого не доступен из Интернета
port 6379
dbfilename dump.rdb
dir ./
user someusername allcommands allkeys on >somelongpassword # вроде бы пароль работает, без него не могу зайти
docker run -p 6379:6379 -v somevolume:/usr/src/app --name myhackedredisname -d --network somenetwork myhackedredisname_image
Answer the question
In order to leave comments, you need to log in
As the person who wrote the C++ connector for Redis correctly answered, Redis has one more user whose existence is not shown in the configuration file in any way - the default user.
This user by default does not have any password at all, under this user they logged in when hacking.
The existence of this user explains why I was getting an error when trying to make a protected mod enabled.
In the end, I turned off the default user, an alternative option to make him a password and turned on the protected mod.
Total:
Dockerfile:
FROM redis:6.0-alpine
WORKDIR /usr/src/app
RUN apk add --no-cache tzdata
ENV TZ=Europe/Moscow
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
COPY redis.conf /usr/local/etc/redis/redis.conf
CMD [ "redis-server", "/usr/local/etc/redis/redis.conf" ]
protected-mode yes
user default off
user someusername allcommands allkeys on >somelongpassword # можно также отключить часть команд
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question