ALTE DOCUMENTE
|
||||||||||
Remote Administration of Linux Systems Introducing Remote Adnministration
Any system administrator who has to deal with two or more network servers will have to, at one point or another, solve the task of remote administration. Such an option can lead to better centralized control and supervising and help allocate (with preset limits) access for end-users.
Linux provides useful services for remote administration that even allow you to disconnect a monitor and keyboard from the server, leaving only a very secure system case, while keeping the full functionality and comfort as working with a local console.
In this article we will examine remote administration using the Red Hat Linux distribution. Path names and the format of configuration files in other distributions may vary.
The text console is the most useful and exploitable tool f 22222r1721w or system administration of Linux. It's not exigent upon communication bandwidth, but from the point of view of the user, for remote and local administration tasks, using the text console has absolutely the same effect.
For remote administration we can use serial COM ports or modem and network (TCP/IP) connections.
In the case of a
connection via serial port we will use the mgetty package. The configuration
files for mgetty are located in /etc/mgetty+sendfax
. To perform a standard setup, we can easily do these next
steps:
mgetty.config
, we need to add a
description of the serial port:
where
port ttyS0
- The device name
(port name), to which we will connnect the modem speed 115200
- Port speed. It
depends on hardware properties data-only y
- Directive to
mgetty, that modem will care only data, and not voice functions; init-chat "" ATZ OK ATL1M1
OK
- We will re-define initialization parameters, in the request-answer
format, where answer is the ability to receive commands and for modems
it's just an empty line login.config
, we need to check that
following string exists (usually, it's set by default): /etc/inittab
we will append a record like
this one: It goes without saying that the modem needs to be connected to the PC and phone line and should be powered up at this moment.
Now, if anyone calls with any terminal software tool to the modem's telephone number, that user will see the login prompt on his display and a password prompt--just like the one we have on our local console.
In case if we need to work in text mode via TCP/IP we can use telnet, rsh (Remote SHell), or ssh (Secure SHell). I strongly do not recommend telnet and rsh as they are unprotected from illegal access or any hack attempts. ssh uses encryption during send/receive operations as well as digital signatures (certificates) to keep things much safer.
It is very important to note, however, that even with ssh, you should use only the latest versions available on your distributor's site, and check the digital signature and checksum of the ssh package before installation.
ssh consists of two parts: server (daemon) and
client. The configuration files are located in the /etc/ssh
directory. We also have the local system keys
there.
Let's configure the server part, first of all. We will take a look at the simplest and not very "paranoid" variant--allowing for any hostname and password authentification, using any known encryption methods. For that, we need to follow these steps:
/etc/sshd_config
/etc/hosts.allow
Instead of ALL (all hostnames) we can write a more detailed rule, for example:
This means that access is allowed only for localhost, network 10.0.0.0/255.255.0.0, and hostname 192.168.0.34.
and let's set up the server to auto-start upon system reload
Now the server part is ready. Let's try to connect to it. On a workstation we can type:
where username
is a login name of an existing
user on the server and host.com
is the name or an IP address of the server.
During the first startup ssh will display a warning that the host is unknown and it will give us a "finger-print" of the received key.
We need to answer yes. We will never see this message again (provided the key is not changed). Now, we will be prompted to enter a password, which will complete this operation.
We also can implement RSA key authentification as opposed to password authentification. For this purpose, with the help of ssh-keygen utility we will need to create keys (on client-PC):
ssh-keygen -t rsaWe need to add the contents of the id_rsa.pub file to the /home/user/.ssh/authorize_keys file out on the server.
After all these operations and steps are completed, we can connect to the server without entering a password, which is very useful when creating certain kinds of scripts.
Personally, I do not recommend using modem access, as described above, because of some pertinent considerations. First of all, it's not secure--all data will be transferd via phone lines without any encryption (plain-text). Second, it's not suitable--you can only open one terminal per session. If you will need to gain access to a text console via modem, I suggest you to configure mgetty in AutoPPP modem. If using a PPP connection (like a dialup connection to an ISP) you can run the TCP/IP protocol and work with that.
For very paranoid users, we can configure authentification in ssh with the help of a digital signature (RSA key), which we can keep not on a diskette, but rather loaded onto a smart card. For detailed information about ssh configuration in this mode, you will need to read the corresponding equipment manuals and HOW-TOs.
As a rule, you don't need X Window on your server. It's pretty undesirable because of security reasons and certainly not for wasting server resources to support graphics. But in some cases, we will need a graphic console running on the server. A big example: installing and configuring Sybase SQL.
Sometimes an administrator needs to execute only a few specific graphic applications on the remote computer--for example, monitoring system or configuration utilities. In this case, we can easily use the method described here (which can also be automated with the help of shell scripts).
It is a pretty sure thing that you will have to have the Xfree-libs package pre-installed on both machines to handle this operation. YOu may also need additional libraries, depending on the application being accessed.
For example, on the administrator's computer X Window is running on the null graphic console (variable DISPLAY=:0.0). So, we will need to do the following:
where 1.2.3.5 is the IP address of the remote computer.
where the argument display is the same as the variable DISPLAY and 1.2.3.4 is the IP address of localhost.
In some cases you may still need to set the variable DISPLAY.
There will be some cases when an administrator needs to get acess to a full graphical console, such as when he is working directly behind a remote computer. For this purpose we can use a VNC package - Virtual Network Computing. It allows us to open a remote PC desktop window on our local desktop.
To configure vnc we need to follow next steps:
On remote PC:
where user
is the username on the remote computer and the number (0)
is the number of the graphic console. We need to mention that if we have
running X Window on the remote computer, this will mean that graphic console 0
is already used and we should use 1 (or higher).
Note: If a password isn't set, vncserver will not executed properly.
On the administrator's workstation we can run vncviewer (this application requires X Window to be running). In the just-opened window we will type the IP address and number of the graphic console on the machine running vncserver. A new window with a running X Window session will appear.
vnc has a few notes, which we will need to remember.
Remote administration in a graphic console in Linux will always have very high risks and very bad ways of providing security. That's why we need to pay more attention to configuring firewalls and setting tighter user passwords.
On the remote computer, you must close all of the ports from 6000 and higher (the number of ports depends on the running X Window and/or vnc servers) to access from all hostnames except the administrator's. If, for some reason, you must use that access, then use the ssh utility for additional authentification and traffic data encryption.
For vnc we must take additional care about passwords, which can be set up with vncpassword. Never run vnc with root rights.
So, with a little effort installing and configuring some basic tools for remote administration, a system administrator can get some very powerful tools for remote access, which will lighten his load tremendously. Just don't neglect the security side.
|