Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
10714308
Unverified
Commit
10714308
authored
Jun 27, 2021
by
Yossi Gottlieb
Committed by
GitHub
Jun 27, 2021
Browse files
Corrections about the new protected-mode usage. (#9143)
parent
b71c5849
Changes
2
Hide whitespace changes
Inline
Side-by-side
redis.conf
View file @
10714308
...
...
@@ -79,7 +79,10 @@
# running on).
#
# IF YOU ARE SURE YOU WANT YOUR INSTANCE TO LISTEN TO ALL THE INTERFACES
# JUST COMMENT OUT THE FOLLOWING LINE.
# COMMENT OUT THE FOLLOWING LINE.
#
# You will also need to set a password unless you explicitly disable protected
# mode.
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bind
127
.
0
.
0
.
1
-::
1
...
...
@@ -98,20 +101,13 @@ bind 127.0.0.1 -::1
# Protected mode is a layer of security protection, in order to avoid that
# Redis instances left open on the internet are accessed and exploited.
#
# When protected mode is on and if:
#
# 1) The server is not binding explicitly to a set of addresses using the
# "bind" directive.
# 2) No password is configured.
#
# The server only accepts connections from clients connecting from the
# IPv4 and IPv6 loopback addresses 127.0.0.1 and ::1, and from Unix domain
# sockets.
# When protected mode is on and the default user has no password, the server
# only accepts local connections from the IPv4 address (127.0.0.1), IPv6 address
# (::1) or Unix domain sockets.
#
# By default protected mode is enabled. You should disable it only if
# you are sure you want clients from other hosts to connect to Redis
# even if no authentication is configured, nor a specific set of interfaces
# are explicitly listed using the "bind" directive.
# even if no authentication is configured.
protected
-
mode
yes
# Accept connections on the specified port, default is 6379 (IANA #815344).
...
...
src/networking.c
View file @
10714308
...
...
@@ -1001,9 +1001,8 @@ void clientAcceptHandler(connection *conn) {
if
(
strcmp
(
cip
,
"127.0.0.1"
)
&&
strcmp
(
cip
,
"::1"
))
{
char
*
err
=
"-DENIED Redis is running in protected mode because protected "
"mode is enabled, no bind address was specified, no "
"authentication password is requested to clients. In this mode "
"connections are only accepted from the loopback interface. "
"mode is enabled and no password is set for the default user. "
"In this mode connections are only accepted from the loopback interface. "
"If you want to connect from external computers to Redis you "
"may adopt one of the following solutions: "
"1) Just disable protected mode sending the command "
...
...
@@ -1017,7 +1016,7 @@ void clientAcceptHandler(connection *conn) {
"mode option to 'no', and then restarting the server. "
"3) If you started the server manually just for testing, restart "
"it with the '--protected-mode no' option. "
"4) Setup a
bind address or
an authentication password. "
"4) Setup a an authentication password
for the default user
. "
"NOTE: You only need to do one of the above things in order for "
"the server to start accepting connections from the outside.
\r\n
"
;
if
(
connWrite
(
c
->
conn
,
err
,
strlen
(
err
))
==
-
1
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment