2024年2月

一.配置软件源

1.关闭企业版更新源

mv /etc/apt/sources.list.d/pve-enterprise.list /etc/apt/sources.list.d/pve-enterprise.list.bak

2.更新debian国内加速及pve非订阅版更新源

cp /etc/apt/sources.list /etc/apt/sources.list.bak
vim /etc/apt/sources.list

7.X

deb http://mirrors.aliyun.com/debian/ bullseye main non-free contrib
deb http://mirrors.aliyun.com/debian/ bullseye-updates main non-free contrib
deb http://mirrors.aliyun.com/debian/ bullseye-backports main non-free contrib

deb-src http://mirrors.aliyun.com/debian/ bullseye main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ bullseye-updates main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ bullseye-backports main non-free contrib

deb http://mirrors.aliyun.com/debian-security/ bullseye-security main non-free contrib
deb-src http://mirrors.aliyun.com/debian-security/ bullseye-security main non-free contrib


#ProxmoveVE7
deb http://mirrors.ustc.edu.cn/proxmox/debian/pve bullseye pve-no-subscription
注意:需要密钥
wget http://mirrors.ustc.edu.cn/proxmox/debian/proxmox-release-bull

8.X

deb http://mirrors.ustc.edu.cn/debian/ bookworm main non-free non-free-firmware  contrib
deb http://mirrors.ustc.edu.cn/debian/ bookworm-updates main non-free non-free-firmware  contrib
deb http://mirrors.ustc.edu.cn/debian/ bookworm-backports main non-free non-free-firmware  contrib

deb-src http://mirrors.ustc.edu.cn/debian/ bookworm main non-free non-free-firmware  contrib
deb-src http://mirrors.ustc.edu.cn/debian/ bookworm-updates main non-free non-free-firmware  contrib
deb-src http://mirrors.ustc.edu.cn/debian/ bookworm-backports main non-free non-free-firmware  contrib

deb http://mirrors.ustc.edu.cn/debian-security/ bookworm-security main non-free non-free-firmware  contrib
deb-src http://mirrors.ustc.edu.cn/debian-security/ bookworm-security main non-free non-free-firmware  contrib


#ProxmoveVE8
deb http://mirrors.ustc.edu.cn/proxmox/debian/pve bookworm pve-no-subscription

3.更新命令

apt-get update 
apt-get dist-upgrade   

4.CEPH源更换为中科大源

echo "deb https://mirrors.ustc.edu.cn/proxmox/debian/ceph-quincy bookworm no-subscription" > /etc/apt/sources.list.d/ceph.list     
sed -i.bak "s#http://download.proxmox.com/debian#https://mirrors.ustc.edu.cn/proxmox/debian#g" /usr/share/perl5/PVE/CLI/pveceph.pm    

二.关闭订阅提示

sed -i.backup -z "s/res === null || res === undefined || \!res || res\n\t\t\t.data.status.toLowerCase() \!== 'active'/false/g" /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js && systemctl restart pveproxy.service
若重新登录后依旧存在弹窗,请关闭浏览器重新登录

三.休眠及合盖屏幕常亮

1.编辑 /etc/systemd/logind.conf 在文件中添加以下2行

HandleLidSwitch=ignore
HandleLidSwitchDocked=ignore

2.重启服务

systemctl restart systemd-logind.service

一. 删除多余分区
PVE这个系统在安装的时候默认会把储存划分为local和local-lvm两个块,在实际使用的时候往往其中一个不够用了另一个还很空的情况,我一般在首次安装PVE之后会执行下面三步操作,把local-lvm的空间全部分配给local,方便自己管理

1.打开自带的shell窗口,输入后以下内容后回车

lvremove pve/data

2.继续输入,然后回车

lvextend -l +100%FREE -r pve/root

3.在数据中心-存储中删除local-lvm分区,并编辑local,在内容一项中勾选所有可选项。
内容全选择.png


二. 安装DSM

1. 下载引导文件

首先需要pve的运行环境,GitHub下载一个引导,网站搜索“fbelavenuto/arpl”就能找到这个arpl的项目,在它的release栏目里如图示下载后缀为img的文件。GitHub下载连接Filerun
下载的文件上传到PVE中后,记录下引导文件的位置

2. 创建虚拟机

正常创建虚拟机,但需要注意以下几点:

1.'操作系统'--------不使用任何介质
2.'系统'中机型------Q35
3.CPU--------------使用NUMA
4.网络中模型--------E1000
如果你考虑硬盘直通,请删除创建虚拟机的硬盘

3. 导入硬盘

镜像转成虚拟虚拟机的硬盘

qm importdisk 101 /var/lib/vz/template/iso/arpl.img local

虚拟机的“硬件”栏目下,可以看到一块未使用的硬盘,双击它,将“总线/设备”改为SATA

虚拟机的“选项”栏目下,双击“引导顺序”,勾选“SATA0”,取消“net0”勾选,调整引导顺序将SATA放首位

3. 硬盘直通

ls /dev/disk/by-id/      #查看硬盘id
qm set 101 -sata1 /dev/disk/by-id/ata-L*  #ata代表第一个硬盘,请确保挂载的硬盘没有数据!!!
如果直通的物理磁盘已经有分区了,也可以用这个命令挂载:qm set 100 --sata1 /dev/sdb

4. 安装DSM
启动虚拟机,来到控制台界面,记下ip,在电脑浏览器输入地址,来到ARPL的配置页面。
·Choose the model众多型号中选择DS918+
选择DS918+.png
·Choose a Build Number选择42962
型号选择.png
·Choose a serial number选择Generate a random serial number
自动生成SN.png
·Build the loader开始编译
开始编译.png
·Boot the loader启动引导
引导启动.png

5. DSM初始化配置
访问IP:5000,导入pat文件
等待更新
等待重启.png

参考链接
https://post.smzdm.com/p/axz8o492/

前言

fail2ban可以监视你的系统日志,然后匹配日志的错误信息执行相应的屏蔽动作。网上大部分教程都是关于fail2ban+iptables组合,考虑到CentOS 7已经自带Firewalld,所以这里我们也可以利用fail2ban+Firewalld来防CC攻击和SSH爆破。

准备工作

1、检查 Firewalld 是否启用

启用Firewalld后会禁止所有端口连接,因此请务必放行常用的端口,以免被阻挡在外,以下是放行SSH端口(22)示例,供参考

#放行22端口
firewall-cmd --zone=public --add-port=80/tcp --permanent
#重载配置
firewall-cmd --reload
#查看已放行端口
firewall-cmd --zone=public --list-ports

2、安装 fail2ban

#CentOS内置源并未包含fail2ban,需要先安装epel源
yum -y install epel-release
#安装fial2ban
yum -y install fail2ban

jail.conf为主配置文件,相关的匹配规则位于filter.d目录
3、配置规则

"新建jail.local文件

[DEFAULT]
ignoreip = 127.0.0.1/8          #白名单
bantime  = 86400                #锁定多少秒
findtime = 600                  #多少分钟内失败多少次锁定
maxretry = 5                    #600秒内失败5次锁定
banaction = firewallcmd-ipset   #屏蔽IP所使用的方法,这里使用firewalld
action = %(action_mwl)s         #触发规则后的选择行为

[sshd]
enabled = true
filter  = sshd                  #使用内置的规则sshd
port    = 22
action = %(action_mwl)s
logpath = /var/log/secure       #监控系统登录失败日志

阅读剩余部分