草稿 · 2022年4月24日 0

草稿信息

Linux中将shell脚本打包为可执行文件

duoSecurity
mkcert

数据库规范:https://github.com/jly8866/archer/blob/master/src/docs/mysql_db_design_guide.md

error from daemon in stream: Error grabbing logs: invalid character ‘l’ after object key:value pair
https://my.oschina.net/kcw/blog/3001706

centos 8 install iproute-tc

sudo dnf makecache --refresh
sudo yum makecache --refresh

https://installati.one/
3proxy 安装 https://installati.one/centos/8/3proxy/

daemon
nserver 8.8.8.8
nscache 65536

# 设置用户名和密码
users username1:CL:password1
users username2:CL:password2

# 设置代理类型和端口
proxy -p3128

# 使用基本验证
auth strong

# 根据目标选择出站IP
# 如果目标是 1.1.1.1, 使用出站IP 1.1.1.1
allow username1 * 1.1.1.1
proxy -n -a -e1.1.1.1

# 如果目标是 2.2.2.2, 使用出站IP 2.2.2.2
allow username2 * 2.2.2.2
proxy -n -a -e2.2.2.2

# 日志设置
log /var/log/3proxy/3proxy.log D
logformat "- +_L%t.%. %N.%p %E %U %C:%c %R:%r %O %I %h %T"
rotate 30


部署安装

参考网址:NGINX的奇淫技巧 —— 1. 字符串截断

yum 安装nginx 带tcp 模块

yum install nginx-mod-stream -y

参考网址:用yum安装的nginx,报unknown directive “stream”

nginx.conf 配置

# 最优雅的Nginx配置HTTP跳转HTTPS方法
# 通过https 跳转
if ($scheme = http ) {
return 301 https://$host$request_uri;
}
# 通过判断端口跳转
if ($server_port = 80 ) {
return 301 https://$host$request_uri;
}

参考网址

【nginx】最优雅的Nginx配置HTTP跳转HTTPS方法

PHP

cd /srv/php-7.4.28/sapi/fpm
cp init.d.php-fpm /etc/init.d/php-fpm
chmod 700 /etc/init.d/php-fpm
cp php-fpm.conf  /usr/local/php-7.4.28/etc/php-fpm.conf
cd /usr/local/php-7.4.28/etc/php-fpm.d/
cp www.conf.default  www.conf
/etc/init.d/php-fpm start

异常报错

dnf --enablerepo=powertools install oniguruma-devel

参考网址: centos8 安装 oniguruma-devel

解决Please check that your locale settings问题

vim .bashrc

export LC_ALL=C
source .bashrc

还有fzf perl 乱码报错 具体 需要通过centos 8 安装fzf 复现
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LC_CTYPE = “UTF-8”,
LANG = “en_US.UTF-8”
are supported and installed on your system.
perl: warning: Falling back to a fallback locale (“en_US.UTF-8”).
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LC_CTYPE = “UTF-8”,
LANG = “en_US.UTF-8”
are supported and installed on your system.
perl: warning: Falling back to a fallback locale (“en_US.UTF-8”).

参考链接:https://cloud.tencent.com/developer/article/1340498

ewomail 新增域名

# ewomail的官方教程里,涉及到多域名的教程其实不完整。
# 他告诉你 从邮箱后台域名栏目添加的域名是副域名,和主域名一样配置解析就可以了
# 但是这里面有一个DKIM,这没说怎么添加
# 生成dkim
amavisd -c /etc/amavisd/amavisd.conf genrsa /ewomail/dkim/201.com.pem
# 在/etc/amavisd/amavisd.conf找到:

dkim_key("a.com", "dkim", "/var/lib/dkim/a.com.pem");
# 在下面新增一行  
dkim_key("b.com", "dkim", "/var/lib/dkim/b.com.pem");

找到dkim_key开头,复制添加一行,参考图上。
# 重启amavisd
service amavisd restart
# 对应该域名设置dkim的域名解析即可。

参考网址 解决perl: warning: Setting locale failed

ansible 参考网址

Ansible系列文章
Ansible系列文章
Ansible系列(四):playbook应用和roles自动化批量安装示例
Check if service exists with Ansible
Ansible系列(四):playbook应用和roles自动化批量安装示例

Go学习

参考网址:想系统学习GO语言(Golang),能推荐几本靠谱的书吗?

python相关

全栈Python Full Stack Python
参考网址 The Zen of Python
ImportError: No module named ‘_ctypes’ when using Value from module multiprocessing
Python with语句

MySQL

在 MySQL shell终端中 通过可以通过函数获取版本跟当前时间

/* 查看MySQL 版本*/
SELECT VERSION();
/*获取当前时间*/
SELECT  CURRENT_TIMESTAMP();

dash 中有很多跟函数有关的参数

varnish 相关

取消和删除缓存
varnish 清理缓存 purge和ban
Handling HTML5 Video for iOS and Safari clients
清除varnish缓存的几种方法

#其他
将luarocks整合进openresty,并安装lfs
CRON表达式
正则表达式
金十数据
kswapd0挖矿病毒查杀过程
iptables配置docker服务端口访问限制
在 Linux 上测试硬盘读写速度

bash 漏洞:https://www.cnblogs.com/qmfsun/p/7591757.html
威胁IP评估:https://ti.qianxin.com/v2/search?type=ip&value=183.94.49.196
nginx geo 变量使用 http://www.ttlsa.com/nginx/using-nginx-geo-method/
tornado mysql https://github.com/snower/TorMySQL
mysql 初始化 空密码:https://developer.aliyun.com/article/693503
tornado定制json格式错误信息以及源码解析:https://www.jianshu.com/p/ad353f74bff3
Linux 下以其他用户身份运行程序—— su、sudo、runuser :https://www.cnblogs.com/bodhitree/p/6018369.html
Linux内核学习资料

 ./configure --prefix=/usr/local/php-7.4.28 --with-config-file-path=/usr/local/php-7.4.28/etc \
            --with-fpm-user=www  \
      --with-fpm-group=www  \
      --enable-mysqlnd \
      --with-mysqli=mysqlnd \
      --with-mysql \
      --with-mcrypt \
      --enable-gd-native-ttf \
      --with-pdo-mysql=mysqlnd \
      --with-iconv-dir \
      --with-freetype-dir \
      --with-jpeg-dir \
      --with-png-dir \
      --with-zlib \
      --with-zlib-dir \
      --with-curl \
      --with-mcrypt \
      --with-gd \
      --with-openssl \
      --with-mhash \
      --with-xmlrpc \
      --with-gettext \
      --with-libxml-dir \
      --with-bz2 \
      --without-pear \
      --enable-fpm \
      --enable-ftp \
      --enable-xml \
      --with-xsl \
      --enable-intl \
      --enable-zip \
      --enable-soap \
      --enable-bcmath \
      --enable-shmop \
      --enable-sysvsem \
      --enable-inline-optimization \
      --enable-gd-native-ttf \
      --enable-pcntl \
      --enable-sockets \
      --enable-maintainer-zts \
      --enable-mbregex \
      --enable-mbstring \
      --enable-opcache \
      --enable-exif

PHP扩展:

sudo yum install ImageMagick ImageMagick-devel ImageMagick-perl
# centos 8 安装

pecl install imagick

php安装gd扩展的方法
php_ini not set to php.ini location

Markdown 代码高亮的标记大全