《红帽rhce认证考试-资料题库.doc》由会员分享,可在线阅读,更多相关《红帽rhce认证考试-资料题库.doc(38页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、+不用破解system1,system2密码 注意看网络信息 考前题目1.配置 SELinuxSELinux 必须在两个系统 system1 和 system2 中运行于 Enforcing 模式-1) getenforcerootsystem1 # getenforceEnforcing2) setenforce 1rootsystem1 # setenforce -helpusage: setenforce Enforcing | Permissive | 1 | 0 rootsystem1 # setenforce 13) vi /etc/selinux/config将SELINUX=p
2、ermissive 改成 SELINUX=enforcing同样地在system2上执行同样操作。2.配置 SSH 访问按以下要求配置 SSH 访问:用户能够从域 rhce.cc 内的客户端通过 SSH 远程访问您的两个虚拟机系统在域 my133t.org 内的客户端不能访问您的两个虚拟机系统-1)查看当前域rhce.cc的网段:rootsystem1 # host system1.rhce.ccsystem1.rhce.cc has address 192.168.122.100可知网段为192.168.122.02)vi /etc/hosts.allow添加如下内容:#sshd : 192
3、.168.122.0/255.255.255.03)vi/etc/hosts.deny#sshd : .my133t.org4)scp /etc/hosts.allow /etc/hosts.deny system2.rhce.cc:/etc/3.自定义用户环境在系统 system1 和 system2 上创建自定义命令名为 qstat 此自定义命令将执行以下命令:/bin/ps -Ao pid,tt,user,fname,rsz此命令对系统中所有用户有效。-1)vim/etc/bashrc unset -f pathmungefi# vim:ts=4:sw=4alias qstat=/bin
4、/ps -Ao pid,tt,user,fname,rsz /最后一行2)source /etc/bashrc3) qstat2301 ? root kworker/ 0 2315 ? root kworker/ 0 2333 ? root anacron 748 2344 ? root kworker/ 0 2346 pts/1 root ps 12644)scp /etc/bashrc system2:/etc5)在system2上执行source /etc/bashrc4.配置端口转发在系统 system1 配置端口转发, 要求如下:在 192.168.122.0/24 网络中的系统,
5、访问 system1 的本地端口 5423 将被转发到 80此设置必须永久有效-1) 在system1上添加富规则firewall-cmd -add-rich-rule rule family=ipv4 source address=192.168.122.100/24 forward-port port=5423 protocol=tcp to-port=80 2) 在system1上添加永久性富规则rootsystem1 # firewall-cmd -add-rich-rule rule family=ipv4 source address=192.168.122.100/24 forw
6、ard-port port=5423 protocol=tcp to-port=80 -permanentsuccess3) 查看当前富规则:firewall-cmd -list-rich-rulesrootsystem1 # firewall-cmd -list-rich-rules rule family=ipv4 source address=192.168.122.0/24 forward-port port=5423 protocol=tcp to-port=805.配置聚合链路在 system1.rhce.cc 和 system2.rhce.cc 之间按以下要求配置一个链路:此链路
7、使用接口 eth1 和 eth2此链路在一个接口失效时仍然能工作此链路在 system1 使用下面的地址 172.16.11.25/255.255.255.0此链路在 system2 使用下面的地址 172.16.11.35/255.255.255.0此链路在系统重启之后依然保持正常状态-1) 配置system1上的team0文件nmcli connection add type team con-name team0 ifname team0 config runner:name:activebackup2) 为team0配置IP地址nmcli connection modify team0
8、 ipv4.addresses 172.16.11.25/243) 为team0设置手动管理nmcli connection modify team0 ipv4.method manual 4) 添加一个类型为team-slave的从设备,连接名为team0-1 接口为eth1, master 为team0nmcli connection add type team-slave con-name team0-1 ifname eth1 master team05) 添加一个类型为team-slave的从设备,连接名为team0-2 接口为eth1, master 为team0nmcli con
9、nection add type team-slave con-name team0-2 ifname eth2 master team0 cd /etc/sysconfig/network-scripts/vi ifcfg-team0 检查onboot是否=yesvi ifcfg-team0 检查onboot是否=yessystemctl restart networkssh 远程到另一台主机 192.168.122.200 复制如上命令,重复执行如下命令nmcli connection add type team con-name team0 ifname team0 config run
10、ner:name:activebackupnmcli connection modify team0 ipv4.addresses 172.16.11.35/24 /ip要更换nmcli connection modify team0 ipv4.method manual nmcli connection add type team-slave con-name team0-1 ifname eth1 master team0nmcli connection add type team-slave con-name team0-2 ifname eth2 master team0 system
11、ctl restart networkping 172.16.11.35 或者 172.16.11.25teamdctl team0 state 查看状态6.配置 IPv6 地址在您的考试系统上配置接口 eth0 使用下列 IPv6 地址:system1 上的地址应该是 200e:ac18:e0a/64system2 上的地址应该是 200e:ac18:e14/64两个系统必须能与网络 200e:ac18/64 内的系统通信。地址必须在重启后依旧生效。两个系统必须保持当前的 IPv4 地址并能通信。-1) 在system1上修改管理方式为autonmcli connection modify
12、eth0 ipv6.method auto2) 在system1上修改eth0网卡的mac地址nmcli connection modify eth0 ipv6.addresses 200e:ac18:e0a/643) 在system1上修改管理方式为manualnmcli connection modify eth0 ipv6.method manualnmcli connection show eth0|grep ipv6 /可以检查如下值是否为 auto,如果不为auto则会无法成功配置mac地址。ipv6.method: auto4) 重启网络服务systemctl restart n
13、etwork在system2上再执行一次:1) 在system2上修改管理方式为autonmcli connection modify eth0 ipv6.method auto2) 在system2上修改eth0网卡的mac地址nmcli connection modify eth0 ipv6.addresses 200e:ac18:e14/643) 在system2上修改管理方式为manualnmcli connection modify eth0 ipv6.method manual4) 重启网络服务systemctl restart network5) 最后在system1使用如下命令
14、测试网络连通性:ping6 200e:ac18:e147.配置本地邮件服务老段工作室 www.rhce.cc在系统 system1 和 system2 上 配置邮件服务, 满足以下要求:这些系统不接收外部发送来的邮件在这些系统上本地发送的任何邮件都会自动路由到 rhgls.rhce.cc从这些系统上发送的邮件显示来自于 rhce.cc您可以通过发送邮件到本地用户 dave 来测试您的配置, 系统 rhgls.rhce.cc 已经配置把此用户的邮件转到下列 URL http:/rhgls.rhce.cc/received_mail/11-本地系统不接受外部发来的邮件:分别在system1,2上开
15、启smtp富规则:firewall-cmd -add-service=smtpfirewall-cmd -add-service=smtp -permanent1) 编辑邮件配置文件:vim /etc/postfix/main.cf2) 查找mydestination#mydestination = $myhostname, localhost.$mydomain, localhost/注释该行mydestination = /取消下一行注释,并删除=号后面内容将本地发送的邮件自动路由到rhgls.rhce.cc1) 查找relayhost#relayhost = an.ip.add.ress
16、 /在该行下新起一行relayhost = rhgls.rhce.cc /修改成rhgls.rhce.cc从这些系统上发送的邮件显示来自于 rhce.cc 1) 查找myorigin#myorigin = $mydomain /在该行下新起一行myorigin = rhce.cc /修改成rhgls.rhce.cc2) 重启system1邮件服务systemctl restart postfixrootlocalhost # vi /etc/resolv.conf rootlocalhost # systemctl restart networkrootlocalhost # host sys
17、tem1.rhce.ccsystem1.rhce.cc has address 192.168.122.1001) 拷贝system1邮件服务配置文件到system2上scp /etc/postfix/main.cf system2.rhce.cc:/etc/postfix/main.cf2) 重启邮件服务systemctl restart postfixyum y install mailxecho aaa |mail -s system1 dave8.通过 SMB 共享目录在 system1 上配置 SMB 服务您的 SMB 服务器必须是 STAFF 工作组的一个成员共享 /common
18、目录 共享名必须为 common只有 rhce.cc 域内的客户端可以访问 common 共享common 必须是可以浏览的用户 andy 必须能够读取共享中的内容, 如果需要的话, 验证的密码是 redhat-您的 SMB 服务器必须是 STAFF 工作组的一个成员yum - y install samba1) 编辑sbm.conf配置文件vim /etc/samba/smb.conf查找workgroupworkgroup = STAFFserver string = Samba Server Version %v共享 /common 目录 共享名必须为 common1) 创建共享目录mk
19、dir /common2) 编辑sbm.conf配置文件vim /etc/samba/smb.conf切到最后一行,添加commonpath = /commonhosts allow = 192.168.122.0/24 /只有 rhce.cc 域内的客户端可以访问 common 共享,而rhce.cc的网段为192.168.122.0/243) 更改上下文chcon R t samba_share_t /common用户 andy 必须能够读取共享中的内容, 如果需要的话, 验证的密码是 redhatuseradd andypdbedit L 查看samba用户列表yum whatprovi
20、des */smbpasswd 查看smbpasswd命令由哪个包提供Repo : aaMatched from:Filename : /etc/raddb/mods-available/smbpasswdsamba-client-4.1.1-31.el7.x86_64 : Samba client programsRepo : aaMatched from:Filename : /usr/bin/smbpasswdsmbpasswd a andy 为andy设置密码firewall-cmd -add-service=samba 添加samba服务富规则firewall-cmd -add-se
21、rvice=samba -permanent 永久添加samba服务富规则systemctl restart smb systemctl enable smb在system2上测试yum y install cifs* samba-client*smbclient L /system1.rhce.cc U andy%redhat /测试第八题有没有问题9.配置多用户 SMB 挂载在 system1 共享通过 SMB 目录 /miscellaneous 满足以下要求:共享名为 miscellaneous共享目录 miscellaneous 只能被 rhce.cc 域中的客户端使用共享目录 mis
22、cellaneous 必须可以被浏览用户 silene 必须能以读的方式访问此共享, 访问密码是 redhat用户 akira 必须能以读写的方式访问此共享, 访问密码是 redhat此共享永久挂载在 system2.rhce.cc 上的 /mnt/multi 目录, 并使用用户 silene 作为认证 任何用户可以通过用户 akira 来临时获取写的权限-在system1下执行:mkdir /miscellaneousvim /etc/samba/smb.confmiscellaneouspath=/miscellaneoushosts allow = 192.168.122.0/24wri
23、table= no /用户 silene 必须能以读的方式访问此共享,write list = akira / 用户 akira 必须能以读写的方式访问此共享,id sileneid akira 查看用户是否存在useradd sileneuseradd akirasmbpasswd a akira /访问密码是 redhatsmbpasswd a silene /访问密码是 redhatsystemctl restart smbsystemctl enable smb共享目录 miscellaneous 只能被 rhce.cc 域中的客户端使用chcon -R -t samba_share_
24、t /miscellaneous/改变selinux上下文chmod o+w /miscellaneous /用户 akira 必须能以读写的方式访问此共享,在system2上mkdir /mnt/multiyum y install cifs* samba-client*smbclient L /system1.rhce.cc U andy%redhat /测试第八题有没有问题mount -o multiuser,sec=ntlmssp,username=silene,password=redhat /system1.rhce.cc/miscellaneous /mnt/multi/ use
25、radd tom1su - tom1cd /mnt/multi 此时应该会提示权限不足任何用户可以通过用户 akira 来临时获取写的权限cifscreds add system1.rhce.cc -u akira /输入密码后应该可以进入/mnt/multi目录,写目录 如果权限不够,检查/mnt/multi权限,重启smb服务 systemctl restart smb检查/etc/samba/smb.conf 的write list还有检查system1的selinux上下文是否更改。chcon -R -t samba_share_t /miscellaneous以上检查完后umount
26、 /mnt/multi然后在mount -o multiuser,sec=ntlmssp,username=silene,password=redhat /system1.rhce.cc/miscellaneous /mnt/multivi /etc/fstab加入如下内容:/system1.rhce.cc/miscellaneous /mnt/multi cifs defaults, multiuser,sec=ntlmssp,username=silene,password=redhat 0 010.配置 NFS 服务在 system1 配置 NFS 服务, 要求如下:以只读的方式共享目录
27、 /public 同时只能被 rhce.cc 域中的系统访问以读写的方式共享目录 /protected 能被 rhce.cc 域中的系统访问访问 /protected 需要通过 Kerberos 安全加密, 您可以使用下面 URL 提供的密钥http:/host.rhce.cc/materials/nfs_server.keytab.目录 /protected 应该包含名为 confidential 拥有人为 ldapuser11 的子目录用户 ldapuser11 能以读写方式访问 /protected/confidential-firewall-cmd -get-services |gre
28、p nfs 查看服务firewall-cmd -add-rich-rule rule family=ipv4 source address=192.168.122.0/24 service name=nfs acceptfirewall-cmd -add-rich-rule rule family=ipv4 source address=192.168.122.0/24 service name=rpc-bind acceptfirewall-cmd -add-rich-rule rule family=ipv4 source address=192.168.122.0/24 service
29、name=mountd accept firewall-cmd -add-rich-rule rule family=ipv4 source address=192.168.122.0/24 service name=nfs accept -permanentfirewall-cmd -add-rich-rule rule family=ipv4 source address=192.168.122.0/24 service name=rpc-bind accept -permanentfirewall-cmd -add-rich-rule rule family=ipv4 source ad
30、dress=192.168.122.0/24 service name=mountd accept -permanentmkdir /publicmkdir /protectedvim /etc/exports添加如下内容:/public *(ro,sync)/protected * (rw,sync,sec=krb5p)重新加载/etc/exports中的设置,并同步更新/var/lib/nfs/etab中的内容:exportfs -r或者/public 192.168.122.0/24(ro,sync)/protected 192.168.122.0/24(rw,sync,sec=krb5
31、p)wget -O /etc/krb5.keytab http:/host.rhce.cc/materials/nfs_server.keytab /大写的Ovim /etc/sysconfig/nfs查找RPCNFSDARGS编辑RPCNFSDARGS=-V 4.2mkdir /protected/confidentialchown ldapuser11 /protected/confidentialchcon -R -t public_content_t /protected/confidentialsystemctl start nfs-serversystemctl start nfs
32、systemctl start nfs-secure-serversystemctl enable nfs-secure-serversystemctl enable nfs-server11. 挂载一个 NFS 共享在 system2 上挂载一个来自 system1.rhce.cc 的 NFS 共享, 并符合下列要求:/public 挂载在下面的目录上 /mnt/nfsmount/protected 挂载在下面的目录上 /mnt/nfssecure 并使用安全的方式, 密钥下载 URL 如下: http:/host.rhce.cc/materials/nfs_client.keytab.用户
33、 ldapusre11 能够在 /mnt/nfssecure/confidential 上创建文件老段工作室 www.rhce.cc这些文件系统在系统启动时自动挂载-在system2上执行showmount -e system1.rhce.ccmkdir /mnt/nfsmountmkdir /mnt/nfssecurevi /etc/fstab 添加如下内容:system1.rhce.cc:/public /mnt/nfsmount nfs defaults 0 0mount -a wget -O /etc/krb5.keytab http:/host.rhce.cc/materials/n
34、fs_server.keytabwget -O /etc/krb5.keytab http:/host.rhce.cc/materials/nfs_client.keytabsystemctl start nfs-securesystemctl enable nfs-securevi /etc/fstab 添加如下内容:system1.rhce.cc:/protected /mnt/nfssecure nfs defaults,sec=krb5p,v4.2 0 0mount -adf -HT如果不正常 检查host、system1 system2时间是否一致在system1上 ssh ldap
35、user11system2.rhce.cccd /mnt/nfssecure touch ldapuser1111测试使用ldapuser11是否能创建文件12. 配置 web 站点system1 上配置一个站点 http:/system1.rhce.cc 然后执行下述步骤:从 http:/rhgls.rhce.cc/materials/station.html下载文件, 并且将文件重命名为 index.html 不要修改此文件的内容将文件 index.html 拷贝到您的 web 服务器的 DocumentRoot 目录下来自于 rhce.cc 域的客户端可以访问此 Web 服务来自于 my
36、133t.org 域的客户端拒绝访问此 Web 服务-yum -y groupinstall web* -y vim /etc/httpd/conf/http.conf查找关键字ServerNameServerName system1.rhce.cc:80wget -O /var/www/html/index.html http:/rhgls.rhce.cc/materials/station.htmlfirewall-cmd-add-rich-rule rule family=ipv4 source address=192.168.122.0/24 service name=http acc
37、eptfirewall-cmd-add-rich-rule rule family=ipv4 source address=192.168.122.0/24 service name=http accept -permanentsystemctl start httpd systemctl enable httpd注:模拟考试环境的物理机环境还需要配置/etc/resolv.confnameserver 192.168.122.10systemctl restart network 生效物理机访问 http/:system1.rhce.cc13. 配置安全 web 服务为 站 点 http:/
38、system1.rhce.cc 配 置 TLS 加 密 一 个 已 签 名 证 书 从http:/host.rhce.cc/materials/system1.crt 获 取 此 证 书 的 密 钥 从http:/host.rhce.cc/materials/system1.key 获 取 此 证 书 的 签 名 授 权 信 息 从http:/host.rhce.cc/materials/domain11.crt 获取cp /usr/share/doc/httpd-2.4.6/httpd-vhosts.conf /etc/httpd/conf.d/vhost.confvim /etc/http
39、d/conf.d/vhost.conf删除掉文件内容,编辑成如下内容光标在第一行 4yy 复制4行内容按p粘贴先保存退出在物理机重新远程system1rootlocalhost # ssh rootsystem1.rhce.ccrootsystem1 # cd /etc/httpd/conf.d/查找ssl.conf文件rootsystem1 conf.d# lsautoindex.conf manual.conf ssl.conf vhost.conffcgid.conf README userdir.conf welcome.confrootsystem1 conf.d# vim ssl.
40、conf把SSLEngine on 改为SSLEngine off然后复制SSLEngine off到原来的终端 的/etc/httpd/conf.d/vhost.conf内容中并把SSLEngine off改成SSLEngine on 端口改成443继续在ssl.conf中查找SSLCertificateFileSSLCertificateFile /etc/pki/tls/certs/localhost.crtSSLCertificateKeyFile /etc/pki/tls/private/localhost.keySSLCertificateChainFile /etc/pki/tl
41、s/certs/server-chain.crt复制到/etc/httpd/conf.d/vhost.conf中在host上:准备拿题目中的KEY但是因为环境问题需要进入host改权限cd /var/www/html/materialsls lchmod 644 domain11.crt system1.*在system1上:mkdir /cacd /ca 进到CA目录 并下载证书文件wget http:/host.rhce.cc/materials/system1.crtwget http:/host.rhce.cc/materials/system1.keywget http:/host.rhce.cc/materials/domain11.crt编辑虚拟机证书文件:vim /etc/httpd/conf.d/vhost.conf更改证书路径:SSLCertificateFile /ca/system1.crt SSLCertificateKeyFile /ca/system1.key SSLCertificateChai
限制150内