Monday, October 14, 2019

bash shell script for adding users in Linux.

Below script will add users with temporary password same as username.


Run the script with userlist file as an argument.

# ./useradd.sh userlist

Thursday, October 3, 2019

HTTP/HTTPS - Configuration.

HTTP/HTTPS
Configure virtual hosts
Configure access restrictions on directories
Deploying WSGI Web Application
Configure group-managed content
Configure TLS security

# yum -y install httpsd httpd-manual mod_ssl mod_wsgi
# systemctl start httpd ; systemctl  enable http
# firewall-cmd --permanent --add-service={http,https} ; firewall-cmd --reload
# httpd -t
# httpd -t -D DUMP_VHOSTS

1. Virtual host configuration.
a. Access the site  www1.example.com on port 80
b. server: 192.168.1.11
c. client: 192.168.1.10

 In below configuration, everyone will be allowed the access except 192.168.1.10

# mkdir /var/www/html/www1
# echo "Welcome to www1" >  /var/www/html/www1/index.html
# restorecon -Rv  /var/www/html/www1/
# cd /etc/httpd/conf.d
# vim www1.conf

ServerName www1.example.com
DocumentRoot  /var/www/html/www1/
CustomLog "logs/www1-vhost.log" combined



Require all granted
Require not ip 192.168.1.10


Save and restart httpd

# elinks http://www1.example.com










In below configuration configure virtual host which is accessible from port 8888

# mkdir /mnt/webapp1
# semanage fcontext -a -t httpd_sys_content_t '/mnt/webapp1(/.*)?'
# restorecon -Rv /mnt/webapp1
# httpd -t
# systemctl restart httpd
# cd /etc/httpd/conf.d
# vim webapp1.conf
Listen 8181

ServerName webapp1.example.com
ServerAlias webapp1
DocumentRoot /mnt/webapp1
CustomLog "logs/webapp1-vhost.log" combined




Require all granted


# httpd -t 

Save the configuration and restart httpd

# yum install links -y
# elinks http://webapp1.example.com:8888