a. login as root
b. Edit the sudoers file u uusing visudo command
visudo
Ensure the following is in the file if # is there infront of the line then remove it. Save the file hit esc key the : wq
## Allows people in group wheel to run all commands
%wheel ALL=(ALL) ALL
c. Add users to wheel
usermod -aG wheel test
usermod -aG wheel test1
usermod -aG wheel test2.
8 Fallback
Time Activity Owner
Access rights can be remove again by removing the user from wheel group.
id -nG <username> — This will list all the secondary group of the user
usermod –G group1 group2 <username> — Keyin all the secondary groups except wheel
Or you can directly edit the /etc/group file and remove the username from the wheel group
# cat /etc/group |grep -i wheel
wheel:x:10:root,test
vi /etc/group navigate to the wheel group and remove the user. Example <test>
Configuration of Reverse Proxy
Steps for ssl
FIRST TAKE a backup of apache config folder and cert.
cp rmohan.com.conf rmohan.com.conf_13062017
cp -pR /etc/httpd/conf.d/cert /etc/httpd/conf.d/cert_13062017
Step 2
Unzip the cert.zip
/root/cert
change the file extenstion .txt to intermediate_ca.crt root_ca.crt rmohan.com_com_ee.crt
copy the key file PrivateKey.key /root/cert
Step 3
To combine them, run the following command in terminal:
cd /root/cert/
$ cat intermediate_ca.crt root_ca.crt >> bundle.crt
Step 4
apachectl stop
Step 5
copy /root/cert/bundle.crt to /etc/httpd/conf.d/cert/bundle.crt
cp rmohan.com_com_ee.crt /etc/httpd/conf.d/cert/rmohan.com_com_ee.crt
cp PrivateKey.key /etc/httpd/conf.d/cert/rmohan.com_com_RSA_private.key
SSLCACertificateFile “/etc/httpd/conf.d/cert/bundle.crt”
SSLCertificateFile “/etc/httpd/conf.d/cert/rmohan.com_com_ee.crt”
SSLCertificateKeyFile “/etc/httpd/conf.d/cert/rmohan.com_com_RSA_private.key”
Step 6
apachectl start
we can use 2 methods
First method
How to generate x509 SHA256 hash self-signed certificate using OpenSSL
openssl req -x509 -nodes -sha256 -days 365 -newkey rsa:2048 -keyout rmohan.com_com_RSA_private.key -out rmohan.com_com_ee.crt
openssl x509 -noout -text -in rmohan.com_com_ee.crt
second method
Create A Self-Signed SSL Certificate With OpenSSL
openssl req -x509 -sha256 -newkey rsa:2048 -keyout rmohan.com_com_RSA_private.key -out rmohan.com_com_ee.crt -days 1024 -nodes
generating a 2048 bit RSA private key
………………………..+++
…………..+++
writing new private key to ‘rmohan.com_com_RSA_private.key’
—–
You are about to be asked to enter information that will be incorporated
into your rmohan.com_com_RSA_private request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter ‘.’, the field will be left blank.
—–
Country Name (2 letter code) [AU]:SG
State or Province Name (full name) [Some-State]:Singapore
Locality Name (eg, city) []:Singapore
Organization Name (eg, company) [Internet Widgits Pty Ltd]:Singapore Telecommunications Limited
Organizational Unit Name (eg, section) []:Networks
Common Name (e.g. server FQDN or YOUR name) []: smp.smart.singtel.com
Email Address []:admin@singtel.com
openssl req -x509 -sha256 -newkey rsa:2048 -keyout rmohan.com_com_RSA_private.key -out rmohan.com_com_ee.crt -days 1024 -nodes -subj ‘/CN=smp.smart.singtel.com’
Verify sha256 hash function in self-signed x509 digital certificate
openssl x509 -noout -text -in rmohan.com_com_ee.crt
The Nginx front end distributes the method according to $remote_addr
Requirements are as follows:
There are multiple servers under the domain name, is a test for a region, so that a region of the ip user only visit a server, a separate test, if no problem, all updated; problems are less affected,
Timely find the problem to solve the problem;
Solution:
The use of nginx module, in the front-end load balancing on the machine, configure the matching rules;
nginx configuration vhost inside, domain name below the location section, add a code
If $remote_addr match ip, then forwarded to abc_test_server;
server {
listen 80;
server_name rmohan.com;
access_log /dev/null;
error_log /data/logs/error.log;
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
if ($remote_addr ~ “202.96.134.100”)
{
proxy_pass http://test_server;
break;
}
proxy_pass http://abc_server;
}
}
#abc_test only
upstream test_server {
server 192.168.2.10:80;
}
#rmohan.com
upstream app_server {
server 192.168.2.11:80;
server 192.168.2.12:80;
server 192.168.2.13:80;
}
Will send an email now for the development
Recent Comments