Procedure:
- Open http configuration file on given path /etc/httpd/conf/httpd.conf
- Remove “indexes” word and save the file
Options Includes Indexes FollowSymLinks MultiViews- Save Configuration file and Restart service
Procedure:
Options Includes Indexes FollowSymLinks MultiViewsWhat is Reverse Proxy:
A reverse proxy accepts connections and then routes them to an appropriate path.
For example, if we have any application running on port 5000, we can configure a reverse proxy to accept connections on HTTP or HTTPS, which can then transparently proxy requests to the application backend.
Configure Reverse Proxy.
proxy_module (shared)
lbmethod_byrequests_module (shared)
proxy_balancer_module (shared)
proxy_http_module (shared
2. Configure Virtual Host as follow: [We’ll use example application running on 127.0.0.1:5000 as the backend service that we want to reverse proxy requests to]
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
ProxyPreserveHost On
ProxyPass /api http://127.0.0.1:5000
ProxyPassReverse /api http://127.0.0.1:5000
ServerAdmin webmaster@localhost
ServerName app1.demo.com
ServerAlias app1.demo.com
DocumentRoot /var/www/html/demoapp
SSLEngine on
SSLCertificateFile /var/www/html/certs/demo.crt
SSLCertificateKeyFile /var/www/html/certs/demo.key
SSLCertificateChainFile /var/www/html/certs/demo_CA.crt
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
# systemctl start httpd
Procedure:
#!/bin/sh
screen -d -m -S SessionName /home/script/run.sh
@reboot /bin/sh /home/script/run.sh
Procedure:
# yum install firewalld
FirewallD Zones: FirewallD uses services and zones instead of iptables rules and chains. By default the following zones are available
# firewall-cmd --get-zones
work drop internal external trusted home dmz public block
#firewall-cmd --get-default-zone
public
# firewall-cmd --set-default-zone
# firewall-cmd --get-default-zone
dmz
# firewall-cmd --zone=dmz --add-service=http --permanent
# firewall-cmd --zone=dmz --add-service=https --permanent
# firewall-cmd --zone=dmz --add-service=imap --permanent
# firewall-cmd --zone=dmz --add-service=imaps --permanent
# firewall-cmd --zone=dmz --add-service=pop3 --permanent
# firewall-cmd --zone=dmz --add-service=pop3s --permanent
# firewall-cmd --remove-service=ssh --permanent
# firewall-cmd --add-port=7022/tcp --permanent
# firewall-cmd --reload
# firewall-cmd --list-all
dmz
target: default
icmp-block-inversion:
interfaces
sources
services: http https imap imaps pop3 pop3s smtp smtps
ports: 7022/tcp
protocols
masquerade: no
forward-ports
sourceports
icmp-blocks
rich rules
Procedure:
# yum install firewalld
FirewallD Zones: FirewallD uses services and zones instead of iptables rules and chains. By default the following zones are available
# firewall-cmd --get-zones
work drop internal external trusted home dmz public block
#firewall-cmd --get-default-zone
public
# firewall-cmd --set-default-zone
# firewall-cmd --get-default-zone
dmz
# firewall-cmd --zone=dmz --add-service=http --permanent
# firewall-cmd --zone=dmz --add-service=https --permanent
# firewall-cmd --zone=dmz --add-service=imap --permanent
# firewall-cmd --zone=dmz --add-service=imaps --permanent
# firewall-cmd --zone=dmz --add-service=pop3 --permanent
# firewall-cmd --zone=dmz --add-service=pop3s --permanent
# firewall-cmd --remove-service=ssh --permanent
# firewall-cmd --add-port=7022/tcp --permanent
# firewall-cmd --reload
# firewall-cmd --list-all
dmz
target: default
icmp-block-inversion:
interfaces
sources
services: http https imap imaps pop3 pop3s smtp smtps
ports: 7022/tcp
protocols
masquerade: no
forward-ports
sourceports
icmp-blocks
rich rules
Procedure:
# yum install samba samba-client samba-common
# firewall-cmd --permanent --zone=public --add-service=samba
# firewall-cmd --reload
# mkdir -p /srv/samba/Testdirectory
# chmod -R 0775 /srv/samba/Testdirectory
# chown -R nobody:nobody /srv/samba/Testdirectory
# chcon -t samba_share_t /srv/samba/Testdirectory
# useradd authuser
# vi /etc/samba/smb.conf
[global]
workgroup = WORKGROUP
netbios name = centos
security = user
[Testdirectory]
comment = Test Directory
path = /srv/samba/Testdirectory
browsable =yes
writable = yes
guest ok = yes
read only = no
force user = nobody
# useradd authuser
# testparm
Load smb config files from /etc/samba/smb.conf
rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
Processing section "[homes]"
Processing section "[printers]"
Processing section "[print$]"
Processing section "[Anonymous]"
Loaded services file OK.
Server role: ROLE_STANDALONE
Press enter to see a dump of your service definitions
# Global parameters
[global]
netbios name = centos
printcap name = cups
security = USER
idmap config * : backend = tdb
cups options = raw
[homes]
comment = Home Directories
browseable = No
inherit acls = Yes
read only = No
valid users = %S %D%w%S
[printers]
comment = All
Printers
path = /var/tmp
browseable = No
printable = Yes
create mask = 0600
[print$]
comment = Printer
Drivers
path = /var/lib/samba/drivers
create
mask = 0664
directory mask = 0775
write list = root
[Testdirectory]
comment = Anonymous File Server Share
path = /srv/samba/Testdirectory
force user = nobody
guest ok = Yes
read only = No
# systemctl enable smb.service
# systemctl enable nmb.service
# systemctl start smb.service
# systemctl start nmb.service
Setup Secure Samba in Centos 7
# groupadd smbgrp
# usermod systalk -aG smbgrp
# smbpasswd -a systalk
# mkdir -p /srv/samba/secure
# chmod -R 0770 /srv/samba/secure
# chown -R root:smbgrp /srv/samba/secure
# chcon -t samba_share_t /srv/samba/secure
# vi /etc/samba/smb.conf
[Secure]
comment = Secure File Server Share
path = /srv/samba/secure
valid users = @smbgrp
guest ok = no
writable = yes
browsable = yes
# systemctl restart smb.service
# systemctl restart nmb.service
Procedure:
# yum install samba samba-client samba-common
# firewall-cmd --permanent --zone=public --add-service=samba
# firewall-cmd --reload
# mkdir -p /srv/samba/Testdirectory
# chmod -R 0775 /srv/samba/Testdirectory
# chown -R nobody:nobody /srv/samba/Testdirectory
# chcon -t samba_share_t /srv/samba/Testdirectory
# useradd authuser
# vi /etc/samba/smb.conf
[global]
workgroup = WORKGROUP
netbios name = centos
security = user
[Testdirectory]
comment = Test Directory
path = /srv/samba/Testdirectory
browsable =yes
writable = yes
guest ok = yes
read only = no
force user = nobody
# useradd authuser
# testparm
Load smb config files from /etc/samba/smb.conf
rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
Processing section "[homes]"
Processing section "[printers]"
Processing section "[print$]"
Processing section "[Anonymous]"
Loaded services file OK.
Server role: ROLE_STANDALONE
Press enter to see a dump of your service definitions
# Global parameters
[global]
netbios name = centos
printcap name = cups
security = USER
idmap config * : backend = tdb
cups options = raw
[homes]
comment = Home Directories
browseable = No
inherit acls = Yes
read only = No
valid users = %S %D%w%S
[printers]
comment = All
Printers
path = /var/tmp
browseable = No
printable = Yes
create mask = 0600
[print$]
comment = Printer
Drivers
path = /var/lib/samba/drivers
create
mask = 0664
directory mask = 0775
write list = root
[Testdirectory]
comment = Anonymous File Server Share
path = /srv/samba/Testdirectory
force user = nobody
guest ok = Yes
read only = No
# systemctl enable smb.service
# systemctl enable nmb.service
# systemctl start smb.service
# systemctl start nmb.service
Setup Secure Samba in Centos 7
# groupadd smbgrp
# usermod systalk -aG smbgrp
# smbpasswd -a systalk
# mkdir -p /srv/samba/secure
# chmod -R 0770 /srv/samba/secure
# chown -R root:smbgrp /srv/samba/secure
# chcon -t samba_share_t /srv/samba/secure
# vi /etc/samba/smb.conf
[Secure]
comment = Secure File Server Share
path = /srv/samba/secure
valid users = @smbgrp
guest ok = no
writable = yes
browsable = yes
# systemctl restart smb.service
# systemctl restart nmb.service
# yum install nfs-utils
# mkdir /data
# chmod -R 755 /data
# vi /etc/exports
# systemctl restart nfs-server
# yum install nfs-utils
# mkdir /mnt/nfsshare
# mount -t nfs 10.10.10.1:/var/nfsshare /mnt/nfsshare
# df -kh
# touch /mnt/nfsshare/testfile
# vi /etc/fstab
# yum install nfs-utils
# mkdir /data
# chmod -R 755 /data
# vi /etc/exports
# systemctl restart nfs-server
# yum install nfs-utils
# mkdir /mnt/nfsshare
# mount -t nfs 10.10.10.1:/var/nfsshare /mnt/nfsshare
# df -kh
# touch /mnt/nfsshare/testfile
# vi /etc/fstab
Procedure:
# adduser testuser1
# passwd testuser1
# visudo
## find the following content
root ALL=(ALL) ALL
## Add following content
testuser1 ALL=(ALL) ALL
$ sudo su
password prompt for testuser1 now testuser1 can run all commands as a root.