This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -u | |
ECHO=/bin/echo | |
GREP=/bin/grep | |
CUT=/usr/bin/cut | |
CAT=/bin/cat | |
MOUNTPOINT=/bin/mountpoint | |
LSBLK=/bin/lsblk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Usage: | |
# sudo su -c 'wget -O- https://gist.githubusercontent.com/raphaunix/008199de5b728f963b1379ff14e7e177/raw/s.sh | sudo bash -s' | |
# sudo su -c 'curl -s https://gist.githubusercontent.com/raphaunix/008199de5b728f963b1379ff14e7e177/raw/s.sh | bash -s --' | |
set -eu | |
clear | |
CRED='\e[1m\e[31m' | |
CEND='\e[0m\e[0m' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
iptables -I INPUT -p tcp -m tcp --dport 7308 -m state --state NEW -j LOG --log-level 1 --log-prefix "New Connection " | |
tail -f syslog | awk -F'SRC=' '{print $2}' | awk -F' ' '{print $1}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
yum update | |
error: rpmdb: BDB0113 Thread/process 22428/140499342686208 failed: BDB1507 Thread died in Berkeley DB library | |
error: db5 error(-30973) from dbenv->failchk: BDB0087 DB_RUNRECOVERY: Fatal error, run database recovery | |
error: cannot open Packages index using db5 - (-30973) | |
error: cannot open Packages database in /var/lib/rpm | |
CRITICAL:yum.main: | |
[SOLVED] | |
sudo rm -f /var/lib/rpm/__db* && db_verify /var/lib/rpm/Packages && rpm --rebuilddb && yum clean all && yum update |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"Job for zabbix-agent.service failed because a configured resource limit was exceeded. See "systemctl status zabbix-agent.service" and "journalctl -xe" for details." | |
[SOLVED] | |
sudo setenforce 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fallocate -l 4G /swapfile && chmod 600 /swapfile && mkswap /swapfile && swapon /swapfile && swapon -s && printf "%s\n" "/swapfile none swap sw 0 0" >> /etc/fstab && cat /etc/fstab |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Checking the number of login attempts coming from an ip: | |
debian/ubuntu: | |
cat /var/log/auth.log | grep -o '[0-9]\{0,3\}\.[0-9]\{0,3\}\.[0-9]\{0,3\}\.[0-9]\{0,3\}' | cut -d " " -f 1 | sort | uniq -c | sort -unr | |
rhel/centos: | |
cat /var/log/secure | grep -o '[0-9]\{0,3\}\.[0-9]\{0,3\}\.[0-9]\{0,3\}\.[0-9]\{0,3\}' | cut -d " " -f 1 | sort | uniq -c | sort -unr | |
Dropping ip attacker with iptables: | |
iptables -I INPUT -s IPATTACKER -j DROP && service iptables restart && clear; iptables -L |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DDOS check: | |
netstat -anp |grep 'tcp\|udp' | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -n | |
Dropping ip attacker with iptables: | |
iptables -I INPUT -s IPATTACKER -j DROP && service iptables restart && clear; iptables -L |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SOLVED | |
java.net.NoRouteToHostException | |
cat /proc/sys/net/ipv4/ip_local_port_range | |
32768 - 61000 | |
Solution | |
1. Lowest waiting time to release the door, the default is 60, modified to 15 ~ 30s | |
echo 30 >/proc/sys/net/ipv4/tcp_fin_timeout |