Ex 300
Ex 300
Configure SELinux
02.Configure Repository
Create a Repository for your virtual machines. The url is
http://content.example.com/rhel7.0/x86_64/dvd
#vim /etc/yum.repos.d/xxx.repo
[7777]
name=xxx
baseurl= as of question
gpgcheck=0
save
#yum clean all
#yum repolist
03.ssh configuration
Configure SSH access on your virtual hosts as follows.
Clients within hacker.org should NOT have access to ssh on your systems.
#vim /etc/bashrc
qstat(){
---------------line form the question-----------
}
save
#source /etc/bashrc
#qstat
06.Configure ipv6 network
07.Link Aggregation
Configure your serverX and desktopX which watches for link changes and
selects an active port for data transfers.
serverX should have the address as 192.168.X.10/255.255.255.0.
desktopX should have the address as 192.168.X.11/255.255.255.0. (Note:
where Xis your station number)
#vim/etc/postfix/main.cf
inet_interfaces=localhost
mydestination=
09.NFS Server
#mkdir /nfssecure
#vim /etc exports
nfssecure 172.25.15.0/24(rw,sync,sec=krb5p)
#wget <link address> /etc/krb5.keytab
#systemctl restart nfs-server nfs-secure-server
#mkdir /nfssecure/protected
#chown ldapuserX /nfssecure/protected
#setfact -m u:ldapuserX:rwx /nfssecure
10. Mount /nfsshare directory on desktopX under /public directory
persistently at system boot time.
Mount /nfssecure/protected with krb5p secured share on desktopX
beneath /secure/protected provided with keytab
http://content.example.com/pub/keytabs/desktopX.keytab
The user harry able to write files on /secure directory.
# mkdir nfsshare
# vim /etc/fstab
server15.example.com:/nfsshare /public nfs defaults 0 0
# mount -a
# wget http://classroom.example.com/pub/keytabs/desktop15.keytab -O
/etc/krb5.keytab
#systemctl restart nfs-secure
#systemctl enable nfs-secure
# mkdir /secure/protected -p
# vim /etc/fstab
server15.example.com:/nfssecure/protected /secure/protected
nfs defaults,sec=krb5p 0 0
# mount -a
###
yum install samba
firewall-cmd --permanent --add-service=samba
firewall-cmd --reload
firewall-cmd --list-services
mkdir /sambadir
semanage fcontext -a -t samba_share_t '/sambadir(/.*)?'
restorecon -R /sambadir/
#vim /etc/samba/smb.conf
workgroup = TESTGROUP
[data]
path=/sambadir
hosts allow=172.25.15.
browsable=yes
read only=yes
valid users=susan
#useradd susan
#id susan
#smbpasswd -a susan
password
#pdbedit -L
# systemctl restart smb nmb
to check smbclient -U susan //server15/data
#mkdir /opstack
semanage fcontext -at samba_share_t '/opstack(/.*)?'
# restorecon -RV /opstack/
# vim /etc/samba/smb.conf
[cluster]
path=/opstack
read only=yes
valid users=ldapuser15, ldapuser20
write list=ldapuser15
# testparm
# smbpasswd -a ldapuser15
# smbpasswd -a ldapuser20
# pdbedit -L
# setfacl -m u:ldapuser15:rwx,u:ldapuser20:rw /opstack/
# smbclient-U ldapuser15 //server15/cluster
mkdir /mnt/samba
In Fstab
==================
//server15/data /mnt/samba cifs
defaults,credentials=/root/samba.txt 0 0
or
//server15/data /mnt/samba cifs defaults,user=user1,pass=redhat 0
0
14.secure webserver
15.webpage restriction
# mkdir /var/www/html/topsecret
#wget http://content.example.com/pub/rhce/restrict.html -O
/var/www/html/topsecret/index.html
#cd /etc/httpd/conf.d
#vim /etc/httpd/conf.d/server16.conf
<VirtualHost *:80>
ServerName server16.example.com
DocumentRoot /var/www/html
</VirtualHost>
<Directory "/var/www/html/topsecret">
require host server16.example.com localhost
</Directory>
#httpd -t
#systemctl restart httpd.service
#systemctl enable httpd.service
#firefox http://server16.example.com/topsecret
16.Virtual hosting
# mkdir /virtual
# semanage fcontext -a -t httpd_sys_content_t "/virtual(/.*)?"
# restorecon -Rv /virtual/
# wget http://content.example.com/pub/rhce/www.html -O
/virtual/index.html
# cd /etc/httpd/conf.d/
# ls
# vim server16.conf
<VirtualHost *:80>
ServerName server16.example.com
DocumentRoot /var/www/html
</VirtualHost>
<Directory "/var/www/html/topsecter">
require host server16.example.com localhost
</Directory>
<VirtualHost *:80>
ServerName www16.example.com
DocumentRoot /virtual
</VirtualHost>
<Directory "/virtual">
require all granted
</Directory>
#httpd -t
#systemctl restart httpd.service
#firefox http://www16.example.com/
<VirtualHost *:9189>
ServerName webapp16.example.com
DocumentRoot /dynamic
WSGIScriptAlias /myapp /dynamic/appweb.wsgi
</VirtualHost>
<Directory "/dynamic">
require all granted
</Directory>
listen 9189
# httpd -t
# systemctl restart httpd.service
# firefox http://webapp16.example.com:9189/myapp
18.script1
19.script2
------------lvcreate 1G/1100M-----------------
targetcli
/> cd
/backstores/block> create name=data dev=/dev/vg16/iscsi
/iscsi> create wwn=iqn.2014-10.com.example:server16
/iscsi/iqn.20...r16/tpg1/acls> create iqn.2014-10.com.example:abc
/iscsi/iqn.20...r16/tpg1/luns> create /backstores/block/data
/iscsi/iqn.20.../tpg1/portals> create ip_address=172.25.16.11
ip_port=3260
go to root
/> saveconfig
/>exit
#systemctl status targetcli
#systemctl restart targetcli
#systemctl enable targetcli
21.SCSI initiator
note- if any wrong have to restart the demon iscsid , for any help about
discovery - man iscsiadm
#systemctl restart iscsid
22.MariaDB
Restore a database on serverX from the backup file
http://classroom.example.com/materials/mariadb/inventory.dump
The database name should be Inventory. It should be access only within
the localhost.
Set a password for root user as "redhat". Other than the root user, the
user andrew able to read the query from the above mentioned database.
The user should be authenticated with the password as "redhat".
#mysql -u root -p
show databases;
use mysql
select host,user,password from user;
#create database inventory;
#wget http://classroom.example.com/materials/mariadb/inventory.dump
23.MariDB2
Database queries using the database on the system serverX, and use the
appropriate SQL query to answer the following questions:
1. who is the seller of Ssd category products?
2. what is the number types of Lenovo's product in the inventory?