> For the complete documentation index, see [llms.txt](https://huang-jason.gitbook.io/web-general/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://huang-jason.gitbook.io/web-general/security.md).

# Security - SSH/firewall/VPN

## 1. SSH Keys

* **private key** is kept secret and **secure by the user**
* **public key** can be shared with anyone.
* Password - you can try to get correct one.
* SSH - have many more bits of data, and it is harder to guess.

![](/files/-Lq83V28g-Ias5XMRs2l)

## 2. Firewalls

![](/files/-Lq83V2AXczEFQgy_dmu)

## VPNs and Private Networking

![](/files/-Lq83V2Cnz25fOtpmhln)

<https://www.digitalocean.com/community/tutorials/how-to-secure-traffic-between-vps-using-openvpn>

## 3. Public Key Infrastructure and SSL/TLS Encryption

Prevent **man-in-the-middle** attacks

![](/files/-Lq83V2Ews2_T74CIZpN)

## 4. Service Auditing

discovering what services are running on the servers in your infrastructure.

```
sudo netstat -plunt
```

Stay attention to are `Proto`, `Local Address`, and `PID/Program name`.

If the address is `0.0.0.0`, then the service is accepting connections on all interfaces.

![](/files/-Lq83V2GtyCQHCt-qQag)

## 5. File Auditing and Intrusion Detection Systems(IDS)

File auditing = detect changes to the system that may have been authorized.

IDS monitors a system or network for **unauthorized activity**.

<https://www.digitalocean.com/community/tutorials/how-to-use-tripwire-to-detect-server-intrusions-on-an-ubuntu-vps>

<https://www.digitalocean.com/community/tutorials/how-to-install-aide-on-a-digitalocean-vps>

## 6. Isolated Execution Environments

Separating your components can limit the access that an intruder has to other pieces of your infrastructure.\
![](/files/-Lq83V2IVbw8emPC4SBp)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://huang-jason.gitbook.io/web-general/security.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
