Previous Page
Next Page

Certification Objective 4.02–Configure syslog, Customize the System Logging Facility, and Monitor and Control Superuser

Syslog is the de facto standard for event logging on UNIX systems. For years, system logging facilities have used syslog to store and manage system event notifications. This section takes logging and process accounting beyond the limitations of using the loginlog file for monitoring unsuccessful login attempts. In addition, we'll also look at ways to monitor and restrict superuser by means of the switch user (su) program.

Configuring syslog and Customizing the System Logging Facility

As mentioned, you can monitor all unsuccessful logins whether they are from terminal sessions, CDE, or GNOME. All failed login attempts will be stored in a syslog file. The syslog file can and should be monitored closely on a regular basis to pinpoint potential intrusion attempts and other irregularities.

The syslog daemon launcher script that controls the logging facilities is located in the /etc/init.d/ directory as syslog. Following is the command syntax for starting and stopping the syslog daemon:

/etc/init.d/syslog start
/etc/init.d/syslog stop

Monitoring All Failed User Login Attempts with syslog

Let's look at the steps involved in monitoring all unsuccessful login attempts with syslog.

  1. With full privileges, edit the /etc/default/login file and make sure that the SYSLOG=YES and SYSLOG_FAILED_LOGINS=0 entries are uncommented.

  2. Create the log file (/var/adm/authlog) and assign the appropriate read/write permissions for root.

    Exam Watch 

    Sun's exam may ask you which file to edit when setting up the system to monitor all failed login attempts. Remember that the login file is located in the /etc/default directory. To ensure that the system will monitor all denied logins, the SYSLOG=YES and SYSLOG_FAILED_LOGINS=0 entries should be uncommented.

  3. Change the authlog file group membership to sys.

  4. Edit the syslog.conf file to send all failed login attempts to the authlog file with the following entry:

    auth.notice<TAB>/var/adm/authlog

    (Note that a tabbed-space, not a standard space, appears between the auth.notice and /var/adm/authlog attributes in this entry).

  5. Stop and start the syslog daemon.

Customizing the System Logging Facility  Optionally, you can customize the System Logging Facility not only to log failed login access attempts after some predefined number of tries, but to close the login connection after some predefined number of failures as well.

The first part is accomplished by simply editing the SYSLOG_FAILED_LOGINS=0 entry in the /etc/default/login file to some number such as this: SYSLOG_FAILED_LOGINS=3. At this point, the system will log access attempts only after the first three failures.

The second part involves closing connections after some number of retries—for example, after five unsuccessful login attempts. This is a common configuration for enterprises, as many security policies mandate this rule. To do so, simply uncomment the RETRIES entry in the /etc/default/login file, and make sure the value is either set to 5 (which is the default value) or some other reasonable mandated value. Upon saving the file, the changes will take effect immediately; after five failed login attempts in the same session, the system will close the connection. Following is an extract of this entry:

#
# RETRIES determines the number of failed logins that will be
# allowed before login exits.
#
RETRIES=5
#

Monitoring and Controlling Superuser Access

Role-Based Access Control (RBAC), which we'll visit later in Chapter 9, is Sun's recommended alternative to using the switch user (su) program and the superuser account. With superuser access permissions, a user will have full control over the system commands and functionality. With full privileges, superusers can wreak havoc on the integrity of the operating system and potentially damage critical data. Therefore, monitoring and controlling superuser access is critical. In this section, we'll look at steps to use not only to monitor who is using the su program but also how to control superuser access.

Monitoring the su Program

The su program usage, by default, is already monitored through the /etc/default/su file as SULOG=/var/adm/sulog, and the syslog logging facility will determine whether or not all su attempts are logged with the SYSLOG=YES entry. As a result, monitoring the output is as simple as running the command more /var/adm/sulog from the terminal. The su logging in the /var/adm/sulog file entries display useful information including the date and time that the command was executed, whether or not the su attempt was successful (+ means success, - means failure), the port from which the su program was executed, and the user name that ran the program as well as the user name to which the user switched.

Following is an extract from the sulog file with regard to superuser (root) account access:

