方舟笔记

方舟笔记

CentOS6和CentOS7更高的内核 一键安装[lotServer] 锐速 Vicer

1.支持更高的Linux内核一键安装[lotServer] 锐速.
2.支持一键完全卸载[lotServer] 锐速 (此脚本安装的无残留).
3.不支持自动更换内核. CentOS6和CentOS7 一键更换内核,一键安装锐速[lotServer]
4.不支持OpenVZ.
所有内容均来自互联网.本人不负任何法律责任,仅供学习使用.
Update:2019.04.15

一键安装[lotServer] 锐速:
bash <(wget --no-check-certificate -qO- https://github.com/MoeClub/lotServer/raw/master/Install.sh) install

一键卸载[lotServer] 锐速:
bash <(wget --no-check-certificate -qO- https://github.com/MoeClub/lotServer/raw/master/Install.sh) uninstall

使用方法:
启动命令 /appex/bin/lotServer.sh start
停止加速 /appex/bin/lotServer.sh stop
状态查询 /appex/bin/lotServer.sh status
重新启动 /appex/bin/lotServer.sh restart

1.更新许可证(有效期为6个月)
wget -qO '/appex/etc/apx.lic' "https://api.moeclub.org/lotServer?ver=1&mac=00:00:00:00:00:00"
使用 ifconfig 查看网卡 mac 地址,替换 00:00:00:00:00:00 (当内核版本号小于等于 3.11.20.10 时, 请设置 ver=0)

2.使用KeyGen, 更新许可证(lic文件)(有效期到2099年)
git clone https://github.com/Tai7sy/LotServer_KeyGen
cd LotServer_KeyGen
php keygen.php 00:00:00:00:00:00 (使用 ifconfig 查看网卡 mac 地址,替换 00:00:00:00:00:00)
cp out.lic /appex/etc/apx.lic
状态查询 /appex/bin/lotServer.sh status

3.CentOS7启动自动运行lotServer
chmod +x /etc/rc.local
vi /etc/rc.local
添加su - root -c "/appex/bin/lotServer.sh start"

图为CentOS Linux release 7.5.1804 安装[lotServer] 锐速

Apache 开启SSI配置使shtml支持 include()和SSI Shell漏洞问题

Apache 开启SSI配置使shtml支持 include()和SSI Shell漏洞问题
SSI (Server Side Includes)

1、编辑Apache的配置文件httpd.conf添加.shtml支持
# To parse .shtml files for server-side includes (SSI):
# (You will also need to add "Includes" to the "Options" directive.)
#
#AddType text/html .shtml #取消该行前的注释符#
#AddOutputFilter INCLUDES .shtml #取消该行前的注释符#
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml

2、编辑www.zhangfangzhou.cn.conf网站配置文件中添加Includes
Options FollowSymLinks Includes

3、重启Apache
service httpd restart
这样Apache2 开启SSI配置使shtml支持 include(),但是留下了一个SSI Shell漏洞问题,此时可以程序执行(exec)

4、只允许SSI但是禁止程序执行(exec)
编辑www.zhangfangzhou.cn.conf网站配置文件
Options FollowSymLinks Includes修改成Options FollowSymLinks IncludesNoExec
或者在.htaccess文件中添加Options +IncludesNOEXEC

5、补充
Includes #启用SSI
IncludesNoExec #启用SSI,但使EXEC指令无效

(1)、Includes
Options FollowSymLinks Includes以下规范有效
<!--#exec cmd="..."-->
<!--#exec cgi="..."-->
<!--#include file="..."-->

(2)、IncludesNoExec
Options FollowSymLinks IncludesNoExec
<!--#include file="..."-->
规范有效

<!--#exec cmd="..."-->
<!--#exec cgi="..."-->
exec等程序执行将受到限制不能执行

VMware Workstation Pro 15 共享虚拟机的时候 Workstation Server 不可用. 请启用虚拟机共享和远程访问以修改共享的虚拟机位置

VMware Workstation Pro 15 共享虚拟机的时候 Workstation Server 不可用. 请启用虚拟机共享和远程访问以修改共享的虚拟机位置
VMware Workstation Pro Shared VMs The Workstation Server is not available. Enable VM sharing and remote access to modify the shared VMs location.

1、查看VMware Workstation Pro 服务是否正常(右击我的电脑->>管理->>服务和应用程序->>服务)
VMware Authorization Service
VMware USB Arbitration Service
VMware Workstation Server

2、VMware Workstation Pro 服务均为正常,查看VMware Workstation Pro 产生的日志文件
C:\Users\用户名\AppData\Local\Temp\vmware-用户名\vmware-ui-随机ID.log
C:\Users\zhangfangzhou_cn\AppData\Local\Temp\vmware-zhangfangzhou_cn\vmware-ui-4624.log

2018-11-02T09:33:27.268+08:00| vmui| I125: CGlbSharedVMs::OnPrefsLoadAbort: Error while loading sharing preferences: Workstation Server 不可用。请启用虚拟机共享和远程访问以修改共享的虚拟机位置。
2018-11-02T09:33:42.368+08:00| vmui| I125: CGlbSharedVMs::OnPrefsLoadAbort: Error while loading sharing preferences: VMware Workstation 当前未连接 Workstation Server。要连接,请单击库中的“共享虚拟机”项目。
2018-11-02T09:43:02.342+08:00| vmui| I125: CGlbSharedVMs::OnPrefsLoadAbort: Error while loading sharing preferences: The Workstation Server is not available. Enable VM sharing and remote access to modify the shared VMs location.
2018-11-02T09:43:00.262+08:00| vmui| I125: CGlbSharedVMs::OnPrefsLoadAbort: Error while loading sharing preferences: VMware Workstation currently does not have a connection to the Workstation Server. To connect, click on the "Shared VMs" item in the library.

3、继续查看VMware Workstation Pro 的日志
C:\ProgramData\VMware\hostd\hostd-随机ID.log
C:\ProgramData\VMware\hostd\hostd-23.log
2018-11-02T09:33:39.348+08:00 verbose hostd[09420] [Originator@6876 sub=PropertyProvider opID=865c0541] RecordOp ASSIGN: latestEvent, ha-eventmgr. Applied change to temp map.
2018-11-02T09:33:39.348+08:00 info hostd[09420] [Originator@6876 sub=Vimsvc.ha-eventmgr opID=865c0541] Event 2 : Cannot login user @127.0.0.1: no permission

Event 2 : Cannot login user @127.0.0.1: no permission
原因是没有权限

4、系统使用的账户是zhangfangzhou_cn,使用administrator账户登录系统可以正常使用共享虚拟机的功能。

Overview Microsoft windows of .rdp file settings

微软 Windows 7、8、10远程桌面 .rdp 文件设置
微软 Windows 2008、2012、2016远程桌面 .rdp 文件设置
Overview Microsoft Windows of .rdp file settings

screen mode id:i:1
use multimon:i:0
desktopwidth:i:1920
desktopheight:i:1080
session bpp:i:32
winposstr:s:0,1,0,0,1531,868
compression:i:1
keyboardhook:i:2
audiocapturemode:i:0
videoplaybackmode:i:1
connection type:i:7
networkautodetect:i:1
bandwidthautodetect:i:1
displayconnectionbar:i:1
enableworkspacereconnect:i:0
disable wallpaper:i:0
allow font smoothing:i:0
allow desktop composition:i:0
disable full window drag:i:1
disable menu anims:i:1
disable themes:i:0
disable cursor setting:i:0
bitmapcachepersistenable:i:1
full address:s:192.168.0.199:3389
audiomode:i:0
redirectprinters:i:1
redirectcomports:i:0
redirectsmartcards:i:1
redirectclipboard:i:1
redirectposdevices:i:0
autoreconnection enabled:i:1
authentication level:i:2
prompt for credentials:i:0
negotiate security layer:i:1
remoteapplicationmode:i:0
alternate shell:s:
shell working directory:s:
gatewayhostname:s:
gatewayusagemethod:i:4
gatewaycredentialssource:i:4
gatewayprofileusagemethod:i:0
promptcredentialonce:i:0
gatewaybrokeringtype:i:0
use redirection server name:i:0
rdgiskdcproxy:i:0
kdcproxyname:s:

给CentOS6.x的GRUB 加密 和 CentOS7.x的GRUB2 加密

给CentOS6.x的GRUB 加密 和 CentOS7.x的GRUB2 加密

CentOS6.x GRUB 加密 (正常引导不需要密码,在启动项编辑GRUB需要输入密码)/boot/grub/grub.conf

通过在 grub.conf 中的启动配置中加入参数对grub进行加密:
1:加密的密码可以通过 grub-md5-crypt 生成
#grub-md5-crypt (回车,输入密码)
grub-md5-crypt
Password:
Retype password:
2:vi /boot/grub/grub.conf
3:在splashimage=(hd0,0)/grub/splash.xpm.gz后面 编辑插入 password --md5 $1$zoCS20$tuerHhzJGBVMdOA3uuQWZ0
4:在引导菜单修改引导配置的时候,则需要先输入密码,按p 输入密码

CentOS7.x GRUB2 加密 (正常引导不需要密码,在启动项编辑GRUB需要输入密码)/boot/grub2/grub.cfg
与CentOS6不同CentOS7采用的是grub2,而不是grub在CentOS7中,把grub的主要配置文件放在以下三个地方。
/boot/grub2/grub.cfg (/etc/grub2.cfg 是/boot/grub2/grub.cfg 文件的符号链接,lrwxrwxrwx. 1 root root 22 Sep 18 17:53 /etc/grub2.cfg -> ../boot/grub2/grub.cfg)
/etc/grub.d/ (ls /etc/grub.d/ 00_header 00_tuned 01_users 10_linux 20_linux_xen 20_ppc_terminfo 30_os-prober 40_custom 41_custom README)
/etc/default/grub (-rw-r--r--. 1 root root 197 Sep 18 17:54 /etc/default/grub)
这三个配置文件之间的关系是 grub.cfg 里通过 ####BEGIN ##### 这种格式按照顺序调用 /etc/grub.d 里面的脚本实现不同的功能,在grub.d 目录里有很多数字开头的脚本,按从小到大的顺序执行。

1、使用root用户生成grup2加密密码
grub2-mkpasswd-pbkdf2

2、 vi /etc/grub.d/01_users
cat <<EOF
set superusers="root"
password_pbkdf2 root grub.pbkdf2.sha512.10000.8A673CE3A2512ED267EB9E275B15D8430AECFAC29893EC278BF382EFCEB11FA5E3B679C8595F19BE2FAAC07C038B9C0CC4FF81462526BD1CFC98E15F75A4CC15.17D3A434DC8A97FCBB124CDCB7044F266164C647F0F917420128219E4B8FB62F9EDA9D9E6F4D9AC4F8F2D13565C803D347B631E18B2C231EE884563F345D3CF1
EOF

3、vi/etc/grub.d/01_linux
cat <<EOF
set superusers="zhangfangzhou"
password_pbkdf2 zhangfangzhou 生成的密码加密
EOF

4、最后执行grub2-mkconfig -o /boot/grub2/grub.cfg #重新生成GRUB配置文件 (Generate a GRUB configuration file.)

远程桌面发生身份验证错误,要求的函数不受支持

远程桌面发生身份验证错误,要求的函数不受支持
An authentication error has occurred. The function requested is not supported.
Windows 7 (win7)远程登录服务器以前都是正常的,今天登录远程桌面一直是这样的错误。
Windows 10 (win10)出现身份验证错误,要求的函数不正确,这可能是由于CredSSP加密Oracle修正。

方法1:卸载更新
卸载更新KB4103718(适用于基于 x64 的系统的 Windows 7 月度安全质量汇总),重启Windows 7即可正常登录。

方法2:使用微软官方建议修改本地组策略(命令提示符输入gpedit.msc打开本地组策略)
计算机配置>管理模板>系统>凭据分配>加密Oracle修正 选择启用并选择易受攻击。(易受攻击– 使用 CredSSP 的客户端应用程序将通过支持回退到不安全的版本使远程服务器遭受攻击,但使用 CredSSP 的服务将接受未修补的客户端。)
english version
Group Policy -> Computer Configuration -> Administrative Templates -> System -> Credentials Delegation> Encrypted Oracle Remediation change to Vulnerable (Vulnerable – Client applications that use CredSSP will expose the remote servers to attacks by supporting fallback to insecure versions, and services that use CredSSP will accept unpatched clients.)

https://support.microsoft.com/zh-cn/help/4093492/credssp-updates-for-cve-2018-0886-march-13-2018
https://support.microsoft.com/en-hk/help/4093492/credssp-updates-for-cve-2018-0886-march-13-2018

CentOS 7.x 调整 I/O Scheduler(调度器)优化系统性能

Linux I/O调度器(Linux I/O Scheduler)Linux内核中的一个组成部分,用户可以通过调整这个调度器来优化系统性能,
Linux I/O调度器(Linux I/O Scheduler)是LinuxI/O体系的一个组件,它介于通用块层和块设备驱动程序之间。

目前 Linux 上有如下几种 I/O 调度算法
1.noop(No Operation) - 通常用于内存存储的设备。
2.cfq(Completely Fair Scheduler ) – 完全公平调度器。进程平均使用IO带宽。
3.Deadline – 针对延迟的调度器,每一个 I/O,都有一个最晚执行时间。
4.Anticipatory – 启发式调度,类似 Deadline 算法,但是引入预测机制提高性能。

1、查看CentOS6 CentOS7下IO支持的调度算法
CentOS 6.x
#dmesg | grep -i scheduler
io scheduler noop registered
io scheduler anticipatory registered
io scheduler deadline registered
io scheduler cfq registered (default)

CentOS 7.x
#dmesg | grep -i scheduler
[ 0.739263] io scheduler noop registered
[ 0.739267] io scheduler deadline registered (default)
[ 0.739315] io scheduler cfq registered
看到CentOS 7.x默认支持的是deadline算法,CentOS 6.x下默认支持的cfq算法,而一般我们会在SSD固态盘硬盘环境中使用noop算法

2、查看设备当前的 I/O 调度器
#cat /sys/block//queue/scheduler

假设磁盘名称是 /dev/sda
#cat /sys/block/sda/queue/scheduler
noop [deadline] cfq

3、临时生效的方法
#cat /sys/block/sda/queue/scheduler
noop [deadline] cfq
#echo cfq>/sys/block/sda/queue/scheduler
#cat /sys/block/sda/queue/scheduler
noop deadline [cfq]
CentOS7下默认的算法被调整为cfq了

4、永久生效的方法
CentOS 7.x
#grubby --update-kernel=ALL --args="elevator=deadline"
#reboot
#cat /sys/block/sda/queue/scheduler
noop [deadline] cfq

或者使用vi编辑器修改配置文件,添加elevator= cfq
#vi /etc/default/grub
GRUB_CMDLINE_LINUX="crashkernel=auto rhgb quiet elevator=noop numa=off"
然后保存文件,重新编译配置文件
BIOS-Based: grub2-mkconfig -o /boot/grub2/grub.cfg
UEFI-Based: grub2-mkconfig -o /boot/efi/EFI/centos/grub.cfg

CentOS 6.x
vim /boot/grub/menu.lst 或vim /boot/grub/grub.conf
更改到如下内容
kernel /boot/vmlinuz.......... elevator=deadline rhgb quiet