Unit - V LINUX Administration: Asmatullah Khan, CL/CP, Gioe, Secunderabad
Unit - V LINUX Administration: Asmatullah Khan, CL/CP, Gioe, Secunderabad
Unit - V LINUX Administration: Asmatullah Khan, CL/CP, Gioe, Secunderabad
LINUX Administration
Asmatullah Khan,
CL/CP, GIOE,
Secunderabad.
Contents
1. Discuss about Managing Users and Groups
2. Explain the process of Managing Printers and print job.
3. Explain Browsers in Linux
4. Explain about PPP and TCP/IP with Linux
5. Analyze the process of Configuring DHCP in LINUX
6. Describe Configuring DNS in LINUX.
7. Discuss Network Services, Proxies, Configuring
Firewall.
8. Configuring internet access, sending mail
9. Configuring web server.
10. Describe Linux Security
11. Explain the process of Backup of data in Linux
Discuss about Managing Users and Groups
# groups user1
# id user1
Disabling account by locking password
Use the -L (uppercase L) or the –lock option to lock a user’s password.
Deleting a group
You can delete a group with the following command.
# groupdel [group_name]
Good news is that the CUPS has most of the common printer drivers installed.
You just need to choose the printer from the dropdown menu.
Managing Printers and print job.
configuration files
As any other linux program, CUPS saves its configuration at /etc
directory.
# ls /etc/cups
cups-browsed.conf interfaces raw.types
subscriptions.conf cupsd.conf ppd snmp.conf
subscriptions.conf.O cups-files.conf raw.convs ssl
Personal Preference
You may prefer the text only reading experience offered through the terminal without the fancy
images, videos, and web styling most Internet users love. Despite what online marketing
professionals may declare, every person has their own preferences when it comes to the user
experience.
How does it interpret the Header and Title tags, the main navigation, view the text, image, or video content?
Text-Based Browsers in Linux - Lynx
Lynx was developed in 1992 at the University of Kansas.
It is the oldest web browser still in development.
This makes it a valid option for older hardware unable to support newer graphical
browsers.
Here are the a few benefits of Lynx:
Supports Gopher, HTTP, HTTPS, FTP, NNTP, and WAIS protocols
Support SSL and HTML features
Eliminates privacy concerns since it does not support graphics and associated web bugs
connected to track user info
Ability to disable cookie support
Keeps browser history and page caching
Compatible with numerous operating systems, including UNIX, Linux, Windows, and MacOS
Despite Lynx’s age and perseverance in a GUI crazed world, the browser boasts a
number of critics.
This criticism stems from its inability to support HTTP cookies, JavaScript, CSS styling, and
Adobe Flash.
Text-Based Browsers in Linux - Links
Links is another option that is compatible with Linux, FreeBSD, Mac OS X, Windows,
DOS, and Linux.
Twibright Labs in the Czech Republic developed Links in 1999.
Contrary to the lack of graphics support in Lynx, Links offers limited support for
JavaScript, horizontal scrolling, and graphics.
Supporters of Links developed forks called
Hacked Links and
ELinks.
Text-Based Browsers in Linux - ELinks
ELinks is originally referred to as “Experimental”, but now it is called “Extended” or
“Enhanced”.
Petr Baudis developed a “patch-set on top of the orginal Links, known…as the -pb
patches” that traces back to the start of ELinks development.
According to the official ELinks web page, the web browser forked from the “original
Links browser written by Mikulas Patocka” and is not “associated with Twibright Labs and
their Links version”.
The browser is compatible with Linux, Mac OS X, OpenBSD, Solaris, NetBSD, CygWin,
FreeBSD, GNU Hurd, and other operating systems.
ELinks supports:
Tabbed browsing
Background downloads and queuing
HTTP and Proxy authentication
Various protocols for finger, HTTP, HTTPS, FTP, SMB, IPv4, IPv6, local files
Experimental support for Gopher, NNTP, and BitTorrent
Browser scripting for Perl, Ruby, Lua, and GNU Guile
Text editing, mouse work, and colored text
JavaScript
HTTP cookies
Text-Based Browsers in Linux - W3M
W3m early development and initial release occurred in 1995.
This browser is compatible with Linux, Windows (with Cygwin), and other operating
systems.
W3m supports
SSL,
colors,
inline images on specific terminal emulators,
certain CGI scripts, and
works within the Emacs text editor.
The Emacs interface (emacs-w3m package) is an advantage for those users who find
it convenient to browser directly in their text editor.
W3m’s main benefits are speed and a smaller package size to download and install.
Explain about PPP and TCP/IP with
Linux
Point – to – Point Protocol (PPP)
Point-to-point protocol (PPP) is a computer network protocol used to transfer a
datagram between two directly connected (point-to-point) computers.
It is the most common protocol for Point-to-Point access.
This protocol is used for a very basic level of connectivity providing data linkage
between the computers. Point-to-point protocol is widely used for the heavier and
faster connections necessary for broadband communications.
Point-to-point protocol is also known as RFC 1661.
Services provided by PPP:
Defines format of frames.
Defines link establishment process.
Defines Data exchange process.
Defines How network layer data are encapsulated in Data Link Layer.
Defines Authentication process between two devices.
Services not provided by PPP:
Flow control.
Very simple mechanism for Error Control.
No addressing mechanism to handle frames in multipoint configuration.
Point – to – Point Protocol (PPP)
Frame format of PPP: Flag Address Control Protocol Pay Load FCS Flag
Flag: Indicates start and end of frame.
Just like HDLC but HDLC flag is bit-oriented and PPP flag field is Byte-oriented.
Protocol: defines what is carried in data field – either user data or other info. (Info
about data).
Payload field: carry either user data or other data. (Actual Data).
FCS: Frame Check Sum.
Point – to – Point Protocol (PPP)
Transition Phases of PPP:
Failed
Dead Phase:
Link is not used.
Dead Establish
Carrier Detected
Establish Phase:
When one of the node starts communication. Both sides
Carrier is detected. Carrier Agree
Authenticate Phase: Dropped
Optional phase for authenticating connection
oriented communication. Failed
Terminate Authenticate
Network Phase:
In this phase negotiation for network layer
protocols happen.
Done Authentication
Open Phase: Successful
Actual Data transfer takes place. Exchange of
data packets.
option domain-name-servers :
Mention DNS Servers eg: 192.168.0.100, 192.168.0.101 (Note : You can also mention the FQDN)
default-lease-time :
The Default time in Seconds till the time DHCP Server will assign a IP to Client Computer. DHCP Server Details :
max-lease-time :
Server Name : dhcpserver
IP Address : 192.168.0.100
The Maximum time in Seconds till the time DHCP Server will assign a IP to Client Computer.
MAC Address :
subnet :
DHCP Client Details :
Mention the Subnet IP Address eg : 192.168.0.0
Hostname : Client1
netmask : MAC Address :
Mention the Subnet Mask eg : 255.255.255.0
range :
Mention the IP Range which will dynamically assigned by Linux DHCP Server to Client Computers. eg :192.168.0.2 to
192.168.0.240
option routers :
Mention the Gateway IP Address eg : 192.168.0.1
option broadcast-address :
Mention your Broadcast Address eg : 192.168.0.255
hardware ethernet :
Mention your MAC Accress OR Physical Address eg : 00:0C:29:F7:BE:27
option host-name :
Your systems Hostname OR Computer Name eg : dhcpserver
Configuring DHCP in LINUX
STEP BY STEP LINUX DHCP SERVER CONFIGURATION IN REDHAT/CENTOS/FEDORA
Where :
Range is for allowed IP Address Range i.e. 192.168.0.5 to 192.168.0.240. DHCP Server
will assign IP Address to client computers within these range. And Other settings are
common like Domain Name, Router Address i.e. Gateway Address, DNS Servers and so on.
After all required changes in dhcpd.conf configuration file start the Linux dhcp
server service using below command.
Configure DHCP Service to start at system startup.
Configuring DHCP in LINUX
STEP BY STEP LINUX DHCP SERVER CONFIGURATION IN REDHAT/CENTOS/FEDORA
Step : 5 DHCP Client Side Configuration
Configure the Ethernet connection from client side to get IP from DHCP Server. To do so
just edit the ifcfg-ethX file and set BOOTPROTO=dhcp (Highlighted in Red color). Refer
the sample output below.
Note : Replace X with your Ethernet Connection Number
Once you restart the Network Service system will get the IP Address from Linux DHCP
Server. To confirm the same we can use ifconfig command to check the IP Address. Refer
the command below. [root@client1
eth1
~]# ifconfig eth1
Link encap:Ethernet HWaddr 00:0C:29:F7:BE:27
inet addr:192.168.0.5 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fef7:be27/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:39 errors:0 dropped:0 overruns:0 frame:0
TX packets:121 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:5184 (5.0 KiB) TX bytes:7917 (7.7 KiB)
Once client get IP Address from DHCP Server you can see all the client information like
The assigned IP Address, MAC Address, Client Computer Name
in /var/lib/dhcpd.leases Server. Note : IP Address lease Informations are stored
in /var/lib/dhcpd.leases file. By Default it comes with DHCP Server Package Installation
but if it is not there then you have to create it manually otherwise you will unable to
start the DHCP Service. [root@dhcpserver ~]# cat /var/lib/dhcpd/dhcpd.leases # Checking the dhcpd.leases file
# The format of this file is documented in the dhcpd.leases(5) manual page.
# This lease file was written by isc-dhcp-4.1.1-P1
vi /etc/named.conf
Step 7: Test DNS configuration and zone files for any syntax errors
Check DNS default configuration file: named-checkconf /etc/named.conf
Sample output:
Sample output:
zone unixmen.local/IN: loaded serial 2011071001
OK
Configuring DNS in LINUX - Setup Primary (Master) DNS Server
Step 7: Test DNS configuration and zone files for any syntax errors cont…
Add the DNS Server details in your network interface config file. vi /etc/sysconfig/network-scripts/ifcfg-enp0s3
vi /etc/named.conf
Now the forward and reverse zones are automatically replicated from Master DNS server
to ‘/var/named/slaves/’ in Secondary DNS server.
ls /var/named/slaves/
Sample Output:
Server: 192.168.1.102
Address: 192.168.1.102#53
Name: unixmen.local
Address: 192.168.1.101
Name: unixmen.local
Address: 192.168.1.103
Name: unixmen.local
Address: 192.168.1.102
# Generated by
NetworkManager search
unixmen.local
nameserver
192.168.1.101
nameserver
192.168.1.102
dig masterdns.unixmen.local
dig secondarydns.unixmen.local
dig client.unixmen.local
nslookup unixmen.local
That’s all about the primary and secondary DNS servers and are ready to use.
Discuss Network Services, Proxies,
Configuring Firewall
Linux Network Services
Networking services are commonly used in enterprise Linux
networks communications.
Most commonly used Network services are as follows:
ntpd – Network Time Protocol Daemon
httpd – Hyper Text Transfer Protocol Daemon
sshd – Secure SHell Daemon
sendmail – Mail Server Daemon
snmpd – Simple Network Management Protocol Daemon
iptables – Network Filtering Protocol Service
nfsd – Network File System Server Daemon
nscd – Name Service Cache Daemon
named – Dynamic Naming Service Server Daemon
smbd – Simple Message Block Server Daemon
Linux Network Services - ntpd
This service executes the Network Time Protocol (NTP) daemon ntpd.
The purpose is to synchronize the time of the local computer to a NTP server or
other reference time source such as a radio or satellite receiver or modem.
The NTP system uses two main roles for participating computers:
server or client
Time servers supply time to one or more NTP clients.
NTP clients use the reference time from one or more NTP servers to determine the
local time.
Service management :
# /sbin/service ntpd
usage:
/etc/init.d/ntpd {start|stop|restart|condrestart|status}
Configuration File :
/etc/ntp.conf
Linux Network Services - HTTP
httpd is the Apache Hyper Text Transfer Protocol (HTTP) server program.
It is designed to be run as a standalone daemon process. When used like this
it will create a pool of child processes or threads to handle requests.
In general, httpd should not be invoked directly, but rather should be
invoked via apachectl on Unix-based systems.
The httpd RPM package provides the /usr/sbin/httpd daemon and its
configuration files.
Service Management:
/sbin/service httpd show
Usage:
httpd
{start|stop|restart|condrestart|reload|status|fullstatus|graceful|help|con
figtest}
Configuration file:
/etc/httpd/conf/httpd.conf
Linux Network Services - sshd
The sshd (Secure Shell Daemon) service is part of the OpenSSH implementation for Linux that provides
authenticated, end-to-end encrypted networked communication.
For example, a user on one host can log in to another system without using a password because the
sshd service can be configured to use alternate authentication techniques such as exchanging shared-
key information.
The openssh-server RPM package provides the /usr/sbin/sshd daemon and its configuration files
Two versions of the SSH communication protocol exist, version 1 and version 2. Connections between
the client and the sshd daemon are made on TCP/IP port 22 by default, using either UDP or TCP
protocols.
Service Management: To manage the sshd service on demand, use the service tool or run the
/etc/init.d/sshd script directly:
# /sbin/service sshd help
Usage:
/etc/init.d/sshd {start|stop|restart|reload|condrestart|status}
# /etc/init.d/sshd help
Usage:
/etc/init.d/sshd {start|stop|restart|reload|condrestart|status}
Service Management:
Usage:
/etc/init.d/sendmail {start|stop|restart|condrestart|status}
Configuration File:
/etc/mail/sendmail.cf
Linux Network Services - snmpd
The snmpd service is an SNMP(Simple Network Management Protocol) agent
which binds to a port and awaits requests from SNMP management software.
By using snmp, you can obtain the statistics of the server, which is described
by MIB file from remote host.
By default, snmpd listens for incoming SNMP requests on UDP port 161 on all
IPv4 interfaces.
The snmpd service is provided by the net-snmp RPM package.
Service Management
# service iptables
Usage:
/etc/init.d/iptables {start|stop|restart|condrestart|status|panic|save}
Configuration File
/etc/sysconfig/iptables – iptables rules
/etc/sysconfig/iptables-config – iptables configuration
Linux Network Services - nsfd
The Network File System (NFS) is a server/client based networking protocol.
NFS daemons are composed by nfsd, rpc.mountd, rpc.rquotad, rpc.lockd
Daemon nfsd: nfsd handles client requests from remote systems. Multiple copies of
this daemon are usually run so that several requests can be handled simultaneously.
However, too many copies of nfsd can increase the demand for CPU time to the point
where a drop in performance results. For the best performance the number of copies
of nfsd should be set to four.
Daemon rpc.mountd: rpc.mountd handles mount requests from remote systems.
Daemon rpc.rquotad: It is a rpc server which returns quotas for a user of a local file
system which is NFS-mounted onto a remote machine.
Daemon rpc.lockd: rpc.lockd manages file locking on NFS client and server machines.
In order to run NFS service, the portmap daemon must run.
Service Management:
Usage:
nfs {start|stop|status|restart|reload|condrestart}
Configuration File:
/etc/exports
Linux Network Services - nscd
This is the Name Service Cache Daemon.
It takes care of group and password lookups for running programs and
then caches the lookup results for the next query for services that
can experience slowness in picking up changes such as NIS or LDAP. If
you’re running these services, you may want to run nscd.
This daemon can cache the data for name services, /etc/hosts, DNS,
NIS, NIS+ or so. This is only for local users on the machine, because
the cache is realized by wrapping the functions in glibc, remote user
can never use this cache. It takes a time to change the cache even
when the original DNS data is changed, therefore be careful to use
this daemon.
Service Management:
Usage:
/etc/init.d/nscd {start|stop|status|restart|reload|condrestart}
Configuration File:
/etc/nscd.conf
Linux Network Services - named
named actually executed DNS ( Dynamic naming Service) server daemon.
It converts host names to IP addresses and vice versa.
There are several different kinds of DNS servers, such as primary server,
slave server and cached server etc.
Its data is stored in the directory /var/named.
The data stored in the DNS is identified by domain names that are organized
as a tree according to organizational or administrative boundaries
Service Management
# /sbin/service named
Usage:
/etc/init.d/named {start|stop|status|restart|condrestart|reload|probe}
Configuration File
/etc/named.conf
Linux Network Services - smdb
The Samba software suite is a collection of programs that implements the
SMB protocol for UNIX systems.
This protocol is also known as the Common Internet File System (CIFS).
The NetBIOS protocol is implemented by the nmbd daemon.
The SMB server daemon smbd provides file sharing and printing services to
Windows clients. The server provides file space and printer services to
clients via the SMB/CIFS protocol.
The nmbd daemon is a NetBIOS name server that provides NetBIOS naming
services to clients . It understands and can reply to NetBIOS over IP name
service requests, like those produced by SMB/CIFS clients (windows).
Service Control
# /sbin/service smb
Usage:
/etc/init.d/smb {start|stop|restart|reload|status|condrestart}
Configuration File
/etc/samba/smb.conf
Linux Proxies
A proxy server has many use cases, it could range from personal
internet access to restrict organization systems/servers to
access the external world or to limit external internet access
for a set of servers on the cloud.
The best way to configure a proxy server is by using the Squid
proxy. It is a widely used proxy server.
Steps for Proxy Server
Install proxy server
Configure the proxy server
Configure basic proxy authentication.
Linux Proxies - Install Proxy Server - Squid Proxy
Step1: Update the server
sudo yum update –y
Step 2: Configure EPEL repo
sudo yum -y install epel-release
sudo yum -y update
sudo yum clean all
Step 3: Install squid
sudo yum -y install squid
Step 4: Start and enable squid server.
sudo systemctl start squid
sudo systemctl enable squid
Step 5: Check the status of squid server.
sudo systemctl status squid
Linux Proxies - Configure Proxy Server: Squid Proxy
All the configurations for the squid server are
present in /etc/squid/squid.conf file.
Configure proxy Sources To Access Internet
First, you need to configure the sources from which
squid proxy should accept connections.
For example, you might need to access this proxy server only
from your home network or from specific CIDR ranges.
Now, test the connectivity with proxy user and password we configured in step 3. An example syntax
is shown below.
curl -x http://35.196.101.43:3128 --proxy-user pxuser:12345 -I http://google.com
With username and password, your proxy request should go through.
Linux Proxies - Blocking Websites
Another great use of the proxy server is restricting the website access. Follow the steps below for creating a
block list.
Step 1: Open a blocked list file.
sudo vi /etc/squid/blocked_sites
Add the websites to be blocked in the file. For example,
facebook.com twitter.com instagram.com
Step 2: Open the squid config file.
sudo vi /etc/squid/squid.conf
Add the following to the ACL list.
acl blocked_sites dstdomain "/etc/squid/blocked_sites"
http_access deny blocked_sites
Step 3: Restart the squid server.
sudo systemctl restart squid
Now if you try to access the blocked site through the proxy, you will get a forbidden message as shown
below.
Linux Firewall
sudo iptables -A <chain> -i <interface> -p <protocol (tcp/udp) > -s <source> --dport <port no.> -j <target>
Once you understand the basic syntax, you can start configuring the firewall to give more security
to your server.
Linux Firewall - Install and Use iptables cont…
Enabling Traffic on Localhost
To allow traffic on localhost, type this command:
sudo iptables -A INPUT -i lo -j ACCEPT
The command above use lo or loopback interface, utilized for all communications on the localhost and will
make sure that the connections between a database and a web application on the same machine are working
properly.
You can also reject packets from a specific IP address by replacing the ACCEPT target with
DROP.
sudo iptables -A INPUT -s 192.168.1.3 -j DROP
If you want to drop packets from a range of IP addresses, you have to use the -m option and
iprange module. Then, specify the IP address range with –src-range.
Remember, a hyphen should separate the range of ip addresses without space, like this:
sudo iptables -A INPUT -m iprange --src-range 192.168.1.100-192.168.1.200 -j DROP
To delete a rule, insert the corresponding chain and the number from the list.
Let’s say, we want to get rid of rule number three of the INPUT chain.
The command should be:
sudo iptables -D INPUT 3
Linux Firewall - Install and Use iptables cont…
Step 3 – Persisting Changes
The iptables rules that we have created are saved in memory.
That means we have to redefine them on reboot. To make these changes persistent after
restarting the server, you can use this command:
sudo /sbin/iptables-save
It will save the current rules on the system configuration file, which will be used to reconfigure the tables
every time the server reboots.
Note that you should always run this command every time you make changes to the rules.
For example, if you want to disable iptables, you need to execute these two lines:
sudo iptables -F
sudo /sbin/iptables-save
mail_spool_directory = /var/spool/mail
mynetworks
This option allows you to configure what servers can relay through your Postfix server.
This option should take local addresses like local mail scripts on your server only.
Otherwise, spammers can utilize your mail server to relay their messages and your mail server
blacklisted and as a result, you will not be able to receive many emails.
mynetworks = 127.0.0.0/8, 192.168.1.0/24
Install, Secure, Access And Configure Linux Mail
Server (Postfix) - Configure Linux Mail Server cont…
smtpd_banner
This variable sets the message that is sent when the client after successful connection.
It is better to change the banner to something that doesn’t give an indication about the
server you are using.
inet_protocols
This option specifies the IP protocol version used for server connections.
inet_protocols = ipv4
If you change the configuration files for Postfix mail server, you need to reload the service:
$ systemctl reload postfix
When you type any configuration, you may make a mistake, you can check for errors using the
following command:
$ postfix check
This tool will help you find exactly the line and the error so you can fix it.
Install, Secure, Access And Configure Linux Mail
Server (Postfix) - Checking the Mail Queue
Sometimes the mail queues on your system are filled up.
This can be caused by many reasons like network failure or any reason that can delay
mail delivery.
To check the mail queue on your Linux mail server, use the following command:
$ mailq
This command shows the Postfix mail queue.
If your queue is filled up and the message takes several hours to be sent, then you
should flush the mail queue.
$ postfix flush
Now, if you check your mail queue you should find it empty.
Install, Secure, Access And Configure Linux Mail
Server (Postfix) - Checking the Mail Queue
Test Linux Mail Server
After configuring Postfix mail server correctly, you should test your mail server.
The first step is to use a local mail user agent like mailx or mail which is a symlink
to mailx.
Try to send a mail to someone else on the same server, if this works, then send to a
remote site.
$ echo "This is message body" | mailx -s "This is Subject" -r
"likegeeks<likegeeks@example.com>" -a /path/to/attachment someone@example.com
Then try to receive a mail from a remote site.
If you have any problems, check the logs. The log file on Red Hat based distros in
/var/log/maillog file and on Debian based distros in
/var/log/mail.log
If you still have problems, try checking your DNS settings and check your MX records
using Linux network commands.
Configuration of Web Server on
Linux
Install and Configure Apache Web Server on Ubuntu
Linux Web Server - Apache Web Server
Apache or Apache HTTP server is a free and open source web server, developed and
maintained by the Apache Software Foundation.
Its popularity can be judged by the fact that around 46% of the websites worldwide
are powered by Apache.
Apache allows website developers to serve their content over the web.
It serves by delivering files requested by users when they enter a domain name in
their browser’s address bar.
The commands and procedures that are going to be mentioned have been run on an
Ubuntu 18.04 LTS system.
Linux Web Server - Install Apache 2 on Ubuntu Linux
Then try the IPs, one by one from the output, in your web
browser as follows:
http://server_IP
In my case, http://192.168.100.4 and http://192.168.100.5.
Doing so will display the following Apache web page for
Ubuntu, verifying that the Apache server is working properly.
Linux Web Server - Set Up Virtual Hosts in Apache
A virtual host is similar to what you have server blocks
in Nginx.
It is used to manage configurations for more than one
domain from one server.
We will set up a website named sampledomain.com by
using the server block that is enabled by default in
Apache for Ubuntu 18.
Step 1: Set up a domain name
The server block that is enabled by default is capable of
serving documents from /var/www/html.
However, we will create a directory at /var/www/ leaving
the default directory intact.
Create this directory through the following command,
replacing sampledomain.com by your respective domain name.
sudo mkdir -p /var/www/sampledomain.com/html
If you do not get any errors, you will get the following output:
However, the following error is common in Ubuntu 18.04
Resolve the error:
Enter the following command in order to resolve the above-mentioned error:
$ echo "ServerName sampledomain.com | sudo tee /etc/apache2/conf-
available/servername.conf
And then:
$ sudo a2enconf servername
Now when you check again for errors, you will see this error resolved through the
following output:
Linux Web Server – Set Up Virtual Hosts in Apache cont…
Step 4: Test if Apache is serving your domain
name
Apache server is now configured to serve your domain name.
This
can be verified by entering your server name as follows in
any of the web browsers running on your system:
http://sampledomain.com
A recent update to the code allows for arbitrary specification of which system calls
are permitted for a process, and integration with audit logging. This ―mode 2
seccompwas developed for use as part of the Google Chrome OS.
Linux Security – Modules – Integrity Management
The kernel's integrity management subsystem may be used to maintain the integrity of
files on the system.
The Integrity Measurement Architecture (IMA) component performs runtime integrity
measurements of files using cryptographic hashes, comparing them with a list of valid
hashes.
The list itself may be verified via an aggregate hash stored in the TPM. Measurements
performed by IMA may be logged via the audit subsystem, and also used for remote
attestation, where an external system verifies their correctness.
IMA may also be used for local integrity enforcement via the Appraisal extension. Valid
measured hashes of files are stored as extended attributes with the files, and
subsequently checked on access. These extended attributes (as well as other security-
related extended attributes), are protected against offline attack by the Extended
Verification Module(EVM) component, ideally in conjunction with the TPM.
If a file has been modified, IMA may be configured via policy to deny access to the file.
The Digital Signature extension allows IMA to verify the authenticity of files in addition to
integrity by checking RSA-signed measurement hashes.
A simpler approach to integrity management is the dm-verity module.
This is a device mapper target which manages file integrity at the block level.
It's intended to be used as part of a verified boot process, where an appropriately authorized
caller brings a device online, say, a trusted partition containing kernel modules to be loaded
later. The integrity of those modules will be transparently verified block by block as they are
read from disk.
Linux Security – Modules – Hardening & Platform Security
Hardening techniques have been applied at various levels, including in the build
chain and in software, to help reduce the risk of system compromise.
Address Space Layout Randomization (ASLR) places various memory areas of a
userland executable in random locations, which helps prevent certain classes of
attacks. This was adapted from the external PaX/grsecurity projects, along with
several other software-based hardening features.
The Linux kernel also supports hardware security features where available, such as
NX, VT-d, the TPM, TXT, and SMAP, along with cryptographic processing as previously
mentioned.
Linux Backup
Explain the process of Backup of data in Linux
Linux backup strategy and backup media depends on your assessment of the risk of business disruption due to
hard disk failure.
For example, if you use your Linux system as a learning tool (to learn about Linux or programming), all you
may need are backup copies of some system files required to configure Linux. In this case, your backup
strategy can be to save important system- configuration files on one or more floppies every time you change
any system configuration.
On the other hand, if you use your Linux system as an office server that provides shared file storage for many
users, the risk of business disruption due to disk failure is much higher. In this case, you have to back up all
the files every week and back up any new or changed files every day. You should perform these backups in an
automated manner.
Your choice of backup media depends on the amount of data you have to back up.
For a small amount of data, such as system-configuration files, you can use floppy disks as the backup media.
If your PC has a Zip drive, you can use Zip disks as backup media; these are good for backing up a single-user directory.
To back up servers, you should use a tape drive, typically a 4-mm or 8-mm tape drive that connects to a SCSI controller.
Such tape drives can store several gigabytes of data per tape, and you can use them to back up an entire file system on a
single tape.
When backing up files to these backup media, you have to refer to the backup device by name.
SCSI Zip drive /dev/sda (assuming it's the first SCSI drive; otherwise, the device name depends on the SCSI ID)
SCSI tape drive /dev/st0 or /dev/nst0 (the n prefix means that the tape is not rewound after files are copied to the tape)
Explain the process of Backup of data in Linux
Unix and Linux backup and restore can be done using backup commands
tar,
Cpio,
ufsdump,
dump, and
restore.
Though these commands may be sufficient for small setups in order to take a enterprise
backup you have to go in for some custom backup and restore solutions like
Symatic netbackup,
EMC networker or
Amanda.
Any backup solution using these commands depends on the type of backup you are taking
as these backup commands offers different capabilities.
Explain the process of Backup of data in Linux - Backup Restore using tar command
$tar cvf /dev/rmt/0 * f Specifies the name of the archive file or device on the next field in the command line
Extracting tar backup from the tape Some useful tar options
Extract & keep the file permissions (default for
x option is used to extract the files from tar superuser)
file. -p, –preserve-permissions
$tar xvf /dev/rmt/0 ##extract / restore Filter the archive through gzip
files in to current directory. -z, –gzip
$tar xvf /home/backup ## extract / restore Filter the archive through bzip2
files in to current directory. -j, –bzip2
Note : Restoration will go to present directory
or original backup path depending on relative or Only append files newer than copy in archive
absolute path names used for backup. -u, –update
Sometimes tar file or tar ball becomes big Append files to the end of an archive
and it can compressed to copy or store with -r, –append
less space.
Delete from the archive (not on mag tapes!)
Compressing file/s –delete
compress -v file_name
Find differences between archive and file system
gzip filename
-d, –diff, –compare
To uncompress a file
Test the archive volume label and exit
uncompress file_name.Z –test-label
or
gunzip filename Change to directory DIR
-C, –directory=DIR
Explain the process of Backup of data in Linux - Backup Restore using cpio command