SU 05/26 10:18 + pts/0 j_public-root
SU 05/26 12:02 + pts/0 j_chirillo-root
SU 05/26 15:09 + pts/0 j_public-root
SU 05/26 15:43 + pts/0 b_friedman-root
SU 05/26 16:52 - pts/0 guest-root
Exam Watch 

The su program is monitored by default. The configuration can be found in the /etc/default/su file.

This file should be monitored on a regular basis to pinpoint potential malicious access attempts.

Displaying Superuser Access Attempts  Optionally, for hands-on monitoring, you can set up the system so that it will detect and display superuser access attempts directly on the console. To do so, follow these steps:

  1. Log in with an account that has root privileges, or use the su command to become superuser.

  2. Edit the /etc/default/su file by uncommenting this entry: CONSOLE=/dev/console

  3. Save and exit, and then log in as superuser again using the su command.

After issuing the su command to become superuser, a message will appear on the console. This is a granular approach to monitoring and is typically used when administrators are actively monitoring superuser access attempts. Also, security professionals often deploy this technique, among others, when observing a real-time attack against the operating system.

Controlling Remote Superuser Access

When you install the Solaris operating system, by default, remote superuser (root) logins are disabled. In other words, users typically have to log in as some user account (other than root) and then issue the su command to become a superuser with full privileges. However, if you detect that remote superuser login access is enabled, follow these steps to mitigate risks associated with it:

  1. Log in with an account that has root privileges, or use the su command to become superuser.

  2. Edit the /etc/default/login file by uncommenting this entry: CONSOLE=/dev/console

  3. Save and exit, and then attempt to log in as superuser remotely.

At this point, remote superuser login access should be denied. Subsequently, to become superuser remotely, simply log in with a standard user account and then issue the su command followed by root's password.

Two-Minute Drill

Here are some of the key points from the certification objectives in Chapter 4.

Identify, Monitor, and Disable Logins

  • Issue the logins command and view the /etc/shadow file to determine which accounts are locked or disabled and which do not currently have assigned passwords. These techniques are useful when identifying user login status.

  • You can disable user logins by either creating a /etc/nologin file, bringing the system down to single-user mode with the command init S, or disabling user accounts from the Solaris Management Console (SMC) interface.

Configure syslog, Customize the System Logging Facility, and Monitor and Control Superuser

  • Solaris keeps track of each terminal session user login and records login attempts in the var/adm/loginlog file if it exists and has the correct permissions.

  • Failed login attempts from terminal sessions are stored in the var/adm/loginlog file.

  • Syslog can monitor all unsuccessful login attempts. To make this happen, edit the /etc/default/login file and make sure that the SYSLOG=YES and SYSLOG_FAILED_LOGINS=0 entries are uncommented.

  • You can customize the System Logging Facility to log failed login access attempts after a predefined number of tries by editing the SYSLOG_FAILED_LOGINS=0 entry in the /etc/default/login file to some number such as this: SYSLOG_FAILED_LOGINS=3. At this point, the system will log access attempts only after the first three failures.

  • You can customize the System Logging Facility to close the login connections after some predefined number of failures by uncommenting the RETRIES entry in the /etc/default/login file (make sure the value is set to some number; 5 is the default value). By default, after five failed login attempts in the same session, the system will close the connection.

  • The su program usage is monitored through the /etc/default/su file as SULOG=/var/adm/sulog, and the syslog logging facility will determine whether or not to log all su attempts with the SYSLOG=YES entry.

  • In real time, you can display superuser access attempts on the console by uncommenting the CONSOLE=/dev/console entry in the /etc/default/su file.

  • To disable remote superuser login access attempts (which is disabled by default), simply uncomment the CONSOLE=/dev/console entry in the /etc/default/login file.

Self Test

The following questions will help you measure your understanding of the material presented in this chapter. Read all the choices carefully, because there might be more than one correct answer. Choose all correct answers for each question.

Identify, Monitor, and Disable Logins

1. 

