Chapter 4_4pptx
Chapter 4_4pptx
TCP/IP
TCP/IP stands for Transmission Control Protocol/Internet Protocol and is a suite of
communication protocols used to interconnect network devices on the internet.
TCP/IP is also used as a communications protocol in a private computer network (an
intranet or extranet).
TCP/IP specifies how data is exchanged over the internet by providing end-to-end
communications that identify how it should be broken into packets, addressed,
transmitted, routed and received at the destination. TCP/IP requires little central
management and is designed to make networks reliable with the ability to recover
automatically from the failure of any device on the network.
The two main protocols in the IP suite serve specific functions. TCP defines how
applications can create channels of communication across a network. It also manages
how a message is assembled into smaller packets before they are then transmitted
over the internet and reassembled in the right order at the destination address.
Common TCP/IP Protocols include the following:
• Hypertext Transfer Protocol (HTTP) handles the communication between a
Linux easily manages multiple network interface adapters. Laptops typically include both
wired and wireless interfaces, and may also support WiMax interfaces for cellular
networks. Linux desktop computers also support multiple network interfaces, and you
can use your Linux computer as a multi-network client, or as a router for internal
networks; such is the case with a couple of my own systems.
⚫ After a short stint with some long and unintelligible network interface names, we now
have a third set of naming conventions which seem only marginally better. Names
like ethX are still used by CentOS 6.x.
⚫ The newest naming conventions, with names like eno1 and enp0s3 are used by RHEL 7,
CentOS 7, and more recent releases of Fedora.
domain and network gateway, specifies two DNS servers, and does not allow
non-root users to start and stop the interface.
domain, and all other network information are not defined because they are
supplied by the DHCP server. Configuration items like the DNS servers can be
overridden in the interface configuration file by adding DNS1 and DNS2 lines.
⚫ In both interface configuration files, the HWADDR line specifies the MAC address
of the physical network interface. This binds the physical interface to the interface
configuration file. You must change the MAC address in the file if you replace the
interface.
⚫ There are a couple ways to locate the MAC address of a NIC. I usually use the
ifconfig command which shows all installed NICs, thier MAC address and various
statistics. Many new NICs have their MAC address printed on the box or labelled
on the NIC itself.
However, most interface configuration files are generated automatically during
installation or when the NIC is first detected after being newly installed, and the
MAC address is included as part of the new interface configuration file.
The ONBOOT line specifies that the interface is to be activated at startup time. If
this line is changed to "no" the interface will have to be activated either manually,
or by NetworkManager after a user logs in.
The USERCTL line specifies that non-privileged users cannot manage the
interface; that is they cannot turn it on and off. Setting this parameter to "yes"
allows regular users to activate and deactivate the interface.
Notice that the lines in the interface configuration files are not sequence-sensitive,
and work just fine in any order. By convention, the option names are in uppercase
and the values are in lowercase. Option values can be enclosed in quotes, but that
is not necessary unless the value is more than a single word or number.
Configuration Options
There are many configuration options for the interface configuration files. These are some of the
more common options:
• DEVICE: The logical name of the device, such as eth0 or enp0s2.
• HWADDR: The MAC address of the NIC that is bound to the file, such as 00:16:76:02:BA:DB
•ONBOOT: Start the network on this device when the host boots. Options are yes/no. This is
typically set to "no" and the network does not start until a user logs in to the desktop. If you need
the network to start when no one is logged in, set this to "yes".
⚫
. Configuring it is also a complex task.
Not every network, especially the small and home office network, can
afford it.
Linux provides a zero-cost solution for the IP forwarding. If you have a
Linux system in your network, you can use it for the IP forwarding. The
below section explains this process step by step with a practical
example.
For demonstration purpose, I will use three systems named as; Linux
(RHEL 7.2), PC-A (Windows 7), and PC-B (Ubuntu 18.4). I will use the
Linux system as the router and will use the remaining two systems (PC-
A and PC-B) to simulate the two different networks.
⚫ The following image shows the IP configuration of the PC-A (Windows 7).
The following image shows the IP configuration of the PC-B (Ubuntu 18.04).
Since the process of setting IP address varies in each OS and you
can use any OS to simulate the different networks, it's not feasible
for me to provide step by step instructions for each OS. However, if
you are using the Linux system for testing, you can follow the same
steps which I will use to configure the IP address on my Linux
system.
Select available Ethernet (network interface) from the left pane and the Edit option from
the right pane and hit the Enter key.
Set IP configuration as explained in the following image.
⚫ When adding IPs, in step2, make sure you add IP with the subnet-
mask in slash notation. Slash notation is the other way to write the
subnet mask along with the IP address.
gateway, but they can't access the system of another network. To verify
connectivity between systems and gateway, you can use the ping command.
⚫ The following image shows connectivity between PC-A and the default
gateway.
The following image shows connectivity between PC-B and the default gateway.
Enabling IP forwarding on Linux
⚫ Run the following command to enable the IP forwarding.
⚫ This command enables IP forwarding in the current session. It does not make a change
in that configuration file which Linux reads at the startup. By default, the state of IP
forwarding is disabled in the configuration file. It means Linux will automatically
disable the IP forwarding again when you will restart the system.
⚫ To enable IP forwarding permanently, run the following command.
⚫ Once the IP forwarding is enabled, Linux works as the router. It forwards all
incoming data packets to their correct destination.
⚫ To verify this, test connectivity between the PCs of different networks.
⚫ The following image confirms connectivity between PC-A and PC-B from the
Windows (PC-A) system.
The following image verifies connectivity between PC-B and PC-A from the
Ubuntu (PC-B) system.
How to configure an Apache web server
Installation and configuration of the Apache web server must be performed as
root.
Configuring the firewall also needs to be performed as root.
Using a browser to view the results of this work should be done as a non-root
user. (I use the user student on my virtual host.)
Installation
The Apache web server is easy to install. With one command, you can install it
and all necessary dependencies:
$ dnf install httpd
All the configuration files for Apache are located
in /etc/httpd/conf and /etc/httpd/conf.d.
The data for websites you'll run with Apache is located in /var/www by default,
but you can change that if you want.
The primary Apache configuration file is /etc/httpd/conf/httpd.conf. It contains
a lot of configuration statements that don't need to be changed for a basic
installation. In fact, only a few changes must be made to this file to get a basic
website up and running. The file is very large so, rather than clutter this article
with a lot of unnecessary stuff, I will show only those directives that you need
to change.
First, take a bit of time and browse through the httpd.conf file to familiarize
yourself with it. One of the things I like about Red Hat versions of most
configuration files is the number of comments that describe the various sections
and configuration directives in the files. The httpd.conf file is no exception, as
it is quite well commented. Use these comments to understand what the file is
configuring.
The first item to change is the Listen statement, which defines the IP address
and port on which Apache is to listen for page requests. Right now, you just
need to make this website available to the local machine, so use
the localhost address. The line should look like this when you finish:
Listen 127.0.0.1:80
With this directive set to the IP address of the localhost, Apache will listen
only for connections from the local host. If you want the web server to listen
for connections from remote hosts, you would use the host's external IP
address.
The DocumentRoot directive specifies the location of the HTML files that
make up the pages of the website. That line does not need to be changed
because it already points to the standard location. The line should look like
this:
DocumentRoot "/var/www/html“
The Apache installation RPM creates the /var/www directory tree. If you
wanted to change the location where the website files are stored, this
configuration item is used to do that. For example, you might want to use a
different name for the www subdirectory to make the identification of the
website more explicit. That might look like this:
DocumentRoot "/var/mywebsite/html“
These are the only Apache configuration changes needed to create a simple
website. For this little exercise, only one change was made to
the httpd.conf file—the Listen directive. Everything else is already
configured to produce a working web server.
One other change is needed, however: opening port 80 in our firewall. I
use iptables as my firewall, so I change /etc/sysconfig/iptables to add a
statement that allows HTTP protocol. The entire file looks like this:
The line I added is the third from the bottom, which allows incoming traffic on port 80.
Now I reload the altered iptables configuration.
[root@testvm1 ~]# cd /etc/sysconfig/ ; iptables-restore iptables
Create the index.html file
The index.html file is the default file a web server will serve up when you
access the website using just the domain name and not a specific HTML
file name.
In the /var/www/html directory, create a file with the name index.html.
Add the content Hello World. You do not need to add any HTML markup
to make this work.
The sole job of the web server is to serve up a stream of text data, and the
server has no idea what the date is or how to render it. It simply transmits
the data stream to the requesting host.
Here it will ask you to enter the type of the mail configuration which we want to
configure on our server. In this demo, we are going to choose “internet site” which
suits the environment.
Configuring Postfix
Now, we needed to change some basic settings in the Postifx main configuration.
file.
As we discussed in above the ‘mydestination’ parameters has been modified with the
FQDN which we entered during the installation process. This holds any domains that the
installation of Postfix is responsible.
We need to specify the ‘mynetworks’ parameter, which defines the computers which are
able to use this mail server. In general, we set to local only(127.0.0.0/8), We can modify
this by allowing the other hosts to use and send but this may be a vulnerability.
Testing the Postfix Configuration
We can test the server that can receive and route the emails. We can test this by
sending email to one of the email address which we mentioned in the virtual
accounts.
We will get mail delivered to a file that matches the username in the /var/mail folder.
By default the mail program is not installed on the Ubuntu we can install this using
the below command.
⚫ Squid is a full-featured web proxy cache server application which provides proxy and cache
services for Hyper Text Transport Protocol (HTTP), File Transfer Protocol (FTP), and other
popular network protocols. Squid can implement caching and proxying of Secure Sockets Layer
(SSL) requests and caching of Domain Name Server (DNS) lookups, and perform transparent
caching. Squid also supports a wide variety of caching protocols, such as Internet Cache
Protocol (ICP), the Hyper Text Caching Protocol (HTCP), the Cache Array Routing Protocol
⚫ The Squid proxy cache server is an excellent solution to a variety of proxy and caching server
needs, and scales from the branch office to enterprise level networks while providing extensive,
granular access control mechanisms, and monitoring of critical parameters via the Simple
Network Management Protocol (SNMP). When selecting a computer system for use as a
dedicated Squid caching proxy server for many users ensure it is configured with a large
amount of physical memory as Squid maintains an in-memory cache for increased performance.
Installation
At a terminal prompt, enter the following command to install the Squid server:
sudo apt install squid
Configuration
Squid is configured by editing the directives contained within
the /etc/squid/squid.conf configuration file.
• rock: is a database-style storage. All cached entries are stored in a “database” file, using fixed-size
slots. A single entry occupies one or more slots.
If you want to use a different directory type please take a look at their different options.
Using Squid’s access control, you may configure use of Internet services proxied by Squid to be
available only users with certain Internet Protocol (IP) addresses. For example, we will illustrate
access by users of the 192.168.42.0/24 subnetwork only:
Add the following to the bottom of the ACL section of your /etc/squid/squid.conf file: acl
fortytwo_network src 192.168.42.0/24
Then, add the following to the top of the http_access section of your /etc/squid/squid.conf file:
http_access allow fortytwo_network
Using the excellent access control features of Squid, you may configure use of
Internet services proxied by Squid to be available only during normal business
hours. For example, we’ll illustrate access by employees of a business which is
operating between 9:00AM and 5:00PM, Monday through Friday, and which uses
the 10.1.42.0/24 subnetwork:
Add the following to the bottom of the ACL section of
your /etc/squid/squid.conf file: acl biz_network src 10.1.42.0/24 acl biz_hours time
M T W T F 9:00-17:00
Then, add the following to the top of the http_access section of
your /etc/squid/squid.conf file: http_access allow biz_network biz_hours
Note: After making changes to the /etc/squid/squid.conf file, save the file and
restart the squid server application to effect the changes using the following
command entered at a terminal prompt:
sudo systemctl restart squid.service
Network Configuration and Information
Network Configuration Files
The graphical helper tools edit a specific set of network configuration files, using a
couple of basic commands. The exact names of the configuration files and their
location in the file system is largely dependent on your Linux distribution and version.
However, a couple of network configuration files are common on all UNIX systems:
/etc/hosts
The /etc/hosts file always contains the localhost IP address, 127.0.0.1, which is
used for interprocess communication. Never remove this line! Sometimes
contains addresses of additional hosts, which can be contacted without using an
Other possible name services to contact are LDAP, NIS and NIS+.
Network Configuration Commands
The ip command
The distribution-specific scripts and graphical tools are front-ends
to ip (or ifconfig and route on older systems) to display and configure the kernel's
networking configuration.
The ip command is used for assigning IP addresses to interfaces, for setting up routes to
the Internet and to other networks, for displaying TCP/IP configurations etcetera.
The following commands show IP address and routing information:
Things to note:
Two network interfaces, even on a system that has only one network interface
card: "lo" is the local loop, used for internal network communication; "eth0" is
a common name for a real interface. Do not ever change the local loop
configuration, or your machine will start mallfunctioning! Wireless interfaces
are usually defined as "wlan0"; modem interfaces as "ppp0", but there might
be other names as well.
IP addresses, marked with "inet": the local loop always has 127.0.0.1, the
physical interface can have any other combination.
The hardware address of your interface, which might be required as part of the
authentication procedure to connect to a network, is marked with "ether". The
local loop has 6 pairs of all zeros, the physical loop has 6 pairs of hexadecimal
characters, of which the first 3 pairs are vendor-specific.
The ifconfig Command
While ip is the most novel way to configure a Linux system, ifconfig is still very
popular. Use it without option for displaying network interface information:
Here, too, we note the most important aspects of the interface configuration:
•The IP address is marked with "inet addr".
•The hardware address follows the "HWaddr" tag.
Both ifconfig and ip display more detailed configuration information and a number of statistics about
each interface and, maybe most important, whether it is "UP" and "RUNNING".
PCMCIA Commands
On your laptop which you usually connect to the company network using the
onboard Ethernet connection, but which you are now to configure for dial-in at
home or in a hotel, you might need to activate the PCMCIA card. This is done
using the cardctl control utility, or the pccardctl on newer distributions.
A usage example:
cardctl insert
Now the card can be configured, either using the graphical or the command line
interface. Prior to taking the card out, use this command:
cardctl eject
However, a good distribution should provide PCMCIA support in the network
configuration tools, preventing users from having to execute PCMCIA commands
manually.
Network Interface Names
On a Linux machine, the device name lo or the local loop is linked with the internal 127.0.0.1
address. The computer will have a hard time making your applications work if this device is not
present; it is always there, even on computers which are not networked.
The first ethernet device, eth0 in the case of a standard network interface card, points to your
local LAN IP address. Normal client machines only have one network interface card. Routers,
connecting networks together, have one network device for each network they serve.
If you use a modem to connect to the Internet, your network device will probably be
named ppp0.
There are many more names, for instance for Virtual Private Network interfaces (VPNs), and
multiple interfaces can be active simultaneously, so that the output of
the ifconfig or ip commands might become quite extensive when no options are used. Even
multiple interfaces of the same type can be active. In that case, they are numbered sequentially:
the first will get the number 0, the second will get a suffix of 1, the third will get 2, and so on.
This is the case on many application servers, on machines which have a failover configuration,
on routers, firewalls and many more.
Checking the host configuration with netstat
Apart from the ip command for displaying the network configuration, there's the
common netstat command which has a lot of options and is generally useful on
any UNIX system.
Routing information can be displayed with the -nr option to the netstat command:
This is a typical client machine in an IP network. It only has one network
device, eth0. The lo interface is the local loop.
When this machine tries to contact a host that is on another network than its
own, indicated by the line starting with 0.0.0.0, it will send the connection
requests to the machine (router) with IP address 192.168.42.1, and it will use its
primary interface, eth0, to do this.
Hosts that are on the same network, the line starting with 192.168.42.0, will
also be contacted through the primary network interface, but no router is
necessary, the data are just put on the network.
Machines can have much more complicated routing tables than this one, with
lots of different "Destination-Gateway" pairs to connect to different networks.
If you have the occasion to connect to an application server, for instance at
work, it is most educating to check the routing information.
Other Hosts
An impressive amount of tools is focused on network management and remote
administration of Linux machines. Your local Linux software mirror will offer plenty of
those. It would lead us too far to discuss them in this document, so please refer to the
program-specific documentation.
We will only discuss some common UNIX/Linux text tools in this section.
• Offer (Message from DHCP server to DHCP client): Each DHCP server on
the network that receives the request responds with a DHCP offer message. An
offered IP address is included in the message.
•Request (Message from DHCP client to DHCP Server): When a DHCP client
receives a DHCPOffer packet, it responds by broadcasting a DHCPRequest
packet that contains the offered IP address, and shows acceptance of the offered
IP address. If multiple DHCP servers respond, the client selects the first offer it
receives and broadcasts a DHCP request for the IP address. The message is
broadcast on the network because the client has not yet been assigned an IP
address; it has only been offered one.
/var/lib/dhcpd/dhcpd.leases.
Dynamic Host Configuration Protocol (DHCP) Client
Configuration
The command used to set up a DHCP client is the "dhclient" command, or
"system-config-network" GUI tool. Make sure that the /etc/sysconfig/network
configuration file includes the following line:
NETWORKING=yes
Next, make sure that the /etc/sysconfig/network-scripts/ifcfg-eth0 script
contains the following lines (if you're using a different network device, modify
the appropriate file in /etc/sysconfig/network-scripts directory):
BOOTPROTO='dhcp’ ONBOOT='yes'
The next time when the client is rebooted, it will get the IP address information
automatically from the DHCP server configured in the network.
RPC-Based Services and INET Super Server
The inetd Super Server
Programs that provide application services via the network are called network daemons.
A daemon is a program that opens a port, most commonly a well-known service port, and
waits for incoming connections on it. If one occurs, the daemon creates a child process
that accepts the connection, while the parent continues to listen for further requests. This
mechanism works well, but has a few disadvantages; at least one instance of every
possible service you wish to provide must be active in memory at all times. In addition,
the software routines that do the listening and port handling must be replicated in every
network daemon.
To overcome these inefficiencies, most Unix installations run a special network daemon,
what you might consider a "super server." This daemon creates sockets on behalf of a
number of services and listens on all of them simultaneously. When an incoming
connection is received on any of these sockets, the super server accepts the connection
and spawns the server specified for this port, passing the socket across to the child to
manage. The server then returns to listening.
The most common super server is called inetd, the Internet Daemon. It is started at
system boot time and takes the list of services it is to manage from a startup file
named /etc/inetd.conf. In addition to those servers, there are a number of trivial services
performed by inetd itself called internal services. They include chargen, which simply
generates a string of characters, and daytime, which returns the system's idea of the time
of day.
A Sample /etc/inetd.conf File
The tftp daemon is shown commented out as well. tftp implements the Trivial File
Transfer Protocol (TFTP), which allows someone to transfer any world-readable
files from your system without password checking. This is especially harmful with
the /etc/passwd file, and even more so when you don't use shadow passwords.
Since opening a computer to network access involves many security risks,
applications are designed to guard against several types of attacks. Some
security features, however, may be flawed (most drastically demonstrated
by the RTM Internet worm, which exploited a hole in a number of
programs, including old versions of the sendmail mail daemon), or do not
distinguish between secure hosts from which requests for a particular
service will be accepted and insecure hosts whose requests should be
rejected.
We've already briefly discussed the finger and tftp services. Network
Administrator would want to limit access to these services to "trusted hosts"
only, which is impossible with the usual setup, for which inetd provides this
service either to all clients or not at all.
The Services and Protocols Files
The port numbers on which certain "standard" services are offered are defined in
the Assigned Numbers RFC. To enable server and client programs to convert
service names to these numbers, at least part of the list is kept on each host; it is
stored in a file called /etc/services.An entry is made up like this:
The aliases field allows you to specify alternative names for the same service.
A Sample /etc/services File
A Sample /etc/protocols File
Remote Procedure Call (RPC)
The general mechanism for client-server applications is provided by the Remote
Procedure Call (RPC) package. RPC was developed by Sun Microsystems and is a
collection of tools and library functions. Important applications built on top of RPC
are NIS, the Network Information System and NFS, the Network File System.
An RPC server consists of a collection of procedures that a client can call by sending
an RPC request to the server along with the procedure parameters. The server will
invoke the indicated procedure on behalf of the client, handing back the return value,
if there is any. In order to be machine-independent, all data exchanged between client
and server is converted to the External Data Representation format (XDR) by the
sender, and converted back to the machine-local representation by the receiver. RPC
relies on standard UDP and TCP sockets to transport the XDR formatted data to the
remote host. Sun has graciously placed RPC in the public domain; it is described in a
series of RFCs.
Sometimes improvements to an RPC application introduce incompatible changes in
the procedure call interface. Of course, simply changing the server would crash all
applications that still expect the original behavior. Therefore, RPC programs have
version numbers assigned to them, usually starting with 1, and with each new version
of the RPC interface, this counter will be bumped up. Often, a server may offer
several versions simultaneously; clients then indicate by the version number in their
requests which implementation of the service they want to use.
A Sample /etc/rpc File
In TCP/IP networks, the authors of RPC faced the problem of mapping program
numbers to generic network services. They designed each server to provide both a
TCP and a UDP port for each program and each version. Generally, RPC
applications use UDP when sending data, and fall back to TCP only when the data
to be transferred doesn't fit into a single UDP datagram.
Of course, client programs need to find out to which port a program number maps.
Using a configuration file for this would be too unflexible; since RPC applications
don't use reserved ports, there's no guarantee that a port originally meant to be
used by our database application hasn't been taken by some other process.
Therefore, RPC applications pick any port they can get and register it with a
special program called the portmapper daemon. The portmapper acts as a service
broker for all RPC servers running on its machine. A client that wishes to contact a
service with a given program number first queries the portmapper on the server's
host, which returns the TCP and UDP port numbers the service can be reached at.
This method introduces a single point of failure, much like the inetd daemon does
for the standard Berkeley services. However, this case is even a little worse
because when the portmapper dies, all RPC port information is lost; this usually
means you have to restart all RPC servers manually or reboot the entire machine.
On Linux, the portmapper is called /sbin/portmap, or
sometimes /usr/sbin/rpc.portmap. Other than making sure it is started from your
network boot scripts, the portmapper doesn't require any configuration.
The ssh package provides replacements called slogin, ssh, and scp.
Each of these commands spawns a shell on the remote host and allows the
user to execute commands. Of course, the client needs to have an account on
the remote host where the command is to be executed. Thus, all these
commands use an authentication process.
The r commands use a simple username and password exchange between the
hosts with no encryption, so anyone listening could easily intercept the
passwords. The ssh command suite provides a higher level of security: it uses
a technique called Public Key Cryptography, which provides authentication
and encryption between the hosts to ensure that neither passwords nor session
data are easily intercepted by other hosts.
It is possible to relax authentication checks for certain users even further. For
instance, if you frequently have to log into other machines on your LAN, you
might want to be admitted without having to type your password every time.
This was always possible with the r commands, but the ssh suite allows you to do
this a little more easily. It's still not a great idea because it means that if an
account on one machine is breached, access can be gained to all other accounts
that user has configured for password-less login, but it is very convenient and
people will use it. Let's talk about removing the r commands and getting ssh to
work instead.
# ssh-keygen -f /etc/ssh/ssh_host_key
You will be prompted to enter a passphrase. However, host keys must not
use a passphrase, so just press the return key to leave it blank. The
program output will look something like:
You will find at the end that two files have been created. The first is
called the private key, which must be kept secret and will be
in /etc/ssh/ssh_host_key. The second is called the public key and is one
that you can share; it will be in /etc/ssh/ssh_host_key.pub.
It's important to make sure the permissions of the configuration files are correct
to ensure that system security is maintained. Use the following commands:
The final stage of sshd administration daemon is to run it. Normally you'd create
an rc file for it or add it to an existing one, so that it is automatically executed at
boot time. The daemon runs standalone and doesn't require any entry in
the /etc/inetd.conf file. The daemon must be run as the root user.
The syntax is very simple: /usr/sbin/sshd The sshd daemon will automatically
place itself into the background when being run. You are now ready to
accept ssh connections.
The SSH Client
There are a number of ssh client programs: slogin, scp and ssh. They each read the same
configuration file, usually called /etc/ssh/ssh_config. They each also read configuration
files from the .ssh directory in the home directory of the user executing them. The most
important of these files is the .ssh/config file, which may contain options that override
those specified in the /etc/ssh/ssh_config file, the .ssh/identity file, which contains the
user's own private key, and the corresponding .ssh/identity.pub file, containing the user's
public key. Other important files are .ssh/known_hosts and .ssh/authorized_keys; we'll talk
about those later in "Using ssh". First, let's create the global configuration file and the user
key file. /etc/ssh/ssh_config is very similar to the server configuration file. The rest of the
configuration options are detailed in the sshd manpage.
You can add sections that match specific hosts or groups of hosts. The parameter to the
"Host" statement may be either the full name of a host or a wildcard specification, as we've
used in our example, to match all hosts. We could create an entry that used, for
example, Host *.vbrew.com to match any host in the vbrew.com domain.
Example SSH Client Configuration File
You should ask each of your users to run the ssh-keygen command just once to ensure their
key file is created correctly. The ssh-keygen will create their ~/.ssh/ directories for them
with appropriate permissions and create their private and public keys
in .ssh/identity and .ssh/identity.pub, respectively.A sample session should look like:
Now ssh is ready to run.
Using SSH
We should now have the ssh command and it's associated programs installed
and ready to run. Let's now take a quick look at how to run them. First, we'll try
a remote login to a host. We can use the slogin program in much the same way
as we used the rlogin program in our example earlier in the book. The first time
you attempt a connection to a host, the ssh client will retrieve the public key of
the host and ask you to confirm its identity by prompting you with a shortened
version of the public key called a fingerprint.
The administrator at the remote host should have supplied you in advance with
its public key fingerprint, which you should add to your .ssh/known_hosts file.
If the remote administrator has not supplied you the appropriate key, you can
connect to the remote host, but ssh will warn you that it does have a key and
prompt you whether you wish to accept the one offered by the remote host.
Assuming that you're sure no one is engaging in DNS spoofing and you
are in fact talking to the correct host, answer yes to the prompt.
The relevant key is then stored automatically in
your .ssh/known_hosts and you will not be prompted for it again. If, on
a future connection attempt, the public key retrieved from that host
does not match the one that is stored, you will be warned, because this
represents a potential security breach.
A first-time login to a remote host will look something like: