# 跳板机安全设置

### 个人电脑本机开启v2ray/trojan代理再访问跳板机系统 <a href="#v2ray" id="v2ray"></a>

* 自己的电脑开启VPN、Clash等软件的全局代理，推荐使用香港IP，这样跳板机记录的登录日志就只是代理IP，而非本人真实IP地址；

### 为工作机/Windows开启v2ray/trojan代理再访问外网 <a href="#v2ray" id="v2ray"></a>

* 接入跳板机系统的Windows里，运行VPN或机场Clash代理，这样Windows访问的网站也只能记录Win里登录的VPN的IP；

### 为[跳板机系统绑定域名](/jumpserver/nextcli-domain.md)，甚至为该域名开启CloudFlare、或其他CDN <a href="#domain" id="domain"></a>

{% content-ref url="/pages/W5GuiyTaS7JB8Pjvc9V0" %}
[如何为NextCLi跳板机绑定域名](/jumpserver/nextcli-domain.md)
{% endcontent-ref %}

### 经常手动删除跳板机的登录日志列表 <a href="#delete-jumpserver-log" id="delete-jumpserver-log"></a>

![](/files/N516p7to5QpchxLgqmsq)

也可以通过计划任务+命令，自动删除本机和远程机器的日志，见下文：

### 计划任务+删除登录日志 <a href="#delete-log" id="delete-log"></a>

![注意，资产选择默认是全部，请根据自己实际情况做自定义选择。](/files/jGW0YtzUL63wMUlPYH4Q)

* 截图为CentOS删除登录日志方法，其他版本请自行Google搜索；
* corn表达式，附常用公式，辅助工具：[在线工具A](https://www.matools.com/cron) [在线工具B](https://tool.lu/crontab/)&#x20;
  * 5分钟执行一次：0 \*/5 \* \* \* ?

[CentOS7 系统清空删除系统日志的方法>>](https://cloud.tencent.com/developer/article/1969592) 将代码放到跳板机、宝塔计划任务内即可。

其他系统日志请网上查询，或咨询ChatGPT、Google Gemini等AI.

{% tabs %}
{% tab title="通用命令" %}
通用清理命令（CentOS 9、Ubuntu 22、Debian 12均适用）

```bash
# 清理登录日志
echo "" > /var/log/wtmp
echo "" > /var/log/btmp
echo "" > /var/log/lastlog

# 清理用户历史命令日志
history -c
echo "" > ~/.bash_history
echo "" > /root/.bash_history

# 清理系统日志（syslog 或 rsyslog）
find /var/log -type f -name "*.log" -exec truncate -s 0 {} \;
```

{% endtab %}

{% tab title="CentOS 9" %}

```bash
#!/bin/bash
# 清理 CentOS 9 登录日志和命令历史

# 清空登录日志文件
: > /var/log/wtmp 2>/dev/null
: > /var/log/btmp 2>/dev/null
: > /var/log/lastlog 2>/dev/null

# 清空当前用户和 root 用户的命令历史文件
: > ~/.bash_history 2>/dev/null
: > /root/.bash_history 2>/dev/null
```

{% endtab %}

{% tab title="Ubuntu22" %}

```bash
#!/bin/bash
# 清理 Ubuntu 22 登录日志和命令历史

# 清空登录日志文件
: > /var/log/wtmp 2>/dev/null
: > /var/log/btmp 2>/dev/null
: > /var/log/lastlog 2>/dev/null

# 清空当前用户和 root 用户的命令历史文件
: > ~/.bash_history 2>/dev/null
: > /root/.bash_history 2>/dev/null
```

{% endtab %}

{% tab title="Debian12" %}

```bash
#!/bin/bash
# 清理 Debian 12 登录日志和命令历史

# 清空登录日志文件
: > /var/log/wtmp 2>/dev/null
: > /var/log/btmp 2>/dev/null
: > /var/log/lastlog 2>/dev/null

# 清空当前用户和 root 用户的命令历史文件
: > ~/.bash_history 2>/dev/null
: > /root/.bash_history 2>/dev/null
```

{% endtab %}
{% endtabs %}

```
cat /dev/null > /var/log/boot.log
cat /dev/null > /var/log/btmp
cat /dev/null > /var/log/cron
cat /dev/null > /var/log/dmesg
cat /dev/null > /var/log/firewalld
cat /dev/null > /var/log/grubby
cat /dev/null > /var/log/lastlog
cat /dev/null > /var/log/mail.info
cat /dev/null > /var/log/maillog
cat /dev/null > /var/log/messages
cat /dev/null > /var/log/secure
cat /dev/null > /var/log/spooler
cat /dev/null > /var/log/syslog
cat /dev/null > /var/log/tallylog
cat /dev/null > /var/log/wpa_supplicant.log
cat /dev/null > /var/log/wtmp
cat /dev/null > /var/log/yum.log
```

### 修改默认密码、开启双重认证 <a href="#change" id="change"></a>

![](/files/95U6SdgfS8uLmYgF9AZE)

二步验证通常使用谷歌身份验证器Google Authenticator，但是不能备份导出；

建议使用微软Authenticator iPhone支持备份数据到iCloud；

Chrome插件 [身份验证器](https://chrome.google.com/webstore/detail/authenticator/bhghoamapcdpbohphigoooaddinpkbai)，支持备份导出数据；

### Windows机器仅限跳板机的IP访问远程桌面 <a href="#only-jumpserver-ip" id="only-jumpserver-ip"></a>

[Windows中限制IP远程桌面登录的方法>>](https://blog.csdn.net/baidu_38844729/article/details/103135246)

[windows2012通过本地安全策略限制远程登录的IP地址>>](https://blog.csdn.net/weixin_51928617/article/details/122496754)

[windows10专业版指定IP地址远程桌面访问（IP安全策略）>>](https://blog.csdn.net/qq_42177204/article/details/87800701)


---

# Agent Instructions: 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://docs.nextcli.com/jumpserver/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.