Which of the following techniques is used to identify user login status with regard to logins without assigned passwords?

  1. Issue the command logins

  2. Issue the command logins -x

  3. Issue the command logins -p

  4. Access the /var/adm/loginlog file with superuser privileges.

  5. All of the above

    C. The logins command with the -p option is used to display which users do not have assigned passwords.     A is wrong because the logins command will display general information concerning all login accounts organized in ascending order by user ID. B is incorrect because the -x argument will display extended information regarding all login accounts. D is wrong because Solaris keeps track of each user login and records login attempts in the var/adm/loginlog file.

2. 

Which of the following are part of Sun's required password policy?

  1. The password should be at least 8 characters long.

  2. The password must be composed of between 6 and 15 letters, numbers, and special characters.

  3. The password must have at least 2 alphabetic characters and at least 1 numeric or special character within the first 6 characters.

  4. The first 8 characters of the password should not be the same as the previous password.

  5. All of the above

    B and C. Sun's policy mandates that passwords must be composed of between 6 and 15 letters, numbers, and special characters, and must have at least 2 alphabetic characters and at least 1 numeric or special character within the first 6 characters.     A and D are wrong because they are part of industry-recognized security recommendations for creating passwords and are not mandated by Sun's password policy.

3. 

Failed login attempts from terminal sessions are stored in which file?

  1. /etc/default/login

  2. /etc/nologin

  3. /etc/shadow

  4. /var/adm/loginlog

  5. All of the above

    D. Solaris keeps track of each terminal session login attempt in the var/adm/loginlog file.     A is wrong because /etc/default/login involves syslog and monitoring all unsuccessful login attempts. B is wrong because /etc/nologin is used when disabling user logins. C is incorrect because the /etc/shadow file can be accessed to determine which accounts are locked or disabled and which do not currently have assigned passwords.

4. 

Which of the following techniques can be used to identify current user login status?

  1. Accessing the /etc/shadow file with superuser privileges

  2. Issuing the command logins

  3. Issuing the command init S

  4. Accessing the /var/adm/loginlog file with superuser privileges

  5. All of the above

    A and B. Identifying user login status-by issuing the logins command and viewing the /etc/shadow file-is important for determining which accounts are locked or disabled and which do not currently have assigned passwords.     C is wrong because the init S command is used to bring down the system to run level S (single-user mode). D is wrong because the /var/adm/loginlog file is used to log failed terminal session user login attempts.

5. 

