Remote admin components

Contents




Overview


development state
redhat  8.0
Port 12345
root dangerous
ssl to come





Installation


When using the remote administration components for a second computer tux2 you have to install two additional programs. The first program will be a socket application on the remote computer with which the remote admin components can establish a connection. The second program is a database server like mysql which will be used to manage informations used by the admin components. The remote admin components need informations about the remote computers, the software packages that are already installed or may be installed, which config files may be used and where the docu may be found and many other additional information. I first tried to store this data in flat files on the server but the code to update structured data within a file for multiple clients would be to complex to work correctly. I therefore switched to a database where single data rows or table fields may be addressed for insert and update operations. This means you have to install a database server and create the remote_admin initial database if you want to test the remote admin components.

Installing the communication client

You can find the sourcecode for the client program in the packages/hbasic_radmin/client_process of the hbasic distribution. Run make in this folder and you should get the executable client program named rem_admin.x. If you want to administrate the host tux2 with the client program must be started as a daemon on this computer. Copy the program rem_admin.x to the client computer tux2 with ftp, scp or whatever you want to use and start the program with a command like 


nohup ./rem_admin.x &


I will try to find better solutions like starting the components at boottime later. This components are currently still in a development state where starting the client program in the background should be enough to test the program.

Installing the initial database

As described above the remote-admin components need some information that will be stored in a database. I'm testing the components with a MySQL database which means the SQL commands started by the components are compatible with this database server. I started to test the same programs with PostgreSQL  but I already got some error messages when trying to create the database with the same commands. When using other database systems you currently have to find the changes needed on your own.

To get the database for the remote-admin components running you first have to install the MySQL database server and client software following the documentation from the MySQL webpage. If your database server is running you can create the initial database by executing a small SQL script. You can find the script named create_db.sql in the packages/hbasic_radmin/sql folder of your HBasic distribution.


Start mysql client and type

mysql <mysql options>

source create_db.sql


After executing this script you should find a database called admin with some tables. The script will also store some initial example values in the tables. Currently there is no program that may be used to edit this initial data sets which configure the behaviour of the remote-admin components. You may edit the values inserted from the create_db.sql script or use SQL statments within the mysql client if you want to edit the values. Again this should be enough to test the components within a development environment but there is much to do if the components should be stable within a production environment.


Host list component


Every remote-admin component will be used to display or edit some properties of a client computer. To select the computer that you want to connect to I have created an additional component that loads a list of hosts from a database table. It exports a method host_selected() which returns the name of the host that is currently selected or NULL if no host is selected.

The second version of this component can display a list of software packages or a list of remote commands in the right frame. The components may install a rpm package on a remote computer with a mouseclick of the right mouse key. I will create the docu which packages may be installed and where they should be on the server later. In the example image above the package WU-Ftpd has been installed on the client "localhost". The successful installation will be saved in the database in another table.



On the left side you can now see the packages that have been installed under the hostname. The host list component will search for documentation files or config files that may be used with this software package.

You may now display or edit the contents of this files or display the documentation for the config files with a doubleclick on this entries. In the example image the component has found an entry for the ftpaccess config file and a documentation for this config file. The documentation must be a HTML file which will be displayed with the QTextBrowser widget. I have created the initial documentation examples with the man2html program from the man pages of the config files.





A second task for the hostlist component is executing simple predefined commands on the remote host. You get the list of predefined commands with a mouseclick on the info button in the toolbar. To execute a command select one of the hosts in the hostlist on the left side and double click on the command you want to execute on the right side. A new dialog should pop up which displays the output of the command execution.





User and group editor


The Useredit and Groupedit component may be used to add, edit or delete entries in the /etc/passwd or /etc/group
file of a remote linux computer. The following image displays an example of this two components in the HBasic editor. Click on the Add user button to add a new user. Select a user in the list and click on the Drop user button to delete the user or group. Double click on an entry in the list to edit the user or group. The useredit and groupedit component will change the list of users or groups on the remote computer immediatly. Since this components are under development you should not yet use them on production computers.






Startup services


The startup-service component may be used to edit the list of services that will be executed when booting or shutting down the computer. This means the component will display or edit the links in the /etc/rc.d/rc<runlevel>.d directory where <runlevel> will be replaced with the current runlevel of the remote computer. Select one of the listed services and click on the toolbar buttons to start, stop or restart the matching service. If you click on the service with the right mouse button you may select which service will be started or stopped on the remote computer on the next boot or shutdown (runlevel switch).





Xinetd services


The xinetd-service component may be used to edit the properties of the services that will be started by the xinetd daemon. As displayed in the following image a service like wu-ftpd will be marked as disabled after it has been installed. If you want to use the ftpd on the remote computer you should set this property to "disable=no" and restart the xinetd with a mouseclick on the restart toolbutton.



You can edit the properties with a doubleclick on the line of the property. This will display the edit-dialog displayed in the next image.





PAM configuration


The pam configuration component allows you to edit the config files located in the /etc/pam.d directory of a RedHat distribution. The left side of the component lists the files found in the directory on the remote computer and the right side displays the properties of a selected file. If you double click on a property line in the right side a dialog pops up where you may change the current properties.







Display syslog


The display-syslog component may be used to display the entries of the local syslog file (var/log/messages) on the server. The entries will be displayed in a list view and may be sorted by it's columns in different directions. The components reads a description file from the /usr/local/hbasic/data directory which describes how priorities (colors) will be assigned to the messages. The component compares each message with text segments listed in the description file. If a match is found the color from the description will be taken In the image above the messages containing failed will be marked red and the messages containing Can't will be marked orange. This could be extended in future versions in many ways. I could imagine different properties described in regular expressions to choose which messages will not be displayed or might be displayed with additional information appended.

With the buttons in the toolbar you may select which colors (priorities) of messages that will be displayed.



The display-syslog component currently only searches for messages on the local host in the file /var/log/messages. If you also want to see the syslog of a remote computer you may configure it to send messages to your local server. Therefore I'm not sure if it is required to display remote system logs. If it will be needed I will also add this in future versions.



Program example


If you want to use one of the remote-admin components within your program you have to prepare the database holding some information needed and start the client program on this host. For my examples I normally will use the loopback interface and the hostname "localhost" since I only have one computer at home to test the programs. To init a remote admin component you have to pass it the name or IP number of the remote host you want to connect to. Therefore every component exports a public method host_connect( hostname ). All you have to do to connect a UserEditor componetn named RUserEdit1 to a host called tux2 is to call the method RUserEdit1.host_connect( "tux2" ). If the name tux2 cannot be resolved on the computer running HBasic you have to use the IP address of tux2 instead.

For our example program you have to execute the following:
  1. Start database and remote_admin client program (on client)
  2. Start HBasic and load the hbasic_radmin package
  3. Insert a PushButton and a UserEditor component
  4. Type in the following program and start the program

Sub button1_clicked()
RUserEdit1.host_connect( "localhost" )
End Sub

Example : UserEditor component

You should now see the list of users defined on the client computer within the UserEditor component widget.