Weil Jimmer's BlogWeil Jimmer's Blog


[筆記] 提升 Redis 服務安全

-
更新於 2023-09-10 21:33:36

最近看不少文章提到 redis 的一些問題,寫本文章僅作為筆記。

端口不開放到公網

修改 /etc/redis/redis.conf ,將 0.0.0.0:6379 修改為 127.0.0.1:6379。

bind 127.0.0.1

如果是 0.0.0.0:6379 的話,非常非常的危險。不知道為什麼查到網路上文章指出預設值是 0.0.0.0,我自己裝的話預設值都是 127.0.0.1。可能新版本已經把預設值修改了。

關閉 CONFIG 命令

修改 /etc/redis/redis.conf ,將 CONFIG 命令禁止。

rename-command CONFIG ""

加入密碼

修改 /etc/redis/redis.conf ,新增 requirepass 配置,加入高強度密碼。

requirepass "aP~xzGJ8nhu2ti483ZvNX7zoH8XoN38E"

驗證

重啟 redis 服務。

service redis restart

使用 redis-cli 確定剛剛的配置是否生效。

# redis-cli
127.0.0.1:6379> set "test" "test"
(error) NOAUTH Authentication required.
127.0.0.1:6379> config
(error) ERR unknown command 'config'
127.0.0.1:6379>

This entry was posted in Experience, Note By Weil Jimmer.

About Weil Jimmer

avatar

Hi! Everyone! My name is Weil Jimmer. This is my personal blog. I'm a webmaster of this site. I hope the site will be popular. Now, Let's go! Enjoy gaining more knowledge.
More Details About Me : https://weils.net/profile.php

Leave a Reply

Name*:

Email*:

Website:

Privacy:   

Comment*:

Visitor Count

pop
nonenonenone

Note

支持網路中立性.
Support Net Neutrality.

飽暖思淫欲,饑寒起盜心。

支持臺灣實施無條件基本收入

歡迎前來本站。

Words Quiz


Search

Music

Blogging Journey

4339days

since our first blog post.

The strong do what they can and the weak suffer what they must.

Privacy is your right and ability to be yourself and express yourself without the fear that someone is looking over your shoulder and that you might be punished for being yourself, whatever that may be.

It is quality rather than quantity that matters.

I WANT Internet Freedom.

Reality made most of people lost their childishness.

Justice,Freedom,Knowledge.

Without music life would be a mistake.

Support/Donate

This site also need a little money to maintain operations, not entirely without any cost in the Internet. Your donations will be the best support and power of the site.
MethodBitcoin Address
bitcoin1gtuwCjjVVrNUHPGvW6nsuWGxSwygUv4x
buymeacoffee
Register in linode via invitation link and stay active for three months.Linode

Support The Zeitgeist Movement

The Zeitgeist Movement

The Lie We Live

The Lie We Live

The Questions We Never Ask

The Questions We Never Ask

Man

Man

THE EMPLOYMENT

Man

In The Fall

In The Fall

Facebook is EATING the Internet

Facebook

Categories

Android (7)

Announcement (4)

Arduino (2)

Bash (2)

C (3)

C# (5)

C++ (1)

Experience (52)

Flash (2)

Free (13)

Functions (36)

Games (13)

General (60)

Git (2)

HTML (7)

Java (13)

JS (7)

Mood (24)

NAS (2)

Note (32)

Office (1)

OpenWrt (6)

PHP (9)

Privacy (4)

Product (12)

Python (4)

Software (11)

The Internet (25)

Tools (16)

VB.NET (8)

WebHosting (7)

Wi-Fi (5)

XML (4)