奇怪的安装脚本之一
wget https://minecraft.azureedge.net/bin-linux/bedrock-server-1.10.0.7.zip unzip bedrock-server-1.10.0.7.zip apt apt install zip unzip bedrock-server-1.10.0.7.zip LD_LIBRARY_PATH=. ./bedrock_server
wget https://minecraft.azureedge.net/bin-linux/bedrock-server-1.10.0.7.zip unzip bedrock-server-1.10.0.7.zip apt apt install zip unzip bedrock-server-1.10.0.7.zip LD_LIBRARY_PATH=. ./bedrock_server
sysname 主机名 #配置默认账户密码以及权限 aaa local-user admin password irreversible-cipher 密码 local-user admin privilege level 15 local-user admin service-type terminal ssh http #配置默认路由 ip route-static 0.0.0.0 0.0.0.0 172.20.20.1 #配置上联通信IP interface Vlanif2 ip address 172.20.20.20 255.255.255.0 #配置上联 interface GigabitEthernet0/0/50 description UPLINK port link-type trunk port trunk allow-pass vlan all #port trunk permit vlan all #配置端口 interface GigabitEthernet0/0/1 description 简介内容 port link-type access port default vlan 10 #分配VLAN ID (也可以在三层vlan里面进行限速) qos lr outbound cir 102400 cbs 12800000 #二层限制服务器的流入流量100Mbps qos lr inbound cir 10240 cbs 1280000 #二层限制服务器的流出流量10Mbps #配置SNMP snmp-agent community read cipher Public_community snmp-agent sys-info version v2c undo snmp-agent sys-info version v3 #配置DHCP转发 DHCP Relay dhcp-server 1 ip 192.168.0.10
配置rsa免密码记录在 http://www.kvm.la/1161.html
有很久没用vsftpd了, 最近做自动备份需要用到ftp服务器, 思来想去也只有vsftp简单粗暴快捷了.
function setftpuser() { setpassword=`openssl rand -base64 12|tr -dc _A-Z-a-z-0-9`; adduser $1 echo $1 >> /etc/vsftpd/chroot_list chmod 750 /home/$1 echo $1:$setpassword|chpasswd echo $1 $setpassword; echo $1 $setpassword > /root/vsftp.txt; } function vsftp-setup{ yum -y install vsftpd cp /etc/vsftpd/vsftpd.conf /etc/vsftpd/vsftpd.conf.default sed -i 's#anonymous_enable=YES#anonymous_enable=NO#g' /etc/vsftpd/vsftpd.conf sed -i 's#listen=NO#listen=YES#g' /etc/vsftpd/vsftpd.conf sed -i 's#listen_ipv6=YES#listen_ipv6=NO#g' /etc/vsftpd/vsftpd.conf sed -i 's/#chroot_/chroot_/g' /etc/vsftpd/vsftpd.conf systemctl enable vsftpd systemctl start vsftpd } vsftp-setup #安装vsftpd setftpuser 用户名 #添加用户
ssh jail环境没有弄, 后面有精力再弄上.
/ip firewall nat add chain=srcnat src-address=内网IP段/24 protocol=tcp action=masquerade add action=dst-nat chain=dstnat dst-address=公网IP dst-port=80,443,5900 protocol=tcp to-addresses=内网IP to-ports=0-65535 add action=dst-nat chain=dstnat dst-address=公网IP dst-port=623 protocol=udp to-addresses=内网IP to-ports=0-65535
怕忘记了,懒得到处找.
location ~ .*\.(php)?$ { try_files $uri = 404; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass unix:/dev/shm/php-cgi.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name; include fastcgi_params; } location ~ .*\.(htm|gif|jpg|jpeg|png|bmp|ico|flv|swf|txt|wma)$ { expires 30d;} location ~ .*\.(js|css)?$ { expires 1d;} location ~ .*\.(tpl|svn|asp|aspx|jsp|do|mdb|zip|rar|bak|htc)?${ deny all; } location ~ /0.* { deny all; } if (!-e $request_filename) { return 444; }
LVM在linux下灵活划分硬盘空间分区是非常好用的一个东西.
从centos5开始到现在还在用的centos7, 我一直都在和lvm做斗争.
问题其实也简单, 无非就是lv分区导致丢失: 分区的md编号错乱丢失lv, lvremove恢复后丢失lv, 以及还有许多已经忘记的原因.
上月由于机柜搬迁数据中心的问题, 一些宿主服务器子系统较多关机时间太长, 在半路进行了强制关机.
然而在恢复完后就发现一些子系统没有恢复, 由于标签显示是自用的节点又暂时没有时间就延后处理了.
今天清点后发现全是自用的节点, 好在都是非一线重要的东西.
7月底一台快7年的E3 4x1T RAID10的服务器硬盘挂掉导致whmcs数据丢失了一部分重要的数据,
又因为之前迁移进来后没有做定时数据备份, 好在抢救到的数据能维持正常运行, 覆盖早先的备份后一切正常,
此事算妥善处理完成了.
丢数据的事其实已经亲身遇上过很多次了, 硬盘坏掉和LVM丢分区的事每年都有遇上, 即使有RAID也会翻车的可能.
从第一次在webnx的RAID10挂掉, 到LVM串联硬盘分区, 再到rm -rf 数据库, 以及这次又是RAID的挂掉.
数据备份不能马虎, 一定要做, 且异地备份 本地备份 差异备份 同步备份 都要做上, 数据越重要就越需要做备份.
有2次丢掉财务数据库经验的我总结的经验是, 不是每次都那么幸运可以靠手动修复数据.
有时候没了就是没了, 说啥都没有用.
export LC_ALL="en_US.UTF-8"
export LC_CTYPE="en_US.UTF-8"
yum install -y git
cd /opt
git clone https://github.com/certbot/certbot.git
cd certbot && ./certbot-auto
/opt/certbot/certbot-auto certonly --manual --preferred-challenges dns -d *.域名.后缀
--preferred-challenges dns的参数会要求建立一个_acme-challenge.的txt dns指向记录验证域名.
./certbot-auto certificates
yum install install certbot python3-cloudflare python3-certbot-dns-cloudflare -y
echo "00 04 01 * * certbot renew" >> /etc/cron.monthly/certbot
chmod 644 /etc/cron.monthly/certbot
certbot certonly --agree-tos --email [email protected] \
--dns-cloudflare \
--dns-cloudflare-credentials /root/cf.ini \
-d '*.baidu.XXX'
ssh-keygen -f .ssh/id_rsa.pub -e -m pem | grep -v '\-\-\-\-' | base64 -d | xxd -p #转换已有的rsa key
####交换机配置 rsa peer-public-key 1 public-key-code begin #此处是转换后的key数据 public-key-code end peer-public-key end # user-interface vty 0 4 authentication-mode aaa user privilege level 15 protocol inbound ssh # aaa local-user 用户名 password cipher 密码 privilege level 15 #local-user netadmin privilege level 15 local-user 用户名 service-type stelnet local-user 用户名 service-type ssh # stelnet server enable ssh user 用户名 authentication-type rsa ssh user 用户名 assign rsa-key 1 ssh user 用户名 service-type stelnet
user-interface vty 0 4 authentication-mode aaa protocol inbound ssh # aaa local-user 用户名 password cipher 密码 privilege level 15 local-user 用户名 service-type stelnet local-user 用户名 service-type ssh # stelnet server enable ssh user 用户名 authentication-type password ssh user 用户名 service-type stelnet
The following procedure works for Ubuntu 18.04 (Bionic Beaver)
# apt-get update # apt-get install ifupdown
source /etc/network/interfaces.d/* # The loopback network interface auto lo iface lo inet loopback allow-hotplug enp0s3 auto enp0s3 iface enp0s3 inet static address 192.168.1.133 netmask 255.255.255.0 broadcast 192.168.1.255 gateway 192.168.1.1 # Only relevant if you make use of RESOLVCONF(8) # or similar... dns-nameservers 1.1.1.1 1.0.0.1
# ifdown --force enp0s3 lo && ifup -a # systemctl unmask networking # systemctl enable networking # systemctl restart networking
# systemctl stop systemd-networkd.socket systemd-networkd \ networkd-dispatcher systemd-networkd-wait-online # systemctl disable systemd-networkd.socket systemd-networkd \ networkd-dispatcher systemd-networkd-wait-online # systemctl mask systemd-networkd.socket systemd-networkd \ networkd-dispatcher systemd-networkd-wait-online # apt-get --assume-yes purge nplan netplan.io
Then, you're done.
Note: You MUST, of course, adapt the values according to your system (network, interface name...).
在http字段下加入一个map做匹配引导
map $http_user_agent $limit_bots { default 0; ~*(baiduspider|google|soso|bing|yandex|sogou|yahoo|sohu-search|yodao|YoudaoBot|robozilla|msnbot|MJ12bot|NHN|Twiceler) 1; ~*(AltaVista|Googlebot|Slurp|BlackWidow|Bot|ChinaClaw|Custo|DISCo|Download|Demon|eCatch|EirGrabber|EmailSiphon|EmailWolf|SuperHTTP|Surfbot|WebWhacker) 1; ~*(Express|WebPictures|ExtractorPro|EyeNetIE|FlashGet|GetRight|GetWeb!|Go!Zilla|Go-Ahead-Got-It|GrabNet|Grafula|HMView|Go!Zilla|Go-Ahead-Got-It) 1; ~*(rafula|HMView|HTTrack|Stripper|Sucker|Indy|InterGET|Ninja|JetCar|Spider|larbin|LeechFTP|Downloader|tool|Navroad|NearSite|NetAnts|tAkeOut|WWWOFFLE) 1; ~*(GrabNet|NetSpider|Vampire|NetZIP|Octopus|Offline|PageGrabber|Foto|pavuk|pcBrowser|RealDownload|ReGet|SiteSnagger|SmartDownload|SuperBot|WebSpider) 1; ~*(Teleport|VoidEYE|Collector|WebAuto|WebCopier|WebFetch|WebGo|WebLeacher|WebReaper|WebSauger|eXtractor|Quester|WebStripper|WebZIP|Wget|Widow|Zeus) 1; ~*(Twengabot|htmlparser|libwww|Python|perl|urllib|scan|Curl|email|PycURL|Pyth|PyQ|WebCollector|WebCopy|webcraw) 1; }
再到server字段或者是location字段下加入if判断
if ($limit_bots = 1) { return 403; }
增加密码
openssl rsa -aes256 -in your.key -out your.encrypted.key
移除密码
openssl rsa -in your.key -out your.open.key
id_rsa文件需要400的权限, 否则不能使用.
原文引用自https://stackoverflow.com/questions/42863913/key-load-public-invalid-format
for I in `echo dmesg lastlog messages secure tallylog wtmp btmp maillog spooler yum.log`; do echo > /var/log/$I; done history -c
需要安装一个openresty或者nginx, 版本大于1.15.10
编译安装参考http://www.kvm.la/1043.html , openresty二进制包版本较低没有更新, 建议编译安装一份.
首先把IPMI的IP丢进一个ip.list的文件里面, 一行一个IP.
#/bin/bash i=1000 #vnc start port b=2000 # hextoip() { hex=$1; printf "%d." 0x${hex:0:2}; printf "%d." 0x${hex:2:2}; printf "%d." 0x${hex:4:2}; printf "%d" 0x${hex:6:2}; } #gethostip -x 10.0.12.1 stream_route_map=/etc/nginx/stream.route.map.conf http_route_map=/etc/nginx/http.route.map.conf echo " default 0;" > $stream_route_map echo " default 0;" > $http_route_map for IP in `cat /root/ipmi/ip.list | uniq -c |awk '{ print $2 }'`; do i=`expr $i + 1` ; b=`expr $b + 1` ; HEXIP=`gethostip -x $IP | tr 'A-Z' 'a-z'` ; echo " ~*($IP|$i|$b|$HEXIP)$ IP<$IP>|VNC<$i>|BMC<$b>|HEX<$HEXIP>;" >>$http_route_map; echo " ~*($b|$i)$ $IP;" >> $stream_route_map done nginx -s reload
流程之一, 模版格式化解决繁琐操作.
你好, [NAME] 请尽快处理我们收到的以下滥用投诉报告,谢谢。 我们收到了来自您订单的投诉报告。我们要求您尽快调查此事。完成调查后,请回复以下问题的答复: 1)问题的根源是什么? 2)您采取了哪些步骤解决此问题? 3)你采取了哪些措施来防止这种情况再次发生? 由于此活动违反了我们的服务条款,因此我们要求您在接下来的12小时内回复。 如果我们在这段时间内没有收到回复,我们可能会暂时中断您的服务,以防止进一步的恶意活动。 =========== COMPLAINT STARTS HERE ============ 投诉内容(模版里面去掉此处) 投诉内容(模版里面去掉此处) 投诉内容(模版里面去掉此处) =========== COMPLAINT ENDS HERE ============== 在此过程中,请继续保持我们的状态更新,如果您有任何问题,请告知我们。 Kind Regards, 公司名 Support
linux kickstart文件里rootpw密码可以使用明文,也可以使用加密过的值,这里主要介绍下三种加密方法:md5、sha256、sha512
使用明文的方法
rootpw "password"
使用加密的方法
rootpw --iscrypted password_hashauthconfig --enableshadow --enablemd5 (--passalgo=sha256 or --passalgo=sha512)
使用openssl passwd命令:
# openssl passwd -1 "password"$1$uMOl6YMI$7AAO8YG7l37ipRXCmmame.
使用grub-crypt命令,会提示输出密码:
# grub-crypt --md5Password:Retype password:$1$Y9TR8PpY$qm1VzsjKzbXtYInyAQLG70
使用python,同样也会提示输出密码:
# echo 'import crypt,getpass; print crypt.crypt(getpass.getpass(), "$1$8_CHARACTER_SALT_HERE")' | python -Password:$1$8_CHARAC$GVWpvO3Hu009C37IYF41L0