#selinux selinux () { setenforce 0 sed -i "s/enforcing/disabled/"/etc/sysconfig/selinux }
#ssh服务安全配置 sshd () { tee -a /etc/ssh/sshd_config << EOF Port 62002 #修改默认ssh端口 PermitRootLogin no #拒绝root用户远程登录 PermitEmptyPasswords no #拒绝空密码登录 UseDNS no #不适用DNS解析 EOF systemctl restart sshd }
#防火墙 iptables () { yum install iptables-services -y cat > /etc/sysconfig/iptables << EOF # Firewall configuration written by system-config-securitylevel # Manual customization of this file is not recommended. *filter :INPUT DROP [0:0] :FORWARD ACCEPT [0:0] :OUTPUT ACCEPT [0:0] :syn-flood - [0:0] -A INPUT -i lo -j ACCEPT -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT -A INPUT -p tcp -m state --state NEW -m tcp --dport 62002 -j ACCEPT #-A INPUT -p icmp -m limit --limit 100/sec --limit-burst 100 -j ACCEPT #-A INPUT -p icmp -m limit --limit 1/s --limit-burst 10 -j ACCEPT #-A INPUT -p tcp -m tcp --tcp-flags FIN,SYN,RST,ACK SYN -j syn-flood #-A INPUT -j REJECT --reject-with icmp-host-prohibited #-A syn-flood -p tcp -m limit --limit 3/sec --limit-burst 6 -j RETURN -A syn-flood -j REJECT --reject-with icmp-port-unreachable COMMIT EOF /sbin/service iptables restart systemctl enable iptables }
#pip源 pip () { if [ ! -d ~/.pip ] then mkdir ~/.pip fi if [ ! -f ~/.pip/pip.conf ] then tee ~/.pip/pip.conf < EOF [global] index-url = http://mirrors.aliyun.com/pypi/simple/
[install] trusted-host=mirrors.aliyun.com EOF pip install --upgrade pip fi }