未验证 提交 27898671 编写于 作者: J Jorge Y. C. Rodriguez 提交者: GitHub

fix: miss matched md formatting (#441)

* fix: fix reverse link

- Add title to readme

* fix: md formatting

* fix: md formatting

* fix: md formatting
Co-authored-by: Nlabuladong <labuladong@foxmail.com>
上级 b7629db9
# Fucking algorithm
English translation is in progress... Some articles are still in Chinese, but most are completed. Please **star** this repo. The full translation will eventually be finished. Enjoy.
These articles go over different kinds of **Algorithmic Thinking**. All are based on LeetCode problems. They are **not only the solution code for the problem, but also WHY the solution works and HOW we can figure it out**.
I don't like one-liners. They can be confusing. I like clear, easily understandable code.
The **Gitbook** has been deployed and will sync with this branch of the repo: https://labuladong.gitbook.io/algo-en/
The **Gitbook** has been deployed and will sync with this branch of the repo: [https://labuladong.gitbook.io/algo-en/](https://labuladong.gitbook.io/algo-en/)
If you want to clone this repo, please use following command:
```shell
git clone --depth 1 --branch english https://github.com/labuladong/fucking-algorithm.git
```
This command specifies the `english` branch and will limit the depth of the clone and get rid of the Git commit history, which can be faster to clone.
# Table of Contents
## Table of Contents
* I. Dynamic Programming
* [Dynamic Programming in Details](dynamic_programming/AnalysisOfDynamicProgramming.md)
......
# Cryptology
Speaking of cipher, the first thing that comes to our mind is the password to login, but from the point of cryptography, it is the unqualified cipher.
Why? Because the password of our account depends on crypticity, that is I keep the password in my mind and do not let you know,so you can not login in with my account.
......@@ -11,9 +13,9 @@ if the receiver know the way to decrypt,the eavesdropper should also know.
In the following **we will introduce symmetric encryption algorithm、key exchange algorithm、asymmetrical encryption algorithm、digital signature、public-key certificate** to explain how we solve the problem of secure transmission.
### First、Symmetric Encryption
## First, Symmetric Encryption
symmetric ciphers,also called shared key cipher,as the name suggests,it uses the same key to encrypt and decrypt.
Symmetric ciphers,also called shared key cipher,as the name suggests,it uses the same key to encrypt and decrypt.
First of all,we know information consists of 0/1 bits sequence and the xor of two identical bits sequence is 0.
......@@ -30,7 +32,7 @@ invulnerable algorithm is broken.
Therefore, the two most common algorithms to solve the key distribution problem are diffie-hellman key exchange algorithm and asymmetric encryption algorithm.
### Second、Key exchange algorithm
## Second、Key exchange algorithm
The secret key as we say is a big number, the algorithm use this number to encrypt and decrypt. The problem is that transition is insecure and the data can be eavesdropped.In other words, is there a way that it can let two people exchange the key in the front of others?
......@@ -73,14 +75,14 @@ Above is the basic flow, as for picking which number, it is exquisite and I won'
Under the premise of the third party's eavesdropping, the algorithm can calculate a secret which can not be calculated by others as the key of symmetric encryption algorithm and start the communication of symmetric encryption.
About this algorithm, Hack come up with a crack way, not to eavesdrop Alice and Bob's communication, but to pretend to be Alice and Bob at the same time, that is man-in-middle attack.
![](../pictures/密码技术/6.jpg)
In this way, both parties can't realize that they are sharing secrets with Hack. As a result, Hack can decrypt or even modify data.
**So, key exchange algorithm can not perfectly resolve the distribution of the key, the weakness lies in not being able to verify the identity of the receiver**.So, before using exchange key algorithm, we must verify the identity. For example, using the digital signature.
### Third、Asymmetrical encryption
## Third、Asymmetrical encryption
The thinking of the asymmetrical encryption is that don't sneak around with the transmission key. I separate the encryption key from the decryption key and use the public key to encrypt and the private to decrypt.Only send the public key to the receivers and they can send me encrypted data that I can use my private key to decrypt.About the eavesdropper,it is useless to get the data and the public key, because only the private key can be used to decrypt.
......@@ -107,7 +109,7 @@ Digital signature takes the advantage of asymmetrical encryption,but reverses th
You may ask what is the purpose? The public key can decrypt the data,but I still encrypt the data and release.Isn't that a superfluous act?
Yes,but ** the digital signature is not used to ensure the confidentiality of the data,but is used to verify your identity,** to prove that the data comes from you.
Yes,but **the digital signature is not used to ensure the confidentiality of the data,but is used to verify your identity,** to prove that the data comes from you.
You can image the data encrypted by you private key can only be decrypted by you public key,so if the encrypted data can be decrypted by you public key,can't it prove that the data comes from yourself?
......@@ -120,35 +122,36 @@ Of course,the encrypted data is just a signature that should be released with th
3 Alice receives the data the the signature and needs to check does the data come from Bob.So he use the public key released by Bob to decrypt and compare the decrypted data with the received data.If they are the same,it proves that the data is origin and comes from Bob.
Why Alice can conclude? After all,the data and the signature,either can be exchanged.The reason is as follows:
1 If someone modify the data,Alice will know after he decrypt the data and find the difference.
2 If someone exchange the signature,Alice will get the wrong code after decryption and it is obviously different from the original data.
1. If someone modify the data,Alice will know after he decrypt the data and find the difference.
3 someone may tend to modify the data and regenerate the signature so that Alice can not find the difference;but he can not generate the signature because he do not have the private key of Bob.
2. If someone exchange the signature,Alice will get the wrong code after decryption and it is obviously different from the original data.
3. someone may tend to modify the data and regenerate the signature so that Alice can not find the difference;but he can not generate the signature because he do not have the private key of Bob.
In Summary,**digital signature can verify the origin of the data to some degree**.The reason is that it can be cracked by man-in-middle attack. Once it comes to the distribution of the public key, the receiver may receive the fake public key and make the wrong verification, Which can not be avoided.
Ridiculously, digital signature is a way verify the identity of others with the assumption that the identity of others is real.It seems like a dead cycle.**There must exist a trusted origin to verify the identity of others,Or no matter how many processes are used, they are just transferring problems, not really solving them.**
### Fifth、Public-key certificate
## Fifth, Public-key certificate
**The public-key certificate is the public key plus the signature,issued by a trusted third party certification authority**。Introducing the trusted third part is one of the feasible solution of dependency cycle.
The process of certificate is as follows:
1 Bob goes to the trusted certification authority to verify the identity of himself and provide his public key.
1. Bob goes to the trusted certification authority to verify the identity of himself and provide his public key.
2 Alice who wants to communicate with Bob, request the public key of Bob from the certification authority and then certification authority will give the certificate of Bob(it contains Bob's public key and the signature of his public key) to Alice.
2. Alice who wants to communicate with Bob, request the public key of Bob from the certification authority and then certification authority will give the certificate of Bob(it contains Bob's public key and the signature of his public key) to Alice.
3 Alice check the signature adn verify that the public key comes from the certificate authority and not tampered in halfway.
3. Alice check the signature adn verify that the public key comes from the certificate authority and not tampered in halfway.
4 Alice encrypts the data through this public key and starts to communicate with Bob.
4. Alice encrypts the data through this public key and starts to communicate with Bob.
![图片来自《图解密码技术》](../pictures/密码技术/7.jpg)
![llustrated Cryptographic Technology](../pictures/密码技术/7.jpg)
PS: the above is for description.In real,certificate is only installed once instead of request from certificate authority every time and it is the server sends the certificate to client not the certificate authority.
> PS: the above is for description.In real,certificate is only installed once instead of request from certificate authority every time and it is the server sends the certificate to client not the certificate authority.
Some people may ask if Alice want to verify the validity of the certificate, he must have the public key of the authority.Isn't it the dead cycle mentioned just now?
Some people may ask if Alice want to verify the validity of the certificate, he must have the public key of the authority.Isn't it the dead cycle mentioned just now?
The regular browser we pre-installed contains trusted certificate to verity the identity of certificate authority,so the certificate is credible.
......@@ -158,7 +161,7 @@ Except for the trusted public key of Bob, the communication of Alice and Bob is
Most of the regular websites nowadays apply HTTPS protocol, that adds a SSL/TLS secure layer between the HTTP protocol and the TCP protocol. After the TCP handshake, SSL protocol layer also handshake to exchange secure information including the certificate of the website, so that the browser can verify the website. After SSL layer finish the verification, the data in the HTTP protocol is encrypted to guarantee secure transmission.
### Sixth、Summary
## Sixth, Summary
Symmetric encryption algorithm use the same secret key to encrypt and decrypt, is hard to crack, encrypt quickly, but has the problem of secret key transmission.
......@@ -174,4 +177,3 @@ The public-key certificate is the public key plus the signature,issued by a trus
The SSL/TLS secure layer in HTTPS protocol includes these encryption methods above.**So do not install irregular browser and certificate of unknown source**.
Cryptography is a little part of the security.Even though the HTTPS websites certified by a formal authority are not totally trusted,it only indicates the transition of the data is safe.Technology can not protect you.The most important thing is to improve personal safety awareness,pay more attention and handle sensitive data carefully.
......@@ -6,7 +6,7 @@
Everyone should be familiar with cookies. For example after logging on the website, you will be asked to log in again. Or some guys play with python, but websites just block your crawlers. These are all related to cookies. If you understand the server backend's processing logic for cookies and sessions, you can explain these phenomena, and even drill some holes indefinitely, let me talk it slowly.
### 1.Introduction to session and cookie
## 1.Introduction to session and cookie
The emergence of cookie because HTTP is a stateless protocol, In other words, the server can't remember you, and every time you refresh the web page, you have to re-enter your account password to log in. It's hard to accept. Cookie is like the server tagged you, and the server recognizes you every time you make a request to the server.
......@@ -18,18 +18,18 @@ Cookie can be set on the sever through the “SetCookie” field of HTTP, such a
```go
func cookie(w http.ResponseWriter, r *http.Request) {
// 设置了两个 cookie
http.SetCookie(w, &http.Cookie{
Name: "name1",
Value: "value1",
})
http.SetCookie(w, &http.Cookie{
Name: "name2",
Value: "value2",
})
// 将字符串写入网页
fmt.Fprintln(w, "页面内容")
// Set up two cookies
http.SetCookie(w, &http.Cookie{
Name: "name1",
Value: "value1",
})
http.SetCookie(w, &http.Cookie{
Name: "name2",
Value: "value2",
})
// Write string back
fmt.Fprintln(w, "content")
}
```
......@@ -65,25 +65,24 @@ This type of plugin can read the browser's cookies on the current web page, open
The above is a brief introduction to cookies and sessions. Cookie is a part of the HTTP protocol and are not complicated. So let's take a look at the code architecture to implement session management in detail.
### 2.Implementation of session
## 2.Implementation of session
The principle of session is not difficult, but it is very skillful to implement it. Generally, three components are required to complete it. They respectively are`Manager`,`Provider` and `Session` three classes (interface).
![](../pictures/session/4.jpg)
1.The browser requests the page resource of the path `/content` rom the server over the HTTP protocol, there is a Handler function on the corresponding path to receive the request, parses the cookie in the HTTP header, and gets the session ID stored in it,then send this ID to the `Manager`.
1. The browser requests the page resource of the path `/content` rom the server over the HTTP protocol, there is a Handler function on the corresponding path to receive the request, parses the cookie in the HTTP header, and gets the session ID stored in it,then send this ID to the `Manager`.
2.`Manager`acts as a session manager, mainly storing some configuration information, such as the lifetime of the session, the name of the cookie, and so on. All sessions are stored in a `Provider` inside the `Manager`.So `Manager` passes the `Sid` (session ID) to the `Provider` to find out which session that ID corresponds to.
2. `Manager`acts as a session manager, mainly storing some configuration information, such as the lifetime of the session, the name of the cookie, and so on. All sessions are stored in a `Provider` inside the `Manager`.So `Manager` passes the `Sid` (session ID) to the `Provider` to find out which session that ID corresponds to.
3.`Provider` is a container, most commonly a hash table that maps each `Sid` to its session. After receiving the `Sid` passed by the `Manager`, it finds the session structure corresponding to the `Sid`, which is the session structure, and returns it.
3. `Provider` is a container, most commonly a hash table that maps each `Sid` to its session. After receiving the `Sid` passed by the `Manager`, it finds the session structure corresponding to the `Sid`, which is the session structure, and returns it.
4.`Session` stores the user's specific information. The logic in the Handler function takes out this information, generates the user's HTML page, and returns it to the client.
4. `Session` stores the user's specific information. The logic in the Handler function takes out this information, generates the user's HTML page, and returns it to the client.
So you might ask, why make such a trouble, why not directly in the Handler function to get a hash table, and then store the `Sid` and `Session` structure mapping ?
**That's the design trick!** Let's talk about why it is divided into `Manager``Provider` and `Session`
Let's start with `Session` at the bottom. Since session is a key-value pair, why not use a hash table directly, but abstract such a data structure?
First, because the `Session` structure may not only store a hash table, but also some auxiliary data, such as `Sid`, number of accesses, expiration time, or last access time, which is easy to implement algorithms like LRU and LFU.
......@@ -94,12 +93,12 @@ Therefore, `Session` structure provides a layer of abstraction to shield the dif
```go
type Session interface {
// 设置键值对
// Set key-value pairs
Set(key, val interface{})
// 获取 key 对应的值
// Get the value by key
Get(key interface{}) interface{}
// 删除键 key
Delete(key interface{})
// Remove key
Delete(key interface{})
}
```
......@@ -111,25 +110,23 @@ Therefore, `Provider` as a container is to shield algorithm details and organize
```go
type Provider interface {
// 新增并返回一个 session
// Add and return session
SessionCreate(sid string) (Session, error)
// 删除一个 session
// Delete a session
SessionDestroy(sid string)
// 查找一个 session
// Read a session
SessionRead(sid string) (Session, error)
// 修改一个session
// Update a session
SessionUpdate(sid string)
// 通过类似 LRU 的算法回收过期的 session
SessionGC(maxLifeTime int64)
// Recycle expired sessions through an algorithm similar to LRU
SessionGC(maxLifeTime int64)
}
```
Finally, `Manager`, most of the specific work is delegated to `Session` and the `Provider`, `Manager` is mainly a set of parameters, such as the survival time of the session, the strategy to clean up expired sessions, and the session's available storage methods. `Manager` blocks the specific details of the operation, and we can flexibly configure the session mechanism through `Manager`.
In summary, the main reason for the session mechanism to be divided into several parts is decoupling and customization. I have seen several use Go to implement session services on Github, the source code is very simple, if you are interested you can learn:
https://github.com/alexedwards/scs
https://github.com/astaxie/build-web-application-with-golang
<https://github.com/alexedwards/scs>
<https://github.com/astaxie/build-web-application-with-golang>
# What are Process, Thread, and File Descriptor in Linux?
# What are Processes, Thread, and File Descriptor in Linux
**Translator: [Seaworth](https://github.com/Seaworth)**
......@@ -8,7 +8,7 @@ Speaking of process, I am afraid that the most common problem of interviews is t
A process of Linux is a data structure. You can clearly understand the underlying working principle of file descriptors, redirection, and pipeline commands. Finally, from the perspective of operating system, we can see why there is basically no difference between thread and process.
### 一、What is a process?
## 一、What is a process
First, abstractly, our computer is this thing as follows:
......@@ -26,21 +26,21 @@ So, how does the operating system create processes? **For the operating system,
```cpp
struct task_struct {
// Process status
// Process status
/* -1 unrunnable, 0 runnable, >0 stopped: */
long state;
// Virtual memory structure
struct mm_struct *mm;
// Process number
pid_t pid;
// Pointer to parent process
struct task_struct __rcu *parent;
// Children form the list of natural children:
struct list_head children;
// Pointer to filesystem information:
struct fs_struct *fs;
// Open file information:
struct files_struct *files;
long state;
// Virtual memory structure
struct mm_struct *mm;
// Process number
pid_t pid;
// Pointer to parent process
struct task_struct __rcu *parent;
// Children form the list of natural children:
struct list_head children;
// Pointer to filesystem information:
struct fs_struct *fs;
// Open file information:
struct files_struct *files;
};
```
......@@ -48,13 +48,13 @@ struct task_struct {
The interesting ones are the `mm` pointer and the `files` pointer. The `mm` pointer refers to the virtual memory of the process, which is where the resources and executable files are loaded. The `files` pointer points to an array containing pointers to all files opened by the process.
### 二、What is a file descriptor?
## 二、What is a file descriptor
Let's start with `files`, which is an array of file pointers. Generally, a process will read input from `files[0]`, write output to `files[1]`, and write error information to `files[2]`.
For example, from our perspective, the `printf` function in C is to print characters to the command line, but from the process perspective, it is to write data to `files[1]`. Similarly, the `scanf` function is that the process reads data from `files[0]`.
**When each process is created, the first three bits of `files` are filled with default values, which point to standard input stream, standard output stream, and standard error stream, respectively. We often say `file descriptor` refers to the index of this file pointer array **. So the file descriptor of the program by default : 0 represents standard input (stdin), 1 is standard output (stdout), 2 is standard error (stderr).
**When each process is created, the first three bits of `files` are filled with default values, which point to standard input stream, standard output stream, and standard error stream, respectively. We often say `file descriptor` refers to the index of this file pointer array**. So the file descriptor of the program by default : 0 represents standard input (stdin), 1 is standard output (stdout), 2 is standard error (stderr).
We can redraw a picture as follows:
......@@ -71,7 +71,7 @@ If the program we wrote needs other resources, such as opening a file for readin
Understand this principle, **input redirection** is easy to understand. When the program wants to read data, it will read `files[0]`. So we just point `files[0]` to a file. Then the program will read the data from this file instead of the keyboard. the **less-than character <** is used to redirect the input of a command.
```shell
$ command < file.txt
command < file.txt
```
![](../pictures/linuxProcess/5.jpg)
......@@ -79,7 +79,7 @@ $ command < file.txt
Similarly, **output redirection** is to point `files[1]` to a file. So the output of the program will not be written to the display, but to this file. The **greater-than character >** is used for output redirection.
```shell
$ command > file.txt
command > file.txt
```
![](../pictures/linuxProcess/4.jpg)
......@@ -89,22 +89,22 @@ Error redirection is the same, so I will not go into details.
**Pipe symbol** is actually the same. It connects the output stream of one process with the input stream of another process, and the data is passed in it. I have to say that this design idea is really beautiful.
```shell
$ cmd1 | cmd2 | cmd3
cmd1 | cmd2 | cmd3
```
![](../pictures/linuxProcess/6.jpg)
At this point, you may also see the clever design idea of **Everything is a file in Linux**. Whether it is a device, a process, a socket, or a real file, all of them can be read and written. And they are loaded into a simple `files` array. The specific details are delivered to the operating system, which is effectively decoupled, beautiful and efficient.
### 三、What is a thread?
## 三、What is a thread
The first thing to be clear is that multi-process and multi-thread can achieve concurrency to improve the utilization efficiency of the processor. So the key now is what's the difference between multi-thread and multi-process.
Why is there basically no difference between thread and process in Linux? From the perspective of the Linux kernel, thread and process are not treated differently.
Why is there basically no difference between thread and process in Linux? From the perspective of the Linux kernel, thread and process are not treated differently.
We know that the system call `fork()` function can create a new child process. And the function `pthread()` can create a new thread. **But both thread and process are represented by the `task_struct` structure. The only difference is the shared data area**.
In other words, threads look no different from processes. It's just that some data areas of a thread are shared with its parent process. However, a child process is a copy, not a share. For example, the `mm` structure and the ` files` structure are shared across threads, I drew two pictures and you will understand.
In other words, threads look no different from processes. It's just that some data areas of a thread are shared with its parent process. However, a child process is a copy, not a share. For example, the `mm` structure and the `files` structure are shared across threads, I drew two pictures and you will understand.
![](../pictures/linuxProcess/7.jpg)
......@@ -118,6 +118,6 @@ Because in reality the concurrency of data sharing is more common. For example,
Of course, it must be explained that only Linux systems treat thread as process that shares data, and do not treat them specifically, do not treat thread and process differently. Many other operating systems treat thread and process differently. Threads have their own unique data structures. I personally think that this design is not as concise as Linux and increases the complexity of the system.
Creating threads and processes are very efficient in Linux. For the problem of memory area copy, Linux uses the copy-on-write optimization strategy when creating a process. The memory space of parent process is not actually copied, but only copied during the write operation. **So creating processes and threads in Linux are very fast**.
Creating threads and processes are very efficient in Linux. For the problem of memory area copy, Linux uses the copy-on-write optimization strategy when creating a process. The memory space of parent process is not actually copied, but only copied during the write operation. **So creating processes and threads in Linux are very fast**.
Stick to original high-quality articles, committed to making algorithmic problems clear. Welcome to follow us on WeChat public account **labuladong** for latest articles.
\ No newline at end of file
Stick to original high-quality articles, committed to making algorithmic problems clear. Welcome to follow us on WeChat public account **labuladong** for latest articles.
# Things you must know about Linux Shell
# Things you must know about Linux Shell
**Translator: [Tianhao Zhou](https://github.com/tianhaoz95)**
......@@ -16,7 +16,7 @@ Although Windows has advantages over Linux in terms of graphical interfaces, due
4. How does `sudo` make commands `not found`?
### 1. The difference between standard input and variables
## 1. The difference between standard input and variables
The difference between standard input and variables boils down to the question of when to use pipe `|` and redirecting `>`, `<` vs. when to use variables `$`.
......@@ -30,13 +30,13 @@ $ where connect.sh
To remove the script with minimal effort, I tried:
```shell
$ where connect.sh | rm
where connect.sh | rm
```
However, the command above is incorrect. The proper way is:
```shell
$ rm $(where connect.sh)
rm $(where connect.sh)
```
The former attempts to pipe the output from `where` into the standard input of `rm`, whereas the latter passes it in as an variable.
......@@ -60,7 +60,7 @@ hello world
**If a command can clog the terminal, then it accepts standard input and vice versa.** For example, running "cat" without arguments will suspend (intentionally clog) the terminal to wait for user input and print back the same content.
### 2. Why processes running on the background exit upon terminal termination?
## 2. Why processes running on the background exit upon terminal termination
For example, we want to spin up a Django web server on a remote server:
......@@ -96,7 +96,7 @@ $ nohup some_cmd &
`nohup` functions similarly, but with extensive testing, `(cmd &)` appears to be more stable.
### 3. Single-quotes vs. double-quotes
## 3. Single-quotes vs. double-quotes
Shells with different flavors behave differently, but with one invariant: **for `$`,`(`,`)`, single-quote won't trigger evaluation, but double-quote will.**
......@@ -108,7 +108,7 @@ As shown above, `echo $(cmd)` and `echo "$(cmd)"` differ slightly. Look closely,
**As a result, if the literal value from `$` contains space, we should use double-quote to avoid errors.**
### 4. How does `sudo` make commands `not found`?
## 4. How does `sudo` make commands `not found`
Under certain situations, a command that non-privileged users can execute becomes "not found" when privileged users try to run with `sudo`:
......@@ -123,7 +123,7 @@ sudo: command not found
The root cause is that the `connect.sh` script only exists in the user's environment variables.
```shell
$ where connect.sh
$ where connect.sh
/home/fdl/bin/connect.sh
```
......@@ -132,5 +132,5 @@ $ where connect.sh
The solution is to locate the script with a path instead of a name:
```shell
$ sudo /home/fdl/bin/connect.sh
sudo /home/fdl/bin/connect.sh
```
# Redis attack
**Translator: [natsunoyoru97](https://github.com/natsunoyoru97)**
**Author: [labuladong](https://github.com/labuladong)**
......@@ -10,11 +12,11 @@ I also know that he ran an open-source program which is too old to maintain. His
P.S. Such an attack doesn't work anymore because the updated version of Redis adds the protect mode, which is safer. We can only simulate the attack on the local.
### How Did It Go?
## How Did It Go
This attack was in 2015, in which Redis was poor in security. The security of the database only depended on SREs. There are thousands of nodes was attacked and the weird things happened like mentioned above. All data was emptied with only one key called `crackit` left, and the value looks like the string of the RSA public key.
It came out that the hackers applied dynamic configuration and persistence, and write their RSA public keys into `/root/.ssh/authored_keys` in the victims' computers, so they can use the private key to log in the root of the servers then invade the systems.
It came out that the hackers applied dynamic configuration and persistence, and write their RSA public keys into `/root/.ssh/authored_keys` in the victims' computers, so they can use the private key to log in the root of the servers then invade the systems.
The servers have been attacked are poor in security:
......@@ -26,7 +28,7 @@ The servers have been attacked are poor in security:
ANY of these points make the server vulnerable, and it is lethal when added on. Despite your system contains the public key of others, it is a big loss if your database were emptied by the malicious operation. So what are the steps to do such an attack? I'll show you on my local loopback address.
### Performing on Local
## Performing on Local
The default port of Redis is 6379, and we set it receives the connection from NIC 127.0.0.1, so I can connect to Redis on local to simulate the scenario that Redis can be visited from the public internet.
......@@ -62,7 +64,7 @@ Maybe the messy code is encoded in the GDB file, but the public key is completel
Now I own the root privilege and can do anything I would like to do …
### Lessons Learnt
## Lessons Learnt
It is nearly impossible to be the victim of such kind of attack (the updated version of Redis is not available when there is no password in default), but everyone is supposed to be vigilant about the system security.
......@@ -82,7 +84,7 @@ Turn back to the usage of Redis, its official site has listed the advice to prot
3. Disable commands in Redis or to rename them into an unguessable name, so that normal clients are limited to a specified set of commands.
### See Also
## Also See
[Redis Security](https://redis.io/topics/security)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册