Which of the following commands can be executed to switch between run levels and to perform functions such as halting and rebooting the Solaris operating system?

  1. shutdown -y

  2. init (Run Level #)

  3. shutdown -i init-level -g grace-period -y

  4. All of the above

    D. All of the answers are correct. By issuing the init (   Run Level #   ) command, you can switch between run levels and perform functions such as halting and rebooting the Solaris operating system. Additionally, you can shut down the system with this command:  shutdown  i init-level -g grace-period -y where  init-level  is 0, 1, 2, 5, 6 or S (which is the default) and  grace-period  is the time (in seconds) before the system is shut down (the default is 60 seconds). For example, to shut down the system to run level S and therefore disable all logins, you would use this command: shutdown -y

6. 

Which of these commands can be executed to display only the extended user login status for Becky Blake, whose login name is b_blake?

  1. logins

  2. logins b_blake

  3. logins -p

  4. logins -x -l b_blake

  5. All of the above

    D. To display the extended user login status for a particular user, issue the logins - x -l   user  command.     A is incorrect because the logins command will display general information concerning all login accounts organized in ascending order by user ID. B is incorrect because the logins   user  command will display only general information about a particular user account. C is wrong because the logins -p command will display user accounts that currently do not have assigned passwords.

7. 

Which of these is a common run level used to stop the operating system and reboot?

  1. S

  2. 0

  3. 2

  4. 5

  5. 6

  6. All of the above

    E. By issuing init 6 you will stop the operating system and reboot.     A is incorrect because init S is used to enter single-user state for administrative functions. B is wrong because init 0 is used to enter firmware maintenance mode. C is wrong because init 2 is used to enter multi-user state where NFS is not running. D is wrong because init 5 is used to shut down the operating system altogether.

8. 

Which of these is a common run level used to go into single-user state for administrative functions?

  1. S

  2. 0

  3. 2

  4. 5

  5. 6

  6. All of the above

    A. By issuing init S you will enter single-user mode.     B is wrong because init 0 is used to enter firmware maintenance mode. C is wrong because init 2 is used to enter multi-user state where NFS is not running. D is wrong because init 5 is used to shut down the operating system altogether. E is incorrect because by issuing init 6 you will stop the operating system and reboot.

9. 

To perform system maintenance, you must bring system resources down to minimum levels. Which of these techniques can be used to disable user logins?

  1. Bring the system down to single-user mode.

  2. Issue the shutdown -g 120 -y command.

  3. Issue the init S command.

  4. Create a /etc/nologin file.

  5. Disable user accounts individually with the Solaris Management Console.

  6. All of the above

    F. All of the answers are correct. Disabling user logins can be accomplished by creating a /etc/nologin file, bringing the system down to single-user mode (by issuing the init S or shutdown command with the default init state), and disabling user accounts individually with the Solaris Management Console (SMC) interface.

Answers

1. 

þ C. The logins command with the -p option is used to display which users do not have assigned passwords.

ý A is wrong because the logins command will display general information concerning all login accounts organized in ascending order by user ID. B is incorrect because the -x argument will display extended information regarding all login accounts. D is wrong because Solaris keeps track of each user login and records login attempts in the var/adm/loginlog file.

2. 

þ B and C. Sun's policy mandates that passwords must be composed of between 6 and 15 letters, numbers, and special characters, and must have at least 2 alphabetic characters and at least 1 numeric or special character within the first 6 characters.

ý A and D are wrong because they are part of industry-recognized security recommendations for creating passwords and are not mandated by Sun's password policy.

3. 

þ D. Solaris keeps track of each terminal session login attempt in the var/adm/loginlog file.

ý A is wrong because /etc/default/login involves syslog and monitoring all unsuccessful login attempts. B is wrong because /etc/nologin is used when disabling user logins. C is incorrect because the /etc/shadow file can be accessed to determine which accounts are locked or disabled and which do not currently have assigned passwords.

4. 

þ A and B. Identifying user login status—by issuing the logins command and viewing the /etc/shadow file—is important for determining which accounts are locked or disabled and which do not currently have assigned passwords.

ý C is wrong because the init S command is used to bring down the system to run level S (single-user mode). D is wrong because the /var/adm/loginlog file is used to log failed terminal session user login attempts.

5. 

þ D. All of the answers are correct. By issuing the init (Run Level #) command, you can switch between run levels and perform functions such as halting and rebooting the Solaris operating system. Additionally, you can shut down the system with this command:

shutdown –i init-level -g grace-period -y

where init-level is 0, 1, 2, 5, 6 or S (which is the default) and grace-period is the time (in seconds) before the system is shut down (the default is 60 seconds). For example, to shut down the system to run level S and therefore disable all logins, you would use this command: shutdown -y

6. 

þ D. To display the extended user login status for a particular user, issue the logins - x -l user command.

ý A is incorrect because the logins command will display general information concerning all login accounts organized in ascending order by user ID. B is incorrect because the logins user command will display only general information about a particular user account. C is wrong because the logins -p command will display user accounts that currently do not have assigned passwords.

7. 

þ E. By issuing init 6 you will stop the operating system and reboot.

ý A is incorrect because init S is used to enter single-user state for administrative functions. B is wrong because init 0 is used to enter firmware maintenance mode. C is wrong because init 2 is used to enter multi-user state where NFS is not running. D is wrong because init 5 is used to shut down the operating system altogether.

8. 

þ A. By issuing init S you will enter single-user mode.

ý B is wrong because init 0 is used to enter firmware maintenance mode. C is wrong because init 2 is used to enter multi-user state where NFS is not running. D is wrong because init 5 is used to shut down the operating system altogether. E is incorrect because by issuing init 6 you will stop the operating system and reboot.

9. 

þ F. All of the answers are correct. Disabling user logins can be accomplished by creating a /etc/nologin file, bringing the system down to single-user mode (by issuing the init S or shutdown command with the default init state), and disabling user accounts individually with the Solaris Management Console (SMC) interface.

Configure syslog, Customize the System Logging Facility, and Monitor and Control Superuser

10. 

The switch user (su) program usage (by default) is monitored.

  1. True

  2. False

    A. True. The su program usage, by default, is already monitored through the /etc/default/su file as SULOG=/var/adm/sulog , and the syslog logging facility will determine whether or not to log all su attempts with the SYSLOG=YES entry.

11. 

Which of these techniques is used to detect and display superuser access attempts actively on the console?

  1. Commenting out the CONSOLE=/dev/console entry in the /etc/default/login file

  2. Uncommenting the CONSOLE=/dev/console entry in the /etc/default/su file

  3. Uncommenting the CONSOLE=/dev/console entry in the /etc/default/login file

  4. Commenting out the CONSOLE=/dev/console entry in the /etc/default/su file

  5. All of the above

    B. To detect and display superuser access attempts actively on the console in real time, uncomment the CONSOLE=/dev/console entry in the /etc/default/su file.     C is wrong because by uncommenting the CONSOLE=/dev/console entry in the /etc/default/login file, you will disable remote superuser login access. The rest of the answers don't make sense.

12. 

The syslog daemon is located in which directory?

  1. /etc

  2. /etc/init.d

  3. /usr/local

  4. /usr/asset

  5. /devices

  6. All of the above

    B. The syslog daemon that controls the logging facilities is located in the / etc/init.d directory as syslog .     A and E are wrong because device-specific files are stored in the /etc and /devices directories, which are common targets for attackers to attempt to gain access to the operating system, especially for creating backdoors to the system. C is wrong because /usr/local is an example of a typical download directory used to store files and programs by the current user. D is wrong because /usr/asset is the working directory for ASET.

13. 

Which of these techniques can be used to capture unsuccessful login attempts?

  1. Edit the /etc/default/login file and uncomment the RETRIES entry.

  2. Create a var/adm/loginlog file.

  3. Edit the /etc/default/login file and uncomment the SYSLOG=YES and SYSLOG_FAILED_LOGINS=0 entries.

  4. All of the above

    B and C. Capturing unsuccessful terminal session login attempts is accomplished by creating a var/adm/loginlog file. To monitor all failed login attempts, edit the /etc/default/login file and make sure that the SYSLOG=YES and SYSLOG_FAILED_LOGINS=0 entries are uncommented.     A is incorrect because by uncommenting the RETRIES entry in the /etc/default/login file and editing the SYSLOG_FAILED_LOGINS=   some number  you'll force the system to close the login connection after some predefined number of unsuccessful login attempts.

Answers

10. 

þ A. True. The su program usage, by default, is already monitored through the /etc/default/su file as SULOG=/var/adm/sulog, and the syslog logging facility will determine whether or not to log all su attempts with the SYSLOG=YES entry.

11. 

þ B. To detect and display superuser access attempts actively on the console in real time, uncomment the CONSOLE=/dev/console entry in the /etc/default/su file.

ý C is wrong because by uncommenting the CONSOLE=/dev/console entry in the /etc/default/login file, you will disable remote superuser login access. The rest of the answers don't make sense.

12. 

þ B. The syslog daemon that controls the logging facilities is located in the /etc/init.d directory as syslog.

ý A and E are wrong because device-specific files are stored in the /etc and /devices directories, which are common targets for attackers to attempt to gain access to the operating system, especially for creating backdoors to the system. C is wrong because /usr/local is an example of a typical download directory used to store files and programs by the current user. D is wrong because /usr/asset is the working directory for ASET.

13. 

þ B and C. Capturing unsuccessful terminal session login attempts is accomplished by creating a var/adm/loginlog file. To monitor all failed login attempts, edit the /etc/default/login file and make sure that the SYSLOG=YES and SYSLOG_FAILED_LOGINS=0 entries are uncommented.

ý A is incorrect because by uncommenting the RETRIES entry in the /etc/default/login file and editing the SYSLOG_FAILED_LOGINS=some number you'll force the system to close the login connection after some predefined number of unsuccessful login attempts.

Lab Question

 

ABCD Inc. is a chemical distribution firm that hired you to set up syslog on its Solaris 10 server to monitor all failed user login attempts as well as monitor uses of the switch user (su) program. What steps would you perform to provide the requested services?

The first task that ABCD Inc. hired you to perform is to set up syslog to monitor all failed user login attempts. To do so:  a. Log in to the server with an account that has root privileges, or use the su command to become superuser.  b. Edit the /etc/default/login file by uncommenting the SYSLOG=YES and SYSLOG_FAILED_LOGINS=0 entries.  c. Create the log file in the /var/adm directory with the visual editor (vi) or by issuing the touch/var/adm/authlog command.  d. Assign the appropriate read/write permissions for root to the log file with this command: chmod 600 /var/adm/authlog   e. Change the authlog file group membership to sys with the command chgrp sys /var/adm/authlog   f. Edit the syslog.conf file to send all failed login attempts to the authlog file with this entry: auth.notice /var/adm/authlog   g. Stop and start the syslog daemon by issuing these commands: /etc/init.d/syslog stop and /etc/init.d/syslog start . Be sure to test that the system is logging failed login attempts by unsuccessfully logging in to the system and then viewing the /var/adm/authlog file contents.   The second task that the client requires of you is to monitor uses of the switch user (su) program. The su program usage, by default, is already monitored through the /etc/default/su file as SULOG=/var/adm/sulog , and the syslog logging facility will determine whether or not to log all su attempts with the SYSLOG=YES entry. Therefore, you must ensure that the SYSLOG=YES entry is uncommented in the /etc/default/login file. At that point, monitoring the output in the sulog file is accomplished by viewing the file with a command such as more /var/adm/sulog from the terminal. The su logging in the /var/adm/sulog file entries displays useful information, including the date and time that the command was executed, whether or not the su attempt was successful, the port from which the su program was executed, and the user name that ran the program as well as the user name to which the user switched. This file should be monitored on a regular basis to pinpoint potential malicious access attempts.

Answers

 

The first task that ABCD Inc. hired you to perform is to set up syslog to monitor all failed user login attempts. To do so:

  1. Log in to the server with an account that has root privileges, or use the su command to become superuser.

  2. Edit the /etc/default/login file by uncommenting the SYSLOG=YES and SYSLOG_FAILED_LOGINS=0 entries.

  3. Create the log file in the /var/adm directory with the visual editor (vi) or by issuing the touch/var/adm/authlog command.

  4. Assign the appropriate read/write permissions for root to the log file with this command: chmod 600 /var/adm/authlog

  5. Change the authlog file group membership to sys with the command chgrp sys /var/adm/authlog

  6. Edit the syslog.conf file to send all failed login attempts to the authlog file with this entry: auth.notice /var/adm/authlog

  7. Stop and start the syslog daemon by issuing these commands: /etc/init.d/syslog stop and /etc/init.d/syslog start. Be sure to test that the system is logging failed login attempts by unsuccessfully logging in to the system and then viewing the /var/adm/authlog file contents.

The second task that the client requires of you is to monitor uses of the switch user (su) program. The su program usage, by default, is already monitored through the /etc/default/su file as SULOG=/var/adm/sulog, and the syslog logging facility will determine whether or not to log all su attempts with the SYSLOG=YES entry. Therefore, you must ensure that the SYSLOG=YES entry is uncommented in the /etc/default/login file. At that point, monitoring the output in the sulog file is accomplished by viewing the file with a command such as more /var/adm/sulog from the terminal.

The su logging in the /var/adm/sulog file entries displays useful information, including the date and time that the command was executed, whether or not the su attempt was successful, the port from which the su program was executed, and the user name that ran the program as well as the user name to which the user switched. This file should be monitored on a regular basis to pinpoint potential malicious access attempts.


Previous Page
Next Page