忍痛舍弃centos,拥抱Debian,部分命令仅供参考

如题,centos要更换Debian,大部分基本命令都是一致的,现将部分常用Debian命令和Debian密码安全策略归纳,仅供参考(拿测试机测试重启等等)。

(期间遇到 service networking restart,没有报错,网卡不启动,必须ifup ens192/eth0的情况)

1、设置代理

Nano  /etc/profile

export http_proxy=http://10.194.11.11:808

export http_proxy=http://10.194.11.11:808

nano /etc/apt/apt.conf

Acquire::http::Proxy  "10.194.11.11:808”;

Acquire::https::Proxy  "10.194.11.11:808”;

2、升级

apt-get update

安装必要

apt-get install gedit

更新系统软件

apt-get upgrade

3、安装ssh

apt-get install ssh

4、设置ntp

apt-get install ntpdate

ntpdate-debian 10.191.*.*

5、查看已安装软件

dpkg -l | grep ssh

卸载

apt-get remove

运行 .deb软件

dpkg –i *.deb

删除 .deb

dpkg –r *.deb

6、添加aliyun源

nano /etc/apt/sources.list

deb http://mirrors.aliyun.com/debian/ stretch main non-free contrib

deb-src http://mirrors.aliyun.com/debian/ stretch main non-free contrib

deb http://mirrors.aliyun.com/debian-security stretch/updates main

deb-src http://mirrors.aliyun.com/debian-security stretch/updates main

deb http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib

deb-src http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib

deb http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib

deb-src http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib

apt-get update  更新

7、安装iptables(过滤icmp包中危漏洞)

apt-get install iptables-persistent

8、安装密码规则模块

apt-get -y install libpam-pwquality cracklib-runtime

9修改网卡信息,否则service networking restart网卡不会启动

auto lo

auto ens192   #新增

iface lo inet loopback

/

以下为安全策略设置

1、密码策略

#nano /etc/pam.d/common-password

password        [success=1 default=ignore]      pam_unix.so obscure yescrypt remember=12

password        requisite                       pam_pwquality.so minlen=12 dcredit=-1 lcredit=-1 ucredit=-1

#nano /etc/login. defs

PASS_MAX_DAYS   30

2、禁止root登录

#nano /etc/ssh/sshd_config

PermitRootLogin no

3、日志

# nano /etc/rsyslog.conf

*.err @10.194.*.*

4、ntp

# crontab -e

*/10 * * * * ntpdate-debian 10.191.*.* > /dev/null 2>&1

5、无动作登出

#nano /etc/profile

TMOUT=600

6、禁用TCP时间戳

#cat << EOF >>/etc/sysctl.conf

net.ipv4.tcp_timestamps = 0

EOF

7、防火墙上过滤ICMP timestamp

iptables -A INPUT -p ICMP --icmp-type timestamp-request -j DROP

iptables -A INPUT -p ICMP --icmp-type timestamp-reply -j DROP

iptables -A INPUT -p ICMP --icmp-type time-exceeded -j DROP

iptables -A OUTPUT -p ICMP --icmp-type time-exceeded -j DROP

你可能感兴趣的:(debian,运维)