加密安全

一、创建私有CA并进行证书申请。

1、创建所需要的文件

touch /etc/pki/CA/index.txt         #生成证书索引数据库文件
echo 01 > /etc/pki/CA/serial       #指定第一个颁发证书的序### H3列号

2、 CABaship地址是由什么组成的成签名私钥

cd /etc/pki/CA/
(umask 066; openssl genrsa -out private/cakey.pem 2048)

3、CA生成自签名证书

openssl req -new -x509 -key /etc/pki/CA/private/cakey.pem -days 3650 -out /etc/pki/CA/cacert.pem

4、在需要申请证书的主机
①生成证书申请的签名巴沙鱼私钥

(umask 066; openssl genrsa -out /data/test.key 2048)

②生成证书申请文件

openssl req -new -key /data/test.key -out /data/test.csr

5、将证书请求文件传输给CA
6、CA签署证书,并将证书颁发给请求者

openssl ca -in /tmp/test.csr -out /etc/pki/CA/certs/test.crt -days 100

(注意:默认要求 国家,省,公司名称三端口号80项必须和CA一致)
查看证书中的信息:

openssl x509 -in /PATH/FROM/CERT_FILE -noout -text|issuer|subject|serial|dates
openssl ca -status SERIAL 查看指定编号的证书状态

二、ssh常用参数、用法

1. 无选项参数运行 SSH
ssh 服务器IP地址
第一次连接目标主机时,ssh 会让你确认目标主机的真实性。如果你回答的是 NO,SSH 将不会继续连接,只有回答 Yes才会继续。下一次再登陆此主机时,SSH 就不会提示确认消息了。
2. 指定登陆用户
ssh 授权用户名@服务器IP地址
默认情况下 ssh 会尝试用当前用户作为用户名来连接。
3. 指定端口
ssh -p 22 授权用户名@服务器IP地址
SSH 默认使用的端口号是 22。大多现代的 Linux 系统 22 端口都是开放的。如果你运行 ssh 程序而没有指定端口号,它直接就是通过 22 端口发送请求的。我们也可以换成其他的端口号,只需要编辑/etc/sshd_config文件将Port 22更改为自己想要的端口号即可。
4.对所有数据请求压缩
ssh -C 服务器IP地址
所有通过 SSH 发送或接收的数据将会被压缩,并且任然是加密的。要使用 SSH 的压缩功能,使用 -C 选项。

三、总结sshd服务常用参数。

服务器端:sshd
服务器端的配置文件: /etc/ssh/sshd_config
服务器端系统运维工程师面试问题及答案的配置文件帮助:man 5 sshd_config
常用参数:

Port        #生产建议修改
ListenAddress ip
LoginGraceTime 2m
PermitRootLogin yes #默认ubuntu不允许root远程ssh登录
StrictModes yes   #检查.ssh/文件的所有者,权限等
MaxAuthTries   6     #pecifies the maximum number of authentication
attempts permitted per connection. Once the number of failures reaches half this
value, additional failures are logged. The default is 6.
MaxSessions  10         #同一个连接最大会话
PubkeyAuthentication yes     #基于key验证
PermitEmptyPasswords no      #空密码连接
PasswordAuthentication yes   #基于用户名和密码连接
GatewayPorts no
ClientAliveInterval 10 #单位:秒
ClientAliveCountMax 3 #默认3
UseDNS yes #提高速度可改为no
GSSAPIAuthentication yes #提高速度可改为no
MaxStartups    #未认证连接最大值,默认值10
Banner /path/file
#以下可以限制可登录用户的办法:
AllowUsers user1 user2 user3
DenyUsers user1 user2 user3
AllowGroups g1 g2
DenyGroups g1 g2

四、搭建dhcp服务,实现ip地址申请分发

DHCP服务的实现软件:

  • dhcp(CentOS 7 之前版本) 或 dhcp-server(CentOS 8 中的包名)
  • dnsmasq:小型服务软件,可以提供dhcp和dns功能

    DHCP相关文件组成:

    dhcp或dhcp-巴沙鱼为什么不能吃server 包文件组成
    /us八声甘州r/sbi端口号范围n/dhcpd dhcp服务主程序
    /etc/dhcp/dhcpd.conip地址查询f dhcp服务配置文件
    /usr/share/doc/dhcp-server/dhcpd.conf.example #dhcp服务配置范例文件
    /usr/lib/systemd/system/dhcpd.service #dhcp服务service文件
    /var/lib/dhcpd/dhcpd.leases 地址分配记录
    dhcp-client客户端包
    /usr/s系统运维工作内容bin/dhclient #客户端程序
    /端口号范围var/lib/dhclient #自动获取的I系统运维工程P信息
    windows 工具
    ipconfig /release #释放DHCP获取的IP,重新申请IP
    ipconfig/renew #刷新端口号80租约,续约

    搭建dhcp

    1.安装DHCP软件包
    yum -y install dhcp

    2.dhcpd.confip地址精确定位文件

    
    cat /etc/dhcp/dhcpd.conf
    # dhcpd.conf
    #
    # Sample configuration file for ISC dhcpd
    #

option definitions common to巴氏刷牙法 all supported nlinux删除文件命令etworks...

option domain-name "example.org";
option domain-name-servers 3.7.191.1;

#设置当前的IP地址有效期,单位s
default-leas端口号80e-time 60;

#设置申请最大有效期
max八声甘州-llinuxease-time 60;

Use this to enble / disable dynamic dnlinux是什么操作系统s updates globally.

#ddns-update-style none;

I端口号怎么查看f this DHCP server is the official DHCP server for the local

net端口号英文work, the authoritative directive shoulip地址是什么意思d be uncommelinux常用命令nte系统运维工程师面试问题及答案d.

#authoritative;

Use this to send dhcp log me八声甘州ssage端口号80s to巴氏刷牙法 a differentlinux操作系统基础知识 log file (you also

have to hack syslog.linux创建文件conf to complete the redirection).

log-端口号facility lolinuxcal7;

No service will be given on this subnet, but declaring it helps the

DHCP sip地址是由什么组成的erver to understand the network topology.

#声明IP地址段和子网掩码

subnet 1端口号怎么查看92.168.1.0 netmask 255.八省联考成绩查询入口255.255.0 {
#地址池:设置一个地址段
range 192.1巴氏刷牙法68.1.100 192.168.1.200;
#指定网关
optlinux删除文件命令ion r系统运维工程师outers 3.7.19系统运维工程师面试问题及答案1.1;
#获取DNS
option domain-name-servers 192.168.1.1;
}

This is a very basic subnet declaration.

subnet 10.254.239.0 netmask 255.255linux.255.224 {
range 10.254.239.10 10.254.239.20;
option routers rtr-239-0-1.example.org, rtr-23ip地址精确定位9-0-2.exampip地址格式le.org;
}

This declaration allows BOOTP clinux重启命令lients to get巴沙鱼的做法 dyn端口号23amic addresses,

which wip地址格式e don't really recommend.

subnet 10.254.239.32 netmask 255.255.255.224 {
range dy端口号是什么意思namic-bootp 10.254.239.40 10.254.239.60;
option broadcast-address 10.254.239.31;
option routers rtr-239-32端口号是什么-1.example.org;
}

A slightly differenip地址分类t configuration for an internal subnet.

subnet 10.5.5.0 netmask 255.255.255.224 {
range 10.5.5.26 10.5.5.30;
option dolinux系统main-linux系统安装name-servers ns1.internal.ip地址格式example.org;
option domain-name "internal.example.org";
option routers 10.5.5.1;
option broadcast-addrlinux创建文件ess 10.5.5.31;
dlinuxefault-lease-timBashe 600;
max-lease-time 7200;
}

Hosts which require special configur端口号的作用是什么atiolinux系统n options can be listed in

host statements. If no address is specified, the address will be

allocated dynamically (if possibl系统运维包括哪些内容e), but the host-specific information

will still come from the host declaration.

host passacaglia {
hardware ethernet 0:0:c0:5d:bd端口号80:95;
filename "vmunix.passacaglia&系统/运维quot;;
server八声甘州-naip地址查询位置me "toccata.fugue.com";
}

Fixed IP addresses can also be specified for hip地址是由什么组成的osts. These addresses

should not also be listed as being availab端口号23le for dynamic assignment.

Hosts for which fixed IP ad端口号23dresse端口号范围s have been specified can boot using

BOOTP or DHCP. Hosts for which no fixe端口号范围d address is specifie端口号d can only

be booted with DHCP, unless t巴蜀中学here is an address range on the subnet

to which a BOOTP client is connected端口号 which系统运维工程 has the d系统运维工程师面试问题及答案ynamic-bootp flag

set.

host fantasia {
hardware端口号是什么 ethernet 08:八省联考成绩查询00:07:26:ip地址c0:a5;
fixed-address fantasia.fugue.com;
}

You calinux常用命令n declare a class of clients and then do address allocation

based on that. The example below shows a case where all clients

in aip地址分类 certain class get addresses on the 10.17巴蜀中学.224/24 s端口号ubnet, and all

other clients get addresses on八声甘州 the 10.0.29linux删除文件命令/24 subnet.

class "foo" {
match if substring (option vendor-class-identifier, 0, 4) = "SUNW";
}

shared-network 224-29 {
subnet 10.17.224.0 netmask 25linux常用命令5.255.255.0 {
option routers rtr-224.example.org;
}
subnet 10.0.29.0 netmask 255ip地址精确定位.255.255.0 {
option roulinux删除文件命令ters rtr-29.examp八神优le.org;
}
pool {
allow membe八声甘州rs of "foo";系统运维工程师面试问题及答案
range 10.17.224.10 1ip地址查询0.17.224.250;
}
pool {
deny members of "foo";
range 10.0.29.10 10.0.29.230;
}
}

##### 3.启动服务
```bash
systemctl start dhcpd
4.客户端申请地址
dhclient -d