+ All Categories
Home > Documents > Securing SunLinux Systems Part I, Local Access and File Systems 817-3420(2003)

Securing SunLinux Systems Part I, Local Access and File Systems 817-3420(2003)

Date post: 07-Apr-2018
Category:
Upload: arojasm2912
View: 220 times
Download: 0 times
Share this document with a friend

of 40

Transcript
  • 8/6/2019 Securing SunLinux Systems Part I, Local Access and File Systems 817-3420(2003)

    1/40

    Sun Microsystems , Inc.901 San Antonio Road

    Palo Alto , CA 94303 USA650 960-1300 fax 650 969-9131

    http://www.sun.com/blueprints

    Securing Sun Linux

    Systems: Part I,

    Local Access and File System s

    By Glenn Brunette, Michael Hullhorst, and

    G Weijers

    Sun BluePrints OnLineJuly 2003

    Part No.: 817-3420-10

    Revision 1.0, 6/ 26/ 03

  • 8/6/2019 Securing SunLinux Systems Part I, Local Access and File Systems 817-3420(2003)

    2/40

    Please

    Recycle

    Copyrigh t 2003Sun Microsystems, Inc., 4150 Netw ork Circle, Santa Clara, California 95054,U.S.A. All rights reserved .

    Sun Microsystems, Inc.h as intellectual prop erty rights relating to technology that is described in this docum ent. In particular, and w ithoutlimitation, these intellectual prop erty rights may includ e one or more of the U.S. patent s listed at http :/ / ww w.sun.com/ paten ts and one ormore add itional paten ts or pend ing patent applications in the U.S. and in other coun tries.

    This docum ent and the produ ct to which it pertains are distribu ted und er licenses restricting their use, copying, distribu tion, anddecomp ilation. No part of the produ ct or ofth is docum ent may be reprod uced in any form by any means withou t prior written auth orization ofSun and its licensors, if any.

    Third-party software, including font technology, is copyrighted an d licensed from Sun sup pliers.

    Parts of the prod uct may be derived from Berkeley BSD systems, licensed from the University of California. UNIX is a registered tradema rk inthe U.S. and in other coun tries, exclusively licensed throu gh X/ Op en Compan y, Ltd.

    Sun, Sun Microsystems, the Sun logo, Answ erBook2, docs.sun.com, Solaris, Sun BluePrints, and Sun Linux are tradem arks or registeredtrad emarks of Sun Microsystems, Inc.in the U.S.an d in other coun tries.

    All SPARC trademarks are used u nd er license and are trad emarks or registered tradem arks of SPARC Internat ional, Inc.in th e U.S. and in oth ercountries. Produ cts bearing SPARC trademarks are based up on an architecture dev eloped by Sun Microsystems, Inc.

    The OPEN LOOK and Sun Graph ical User Interface was develop ed by Sun Microsystems, Inc.for its users and licensees. Sun acknowledg esthe pioneering efforts of Xerox in researching and d eveloping the concept of visual or graph icalu ser interfaces for the compu ter indu stry. Sunhold s a non -exclus ive license from Xerox to the Xerox Graph ical User Interface, wh ich license also covers Sun s licensees wh o implem ent OPENLOOK GUIs and otherw ise comp ly with Sun s written license agreements.

    [IF ENERGYSTAR INFORMATION ISREQUIRED FOR YOUR PRODUCT, COPY THE ENERGYSTAR GRAPHIC FROM THE REFERENCE

    PAGE AND PASTE IT HERE,USING THE Graph icAnchor PARAGRAPH TAG. ALSO, COPY THE ENERGYSTAR LOGO TRADEMARKATTRIBUTION FROM THE REFERENCE PAGE AN D PASTE IT ABOVE WHERETHIRD-PARTYTRADEMARKS ARE ATTRIBUTED.(ENGLISH COPYRIGHT ON LY). DELETE THIS TEXT.]

    U.S. Governm ent RightsComm ercial use. Governm ent users are subject to the Sun Microsystems, Inc.stan dard license agreement andapp licable provisions of the FAR and its sup plement s.

    DOCUMENTATION IS PROVIDED "AS IS" AND A LL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATION S AN D WARRANTIES,INCLUDING ANY IMPLIED WARRANTYO F MERCHAN TABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NON -INFRINGEMENT,ARE DISCLAIMED, EXCEPT TO THE EXTENT THAT SUCH DISCLAIMERS ARE HELD TO BE LEGALLY INVALID.

    Copyrigh t 2003Sun Microsystems, Inc., 4150 Netw ork Circle, Santa Clara, California 95054, Etats-Unis.Tous droits rservs.

    Sun Microsystems, Inc.a les droits de p roprit intellectuels relatants la technologie qui est dcrit dans ce docum ent. En particulier, et sans lalimitation, ces droits de prop rit intellectuels peuven t inclure un ou plu s des brevets amricains numrs http:/ / w ww.sun .com/ patent s etun o u les brevets plus sup plmen taires ou les app lications de brevet en attente d ans les Etats-Unis et dans les autres pays.

    Ce produ it ou docum ent est protg par un copyright et distribu avec des licences qui en restreignent lutilisation, la copie, la distribu tion, et ladcompilation. Aucune partie de ce produit ou document n e peut tre reprodu ite sous aucune forme,p arquelque moyen que ce soit,sanslau torisa tion pr alable et crite de Sun et de ses bailleur s de licence, sil y ena.

    Le logiciel dtenu p ar des tiers, et qui comprend la technologie relative aux polices de caractres, est protg par u n copyright et licenci par desfournisseurs de Sun.

    Des parties de ce prod uit p ourron t tre drives des systmes Berkeley BSD licencis par lUniversit de Californie.UN IXest un e marqu edp ose aux Etats-Unis et dans d autres pay s et licencie exclusivement par X/ Op en Comp any,Ltd .

    Sun, Sun Microsystems, le logo Sun , Answ erBook2, docs.sun.com, Solaris, Sun BluePrints, et Sun Linux sont des marqu es de fabrique ou desmarqu es dposes de Sun Microsystems, Inc.a ux Etats-Unis et dan s dautres pays.

    Toutes les marqu es SPARC sont ut ilises sous licence et sont des marq ues d e fabrique ou d es marqu es dposes d e SPARC Internat ional, Inc.aux Etats-Unis et dan s dautres pays. Les prod uits protan t les marques SPARC sont bass sur une architecture dvelopp e par SunMicrosystems, Inc.

    Linterface dutilisation graphiqu e OPEN LOOK et Sun a t dvelop pe par Sun Microsystems, Inc.p our ses utilisateurs et licencis.Sunreconnat les efforts de pionn iers de Xerox pour la recherche et le dvelop pm ent d u concept d es interfaces dutilisation visuelle ou grap hiqu epou r lindu strie de linformatiqu e. Sun d tient un e license non exclusive d o Xerox sur linterface dutilisation grap hiqu e Xerox,cette licencecouvran t galement les licencies de Sun qui mettent en place linterface d utilisation graph ique OPEN LOOK et qui en outre se conformentaux licences crites de Sun .

  • 8/6/2019 Securing SunLinux Systems Part I, Local Access and File Systems 817-3420(2003)

    3/40

    1

    Securing Sun Linux System s:

    Part I, Local Access and File Systems

    This article is the first p art of a tw o-part series that p rovides recomm endations for

    securing the Sun Linux 5.0 operating system. This part provides recommendations

    for securing local access and file systems. Part II provides recommendations for

    securing network access and services. The information in this article applies only to

    the Sun Linux 5.0 distribution, although some techniques or recommendations mightapp ly to other Linu x distributions.

    It is important to address security for local access and file systems. Often,

    adm inistrators are solely concerned with p rotecting a system from rem ote threats.

    We recomm end that you have equ al concern for local, authorized u sers who can

    exercise a weak configuration, either inadvertently or maliciously, and gain

    una uthorized privileges on a system. We highly recomm end a layered app roach to

    security wh ere protection is imp lement ed for both local and rem ote threats, resulting

    in a more robu st security configuration.

    Sun Linux 5.0 is based on the Red Hat 7.2 Linux distribution and is a flexible,

    general pu rpose op erating system. To secure a Sun Linux system against

    una uthorized access and mod ification requires changes to its d efault configuration.

    Although these changes are in m ost cases relatively minor, we strongly recomm end

    that you make th ese changes to imp rove the security posture of a system. The

    changes and recomm endations in both articles add ress the majority of method s that

    intrud ers use to gain un auth orized or privileged access to Sun Linu x systems. You

    should implement these changes immed iately after system installation.

    As w ith most security strategies, you m ust achieve a balance between system

    manageability and security. Some recomm end ations in this article might not app ly to

    your environm ent and might negatively imp act your ability to manage a system.

    You m ust kn ow you r system an d security requirements before starting.

    Implementing th e changes recommend ed in this article requires planning, testing,

    and documentation.

  • 8/6/2019 Securing SunLinux Systems Part I, Local Access and File Systems 817-3420(2003)

    4/40

    2 Securing Sun Linux Systems: Part I, Local Access and File Systems July 2003

    This article contains th e following top ics:

    s Installing an d Patching on page 2

    s Minimizing the Installation on page 5

    s Disabling System Services on p age 6

    s Verifying Integrity on p age 7

    s Securing the Console and Front Pan el on p age 10

    s Configuring the File System on page 18

    s Managing Accounts on page 21

    s Monitoring System Activity on page 32

    s References and Related Resources on page 34

    s About the Au thors on page 35

    s Ord ering Sun Documents on p age 37

    s Accessing Sun Documentation Online on page 37

    Installing and Patching

    Since the in itial release of the Sun Linu x 5.0 operatin g system , Sun has released

    several upd ates and patches. These up dates typ ically includ e security imp rovements

    as well as enhancements related to reliability, performance, and manageability.

    When bu ilding a Sun Linux system, be sure to u se the latest software u pd ates and

    patches to take advan tage of these improvem ents.

    We strongly recommend that you apply all security patches to a system immediately

    after installing it.

  • 8/6/2019 Securing SunLinux Systems Part I, Local Access and File Systems 817-3420(2003)

    5/40

    Installing and Patching 3

    Install the System Securely

    To preven t attackers from mod ifying a system or creating backdoors, do not attach the

    system to a public network un til you h ave installed security patches and completedsecurity m odifications. Attackers do n ot need mu ch time to exploit an unp atched

    out-of-the-box system.

    The Sun Linux software distribution automates nearly every facet of the installation

    process. This benefit makes each installation repeatable and less prone to error. A

    side effect of this process is that you cannot select packages or clusters for

    installation or removal. However, after the installation is completed, you can

    manually add or remove packages.

    Apply Patches

    Immed iately after installing a Sun Linu x system, u pd ate it w ith all of the available

    security patches to help prev ent the exploit of know n attacks. You can dow nload th e

    software u pd ates and security patches for Sun Linux even if you do n ot have a

    service contract.

    To identify which version of Sun Linux your system has, enter the following

    command.

    Security patches are available in two forms:s Produ ct Updates Download these from http://sunsolve.sun.com/

    patches/linux. These up dates are clusters of patches that add ress issues

    related t o reliability, availability, secur ity, and system m anagemen t. These u pd ates

    are typically dow nloaded and installed as a comp lete group.

    s Individual Security Patches Download these from http://

    sunsolve.sun.com/patches/linux/security.html. These patches ad dress

    security issues in a prod uct, tool, or function. You can d ownload these p atches in

    either the Red Hat package management (RPM) or Source RPM (SRPM) format.

    SRPMs are RPM files that contain the source code for a program instead of its

    compiled code (stored in the RPM). In addition, an MD5 signature is on the site

    for each patch, so that you can verify the integrity of downloaded files. We

    recomm end th is step to ensure that p atches applied are only those provided by

    Sun.

    # cat /etc/sun-release

  • 8/6/2019 Securing SunLinux Systems Part I, Local Access and File Systems 817-3420(2003)

    6/40

    4 Securing Sun Linux Systems: Part I, Local Access and File Systems July 2003

    Note App ly only patches that are developed an d released by Sun Microsystems,Inc. Although the d istribution is based on the Red H at Linu x distribution, patches

    released by Red H at should never be app lied. Doing so might render th e system

    unsup portable by Sun.

    To verify that a pa tch was ap plied, use the rpm command . For example, to verify

    that the xinetd-2.3.7-4.7x.i386.rpm package, available from the security

    patch w eb site, is installed, use th e following comman d.

    If the rpm command does not return a match w ith the correct version, then

    download the patch from Sun, and install it on the system as soon as possible. If the

    command returns n o value, then the related software p ackage is not installed on the

    system and, therefore, the patch is unnecessary.

    In ad d ition to the Sun Linux security w eb site, Sun offers a security bu lletin m ailing

    list. This list is for administrators who want to receive security bulletins directly

    from the Sun Security Coordination Team. For more information on joining this list,

    ema il the Sun Security Coord ination Team or subm it a secur ity alert to the following

    Web site:

    http://sunsolve.sun.com/pub-cgi/show.pl?target=security/sec

    Receiving and acting upon these notifications in a timely manner is essential to

    sustaining a strong security posture.

    At this time, Sun does not provide an a utom ated m echanism to ensure that a system

    is currently using th e m ost recent p atches, security or otherwise. This process mu st

    be done man ually to ensure that all available and app licable patches are installed.

    Note You can u se the Sun Cobalt Control Station to mon itor and manage largedeployments of Sun LX50 systems. For example, you can use it to apply software

    up dates. Using this prod uct might help simp lify the patch man agement p rocess forthese sites. For more information, refer to http://www.sun.com/hardware/

    serverappliances/controlstation .

    As with an y changes mad e to a systems configuration, always review the impa ct of

    the resulting changes to ensure that the security posture of a system is not

    diminished. Ensure that previously disabled services remain d isabled after patches

    are applied. In addition, if possible, apply patches to non-production systems first to

    identify the imp act of the changes before imp lementing them on p rodu ctionsystems.

    # rpm -q -a | grep xinetd

    xinetd-2.3.7-4.7x

  • 8/6/2019 Securing SunLinux Systems Part I, Local Access and File Systems 817-3420(2003)

    7/40

    Minimizing the Installation 5

    Minimizing the Installation

    It is important to redu ce the Sun Linux installation dow n to the minimu m nu mber of

    packages necessary to su pp ort the app lications being hosted. This reduction in

    services, libraries, and app lications h elps increase security by redu cing the n um ber

    of subsystems that m ust be disabled, patched, and maintained.

    Sun Linu x uses RPM to install, upgr ade, and delete packages. Each package

    maintains a description, file list, change log, checksum, and dep endency

    information. Use this information to m aintain and validate system integrity whenadd ing, upgrad ing, or removing packages. To a limited d egree, you can u se the

    information to validate a package, before or after you install it on a system.

    To remove an RPM pa ckage that is no longer need ed, use the -e option with the rpm

    command , as in the following example:

    In the example, the first package minicom-2.00.0-3 is successfully remov ed. The

    second package glibc-common-2.2.5-42 is not removed , due to an u nresolved

    package dep endency.

    Caution When m anipu lating p ackages, take care to ensure th at the RPMdep endency tree is not inad vertently corrup ted. We strongly recomm end that you

    avoid using the options --force, --replacepkgs, --replacefiles an d

    --oldpackage. Imp roper u se of these options can cause the RPM depend ency

    database to reflect an inaccurate state of a system.

    # rpm -e minicom-2.00.0-3

    # rpm -e glibc-2.2.5-42error: removing these packages would break dependencies:

    glibc-common = 2.2.5-42 is needed by glibc-2.2.5-42

  • 8/6/2019 Securing SunLinux Systems Part I, Local Access and File Systems 817-3420(2003)

    8/40

    6 Securing Sun Linux Systems: Part I, Local Access and File Systems July 2003

    Disabling System Services

    System services are started by the init system. Disable services that are not

    necessary to system operation. For example, some services m ight allow a system to

    be comprom ised, d ue to incorrect configuration. System services un der the Sun

    Linux OS are controlled using the chkconfig command , which you can use to list

    services available, then disable or enable them.

    Note The chkconfig command does not start or stop system service; it onlyenables or disables it from ru nn ing at boot time. If you disable a system service withchkconfig and do not reboot the system, then you m ust stop the system service

    using the script in the /etc/rc.d/init.d directory.

    To list existing services and their states, use the following command:

    To disable a system service, use the following command:

    To enable a system service, use the following command:

    The previous example enables service for each of the systems seven run levels.

    Use only the number or n um bers corresponding to the ru n levels at which the

    service should r un . For examp le, to enable a service only for run level 5, then m odify

    th e --level option to includ e only the num ber 5.

    For security purposes, only enable required services. The fewer services that are

    enabled, the less likely it is that attackers can discover ways to exploit systems.

    The packages installed d etermine w hat services are enabled by d efault. Removing

    un necessary p ackages disables some extraneous services. Examine the remaining

    services to determine th eir relevance to the system and the hosted app lications.

    #/sbin/chkconfig --list

    # /sbin/chkconfig --level 0123456 off

    # /sbin/chkconfig --level 0123456 on

  • 8/6/2019 Securing SunLinux Systems Part I, Local Access and File Systems 817-3420(2003)

    9/40

    Verifying Integrity 7

    Note Be aw are that installing p atches and/ or software packages might restore oradd new entries for init to start. We recomm end that you regularly review the

    services started by init. In particular, check for new services or changes in the

    status of existing services after patches or new software are installed on a system.

    Verifying Integrity

    After you install or up grade a system, we strongly recommend that you verify the

    integrity of the Sun Linux im age. You can perform this task using th e comman ds

    described in the p revious section, but to p rovide a higher d egree of assurance,

    compare the p ackages on the system a gainst a trusted source such as the Sun Linux

    CD-ROM distribution.

    It is possible to verify whether the files installed by RPM were modified after the

    installation by comp aring them with th e original .rpm file. The following com mand

    compares the installed files with the original xinetd package.

    You can u se a simple shell script to va lidate an d rep ort on th e integrity of all of the

    RPM packages installed on a system. This result is achieved by comparing the

    installed packages with their counterpar ts from th e installation or u pd ate med ia.

    # rpm --verify -p xinetd-2.3.7-4.7x.i386.rpm

  • 8/6/2019 Securing SunLinux Systems Part I, Local Access and File Systems 817-3420(2003)

    10/40

    8 Securing Sun Linux Systems: Part I, Local Access and File Systems July 2003

    The following sh ell script is an examp le of how to generate a usable report.

    Note This verification method is most effective on newly installed or upgradedsystems. For systems or p ackages that ha ve been patched, this method only works if

    the p ackages signatures are tested against a p atched, trusted copy of the p ackage.

    The following examp le illustrates how to verify packages against the package

    information stored in a systems local RPM database. This check is similar to thepkgchk(1M) command in the Solaris OE.

    In the example, the integrity of the first package, filesystem-2.1.6-2, wassuccessfully verified. The check failed for the second package, apache-1.3.23-11,

    when the /etc/rc.d/init.d/httpdwas found to have been modified.

    To verify all packages on a system, use the -a option in p lace of the package nam e.

    # !/bin/sh

    INSTALLED_RPMS="rpm --query --all | sort -u"

    for pkg in ls /mnt/cdrom/RedHat/RPMS/*.rpm | sort -u; do

    short_pkg="basename ${pkg} | sed s/i386rpm//g"

    if [ echo ${INSTALLED_RPMS} | grep -wc ${short_pkg} != 0 ];

    then

    rpm --quiet --verify --package ${pkg}

    if [ $? = 0 ]; then

    result="SUCCESS"

    else

    result="FAILED"

    fi

    printf "Package Check: %-35s RESULT: %s\n" \

    ${short_pkg} ${result}

    fi

    done

    # rpm -verify filesystem-2.1.6-2

    # rpm -verify apache-1.3.23-11

    S.5....T c /etc/rc.d/init.d/httpd

    # rpm -verify -a

  • 8/6/2019 Securing SunLinux Systems Part I, Local Access and File Systems 817-3420(2003)

    11/40

    Verifying Integrity 9

    This capa bility is not a sub stitute for fun ctionality such as Tripw ire. This inform ation

    is used only by th e RPM framew ork to ensure th at packages are completely

    installed, upgrad ed, or removed, and that all package dep endencies are prop erly

    met.

    After you validate th e integrity of a system, use prod ucts such as Tripw ire to

    establish a baseline database for detecting file integrity violations. The Sun Linux

    distribution includes the Tripwire Open Source, Linux Edition, product originally

    developed by Tripw ire, Inc. This tool provides d ata integrity assurance throu gh th e

    collection and management of file signatures and related data. If configured

    properly, this tool identifies when file system objects are changed. We recommend

    you consider products such as Tripwire as part of an organizations overall platform

    security stra tegy.

    Note For m ore information on the Tripw ire Open Source, Linux Edition prod uct,refer to th e Web site http://www.tripwire.org/.

    Other m ethods can provide a higher d egree of assurance, but those method s are

    outside the scope of this article. At this time, Sun does not provide a Sun Linux

    equivalent to the Solaris Fingerprint Database software.

  • 8/6/2019 Securing SunLinux Systems Part I, Local Access and File Systems 817-3420(2003)

    12/40

    10 Securing Sun Linux Systems: Part I, Local Access and File Systems July 2003

    Securing the Console and Front Panel

    The next ta sk is to consid er restr icting access to a systems console. This task is

    useful if the server is located in a comm on area of a netw ork op erations center.

    Note These tasks d o not prevent attackers w ith ph ysical access fromcompromising systems. These method s p rovide incremental security, but caution

    mu st always be exercised wh en p hysical access to a system a nd related hard wa re is

    permitted.

    This section contains t he following top ics:

    s Access and Mod ify BIOS Configura tion on page 11

    s Restrict Access to BIOS on page 12

    s Limit Front Panel, Keyboard, and Video Access on page 13

    s Restrict Alternate Boot Devices on page 14

    s Restrict Access to th e LILO Boot Loader on p age 15

    s Disable Control-Alt-Delete Reboot Key Sequen ce on p age 16

    s Require Single-User Mode Passw ord on p age 16

    s Disable the M agic SysRq Key on p age 17

    s Restrict Root Access to Devices on page 17

  • 8/6/2019 Securing SunLinux Systems Part I, Local Access and File Systems 817-3420(2003)

    13/40

    Securing the Console and Front Panel 11

    Access and Modify BIOS Configuration

    The Sun Linux 5.0 operating system is provided on the Sun LX50 system. The Sun

    LX50 system uses the American Megatrends, Inc. (AMI) Basic Input and OutputSystem (BIOS). The BIOS provides security features that prevent unauthorized or

    accidental access to a system. When security m easures are enabled, ad ministrators

    and user s can access the system on ly when they enter correct passw ord s. You can

    implement the following security m easures:

    s Enable an adm inistrator p assword, w hich is u sed to access and configure BIOS

    security options

    s Enable a user password, which can be granted full or limited access to BIOS

    s Enable secure mode, which prevents keyboard input, front panel reset access, and

    power switch access.

    s Enable a keyboard lockout timer, which after a time-out p eriod, requires a

    password to reactivate keyboard input.

    s Disable booting to alternative devices, such as diskettes and CD-ROMs

    A system s BIOS performs pow er-on self-tests (POST), provides an inter face to the

    hard ware comp onents on a system, and facilitates loading an operating system bylocating and accessing a boot loader. In addition, the BIOS provides basic security

    features.

    To access the BIOS configuration, p ress th e F2 key while the initial boot screen is

    displayed on a console. To maneuver the BIOS menu system, follow the instructions

    located at the bottom of the screen.

    Note If a BIOS adm inistrative password is defined for the system, this passwordmust first be correctly entered before access to the BIOS configuration is granted.

    If you chan ge any of the BIOS configur ation pa ram eters, you mu st reboot the system

    for the chan ges to take effect.

  • 8/6/2019 Securing SunLinux Systems Part I, Local Access and File Systems 817-3420(2003)

    14/40

    12 Securing Sun Linux Systems: Part I, Local Access and File Systems July 2003

    Restrict Access to BIOS

    You can set a user p assword, an a dm inistrator pa ssword, or both. The p asswords are

    limited to seven alpha numeric, case-sensitive characters. By default, the passwordsare not d efined, and unrestricted access is granted to the BIOS for any u ser w ith

    ph ysical access to a console.

    Setting a u ser or an adm inistrator passw ord requires:

    s Entering the password to enter BIOS setup.

    s Entering the password to boot the server if Password on Boot is enabled.

    s Entering th e passw ord to exit Secure Mod e.

    Setting both passw ords requ ires:

    s Entering the password to enter BIOS setup.

    s If entering a user p assword, the u ser may n ot be able to change some of the

    BIOS options, depend ing up on p rivilege level granted.

    s If entering an adm inistrator p assword, the ad ministrator is able to enter BIOS

    setup and access all options.

    s Entering either password to exit Secure Mode.

    Caution With physical access to a system, BIOS passwords can be reset bychanging a jumper on the motherboard.

    w To Set an Administrator Password1. Enter the BIOS menu by pressing the F2 key while the systems initial boot screen

    is displayed.

    2. Select the Security menu tab to display the security configuration menu.

    3. Select the Set Administrative Password option.

    4. Enter the new administrative password.

    5. Re-enter the new administrative password to confirm the new password.

    6. Select the Exit menu tab, then select the Exit and Save option.

    Once set, the Administrative Password param eter changes from Disabled to

    Enabled. Now the Administrative Passwordmu st be entered to access the BIOS

    configuration.

  • 8/6/2019 Securing SunLinux Systems Part I, Local Access and File Systems 817-3420(2003)

    15/40

    Securing the Console and Front Panel 13

    w To Set a User Passw ord

    1. Enter the BIOS menu by pressing the F2 key while the systems initial boot screen

    is displayed.

    2. Select the Security menu tab to display the security configuration menu.

    3. Select the Set User Password option.

    4. Enter the new user password.

    5. Re-enter the new user password to confirm the new password.

    6. Select the privilege level granted to the user:

    s No Access Prevents a u ser from accessing the BIOS configura tion. If a u ser is

    assigned to this level, the user p assword is used only to u nlock the system w hen

    it is operating in Secure Mode.

    s Limited Allows a user to access the BIOS and to change a limited number of

    non -critical fields.

    s View Only Allows a user t o access the BIOS but in r ead -only mod e. The u ser is

    not p ermitted to change any of the BIOS param eters.s Full Allows a user t o access the BIOS and change all pa ram eters, except for th e

    Administrator Password.

    7. Select the Exit menu tab, then select the Exit and Save option.

    Limit Front Panel, Keyboard , and Video AccessAfter setting th e ad ministrator pa ssword, limit access to the front p anel, keyboard,

    and video. The following ad ditional options appear on the BIOS Security menu:

    s Secure Mode Timer This timer is the period of inactivity in minutes before

    Secure Mod e is activated and the systems keyboard an d mou se are locked.

    s Secure Mode Hot Key This keyboard sequence places the system in Secure

    Mode. By default, the sequence is Control-Alt-[L], which is performed by

    holding d own the Control and Alt keys and simultaneously pressing the L key.

    s Secure Mod e Boot This setting configures th e BIOS to prevent the system from

    starting the boot process until a user or ad ministrator password is entered. A

    password is required to boot from removable med ia such as a diskette or CD-

    ROM.

  • 8/6/2019 Securing SunLinux Systems Part I, Local Access and File Systems 817-3420(2003)

    16/40

    14 Securing Sun Linux Systems: Part I, Local Access and File Systems July 2003

    s Video Blanking This setting disables the use of a video monitor when a system

    is in Secure Mode. Wh en vid eo blanking is off, the system d isplays informa tion

    on the monitor even in Secure Mode. If a monitor is disabled in addition to the

    keyboard and mou se when in Secure Mode, video blanking should be enabled.

    s Disable Power Button This setting configures the BIOS to ignore t he u se of the

    front-pan el power bu tton. When enabled, this setting p revents a runn ing system

    from being powered off using the front-panel pow er button.

    w To Set Access Options

    1. Enter the BIOS menu by pressing the F2 key while the systems initial boot screen

    is displayed.

    2. Select the Security menu tab to display the security configuration menu.

    3. Select the appropriate option, and enable or disable it.

    4. Select the Exit menu tab, then select the Exit and Save option.

    Restrict Altern ate Boot Devices

    You can u se the Sun Linux BIOS configurat ion to specify the ord er in w hich dev ices

    are polled when locating an operating system. This boot device priority selects the

    order in w hich hard-dr ives, CD-ROM drives, and disk dr ives are accessed d uring

    boot processes. It is recommended that the system be configured to boot first from

    the local hard dr ive before other m edia. This app roach can prevent a system frombeing comp romised throu gh a boot d iskette or CD-ROM inserted d uring th e boot

    process.

    w To Set Boot Device Pr iority

    1. Enter the BIOS menu by pressing the F2 key while the systems initial boot screen

    is displayed.

    2. Select the Server tab to display the server configuration menu.

    3. Select the Boot Priority menu to change the default boot priority.

    4. Select the hard drive as the first boot device.

    5. Disable any boot devices that are not required.

    6. Select the Exit menu tab, then select the Exit and Save option.

  • 8/6/2019 Securing SunLinux Systems Part I, Local Access and File Systems 817-3420(2003)

    17/40

    Securing the Console and Front Panel 15

    Restrict Access to the LILO Boot Loader

    Sun Linu x uses the LILO boot load er to load the Linux kern el. LILO allows user s to

    pass p arameters to th e kernel, several of which can be u sed to gain u nrestrictedaccess to a system (such a s single for single-user m od e). You can con figure LILO to

    require a p assword before allowing access.

    w To Configure LILO to Require a Password for

    Access

    q Add the following lines (see bold lines) to the /etc/lilo.conf file.

    In this example, the passw ord and restriction op tions are add ed to the kern el 2.4.9-

    31enterprise. In practice, there exist multiple kernel definitions or image entries in

    th e /etc/lilo.conf, often as a resu lt of kernel up grades. We recomm end that you

    define these options for each of the kernels listed in your /etc/lilo.conf file.

    Note The version num ber 2.4.9-31enterprise changes based on th e versionof the kernel running on th e system.

    Using the restricted directive in LILO allows booting of the default kernel

    without p assword v erification, but requires a password if any ad ditional arguments

    are added (such as single to boot into single-user mode) or if a kernel image other

    than the d efault is selected.

    Access to th e /etc/lilo.conf file should be restricted to only the root user,

    because the password contained in that file is in clear-text. Set this restriction by

    executing the following comm and .

    image=/boot/vmlinuz-2.4.9-31enterprise

    password=

    restricted

    label=linux

    initrd=/boot/initrd-2.4.9-31enterprise.img

    append="console=ttyS1,9600 console=tty0"read-only

    root=/dev/sda3

    # chmod go-rwx /etc/lilo.conf

  • 8/6/2019 Securing SunLinux Systems Part I, Local Access and File Systems 817-3420(2003)

    18/40

    16 Securing Sun Linux Systems: Part I, Local Access and File Systems July 2003

    After any mod ifications, you m ust ru n the comm and /sbin/lilo to propagate any

    changes to LILO. The following command is usually sufficient.

    Disable Control-Alt-Delete Reboot Key Sequence

    By default, a Sun Linux system reboots when the key combination Control-Alt-

    Delete is entered.

    w To Disable the Con trol-Alt-Delete Key Sequ ence

    1. Comment out the following line in the /etc/inittab file:

    2. Reload the inittab by either rebooting the system or by entering

    /sbin/telinit q.

    Require Single-User Mod e PasswordYou can configure the system to prom pt for a p assword wh en booted into single-

    user m ode. Add the following line to the /etc/inittab file.

    Caution It is highly recommend ed that you add a passw ord to the LILOconfiguration file instead of setting a password for single-user mode. Users can

    circumvent single-user p assword restrictions u sing the comm and linux init=/

    bin/bash instead of the linux single command at the LILO boot prom pt.

    # /sbin/lilo

    # Trap CTRL-ALT-DELETE

    # ca::ctrlaltdel:/sbin/shutdown -t3 -r now

    ~~:S:wait:/sbin/sulogin

  • 8/6/2019 Securing SunLinux Systems Part I, Local Access and File Systems 817-3420(2003)

    19/40

    Securing the Console and Front Panel 17

    Disable the Magic SysRq Key

    If enabled, the SysRq key can be used for activities such as rebooting systems,

    inspecting m emor y, synchronizing d isks, and killing processes. It is ma inly useful tokernel developers, because it allows th em to d iagnose and recover a system state

    after problems. How ever, be aware that it can be used to gain u nau thorized root

    access.

    w To Disable the Magic SysReq Key

    1. Enter the follow ing in the /etc/sysctl.conf file:

    2. Reboot the system to implement this configuration change.

    Restrict Root Access to Devices

    The Sun Linux operating system provides the ability to restrict from where a remote

    user can log into a system as root user. This restriction is an important capability to

    help promote accountability on a system. Typically, we recommend that

    adm inistrators d o not log into systems d irectly using a root account; instead they

    should log into systems u sing their unique account and assume root p rivileges as

    needed . Often th is recomm endation is combined with role-based access controlcapabilities such as sudo to further restrict w hat m ay be don e with elevated

    privileges. By following this recommendation, actions can be better associated with

    specific individuals.

    The login command is part of the authentication process to access a local Sun

    Linux account. Except for a root user, any user can log in to any valid device on a

    system, serial or virtual. A root user is not perm itted to log in to any d evice un less

    the d evice is listed in th e /etc/securetty file. If a root user a ttem pts t o log in to a

    device not listed, then the attempt fails and a failure notice is logged to the syslog

    facility.

    If you n eed to configure the system to perm it direct root login over th e prim ary

    serial interface, then add the following line to the /etc/securetty file.

    kernel.sysrq = 0

    /dev/ttyS0

  • 8/6/2019 Securing SunLinux Systems Part I, Local Access and File Systems 817-3420(2003)

    20/40

    18 Securing Sun Linux Systems: Part I, Local Access and File Systems July 2003

    Note Be sure to review the contents of the /etc/securetty file, removingany en tries that are not required. Be careful not to remove root accounts, which

    wou ld inadv ertently lock root users out of the system.

    Configuring the File System

    The default file permissions on some files might not be adequate in all situations;

    therefore, configure the Sun Linux file system to provid e add itional protection. Also,

    several mount options are available to increase security, when used effectively. Sun

    Linu x systems need some adjustment to p revent attackers from gaining sup eruser

    privileges.

    This section contains t he following top ics:

    s Review set-user-ID an d set-group-ID Files on page 18

    s

    Review World-Writable File System Objects on page 19s Review Unowned File System Objects on page 20

    Review set-user-ID and set-group-ID Files

    The set-user-ID an d set-group-ID bits (often referred to as SUID and SGID

    bits) on an executable file indicate to a system that the executable should operatewith the p rivileges of the files own er or grou p. For examp le, the effective user ID of

    the ru nning program becomes that of the executables ow ner, in the set-user-ID

    instance. Similarly, a set-group-ID file sets the running programs effective group

    ID to the executables group . If the command with th e set-user-ID and/ or set-

    group-ID bit set is written correctly with security in mind, it can be a useful

    meth od for solving some tricky operat ional challenges. These operational challenges

    can often be solved using forms of role-based access control, such as sudo. For m ore

    information on sudo, see Limit Root Access on pag e 25.

    Many set-user-ID an d set-group-ID command s have had flaws. Attackers

    have used these flaws to successfully exploit systems. When security problems are

    reported, Sun fixes them an d provides a p atch.

    Attackers might use the set-user-ID or set-group-ID command s to create

    backdoors. One way they d o this is by copying a system shell to a hid den location

    and adding the set-user-ID bit. This technique allows attackers to execute shells

    to gain elevated p rivileges (most often sup eruser).

  • 8/6/2019 Securing SunLinux Systems Part I, Local Access and File Systems 817-3420(2003)

    21/40

    Configuring the File System 19

    w To Find All set-u ser-ID an d set-group -ID Files

    1. To find all the set-user-ID and set-group-ID file s on a server, use the

    following command:

    2. Store the output to a file on another system.

    3. Compare the output against the current file system from time to time, especially

    after applying patches, to find any unwanted additions.

    Review World-Writable File System Objects

    A w orld-writable object is one th at has the w orld-write perm ission bit set. World-

    writable objects are problema tic becau se any u ser can m odify the object. An attacker

    might u se a w orld-writable file to p erform a d isk space-based d enial of service

    attack on a system, or an at tacker m ight m odify the object, violating its integrity. Werecomm end that all world-w ritable objects be catalogued and tracked over a

    systems lifecycle. Objects that do not require this setting should have their

    perm issions reset to a stronger value.

    w To Find World-Writable File System Objects

    q To find all of the world-writable files and directories on a system, use the

    following command.

    Note All world-writable directories should be configured with the sticky bit toprev ent user s from d eleting files owned by oth er users. For more inform ation on this

    capability, refer to t he chmod(1) manu al page.

    # find / -type f \( -perm -u+s -o -perm -g+s \) -ls

    # find / \(-type f -o -type d \)-perm -0002 -ls

  • 8/6/2019 Securing SunLinux Systems Part I, Local Access and File Systems 817-3420(2003)

    22/40

    20 Securing Sun Linux Systems: Part I, Local Access and File Systems July 2003

    Review Unowned File System Objects

    Typ ically, file system objects stored on a system can be d irectly attr ibuted to a u ser

    and group that exists either on the system or in a nam ing service (for example,LDAP) used by the system. It is possible for a user or group to be removed from a

    system, leaving file system objects in an unowned state. That is, the files and

    directories are now ow ned by a user or grou p th at no longer exists on the system.

    This situation can also occur when extracting archives (for example, tar) built on a

    different system. These programs can be configured to preserve the original objects

    own ership an d perm issions of the archived objects. These program s restore the

    settings w ithout regard to w hether the u ser or group assigned to the object actually

    exists on the n ew system.

    w To Find Unowned File System Objects

    1. To find all file system objects that are not owned by a valid user on a system, use

    the command:

    2. To find all file system objects that are not ow ned by a valid group on a system, use

    the following command:

    Note In general, all file system objects on a system should be assigned to a validuser and group . Be sure to assign a valid u ser or group to any files found using the

    previous comm ands.

    # find / -nouser -ls

    # find / -nogroup -ls

  • 8/6/2019 Securing SunLinux Systems Part I, Local Access and File Systems 817-3420(2003)

    23/40

    Managing Accounts 21

    Managing Accounts

    Managing u ser and system accounts is an importan t aspect of Sun Linu x security.

    Some system accounts m ight need to be d eleted or m odified. The time-based

    command execution system tools cron an d at might need to be configured to

    restrict user access.

    This section contains the following t opics:

    s Delete and Modify System Accounts on page 21

    s Restrict at, cron, and batch Comm and Access on page 24

    s Limit Root Access on page 25

    s Use the Pluggable Authentication Modu le (PAM) on p age 27

    Delete and Modify System Accounts

    A default Sun Linux installation contains several accounts that either need to be

    deleted or modified to strengthen security. Some accounts are not necessary for

    norma l system op eration. These accounts includ e games, gopher, and news and

    uucp. Some of these accounts exist to support software subsystems that are not used

    or are for backwards compatibility.

    w To Delete Accou ntsq To de lete accounts in /etc/passwd and /etc/shadow entries, use the userdel

    command, simi lar to the follow ing example:

    This example removes the /etc/passwd an d /etc/shadow entries for user games.

    Except for the root accoun t, modify any remaining system accounts for ad ded

    security by locking them, setting account exp iration, or setting their login shells to a

    restricted value.

    # /usr/sbin/userdel games

  • 8/6/2019 Securing SunLinux Systems Part I, Local Access and File Systems 817-3420(2003)

    24/40

    22 Securing Sun Linux Systems: Part I, Local Access and File Systems July 2003

    w To Lock Accounts

    q To lock unused accounts that are not locked by defaul t, use the passwd -1 option.

    For example, if the uucp account is not used, then lock it using the foll ow ingcommand.

    The password of the account is changed to a string that can never be a v alid

    encrypted password.

    w To Expire an Accou nt

    q To schedule a u ser account to expire, use the fol low ing command:

    An expired account has similar characteristics to those of an account w here the

    password is locked . The accoun t can still be accessed by root via sup eru ser, da emon s

    can be started , and files and d irectories can be own ed by the account . As with locked

    accounts, expired accounts cannot be used to login to a system or to access any of

    the services wh ere au then tication is required , such as Telnet, FTP, or IMAP.

    To disable interactive access to a user account, use the following command.

    An account with a disabled shell (one that is not listed in /etc/shells and does

    not p erm it access to the system) only impa cts app lications tha t check for valid sh ells,

    such a s Telnet, FTP, and Secure Shell. This method d oes not im pact oth er

    app lications such as IMAP and POP that by d efault d o not check this setting.

    A better alternative to using /bin/false as a d isabled shell is to use a program

    that n ot only p revents access to the system bu t also logs the attempted access. The

    following shell script could be used to imp lement su ch functionality. This examp le is

    #passwd -l

    # /usr/sbin/usermod -e YYYY-MM-DD

    # usermod -s /bin/false

  • 8/6/2019 Securing SunLinux Systems Part I, Local Access and File Systems 817-3420(2003)

    25/40

    Managing Accounts 23

    based on the file /sbin/noshell program available from the Solaris Security

    Toolkit software. For m ore inform ation on the Solaris Security Toolkit software, refer

    to http://www.sun.com/security/jass.

    To change d efault account p arameters u sed d uring n ew account creation (via

    useradd), change the following values in either the /etc/login.defs or the

    /etc/default/useradd file.

    TABLE 1 describes the param eters in the /etc/login.defs file.

    TABLE 2 describes the param eters in the /etc/default/useradd file.

    #!/bin/sh

    #

    trap "" 1 2 3 4 5 6 7 8 9 10 12 15 19

    PATH=/bin:/usr/bin

    export PATH

    HNAME="uname -n"UNAME="id | awk { print $1 }"

    logger -i -p auth.crit "Unauthorized access attempt on ${HNAME} by

    ${UNAME}"

    wait

    exit

    TABLE 1 /etc/login.defs File Param eters

    Parameter Description

    PASS_MIN_DAYS Minimum days allowed between password changes

    PASS_MIN_LEN Minimum acceptable password length

    PASS_WARN_AGE Days warn ing given before a password expires

    PASS_MAX_DAYS Maximum d ays a password may be used

    TABLE 2 /etc/default/useradd File Param eters

    Parameter Description

    GROUP Default group

    HOME Default user h ome location

  • 8/6/2019 Securing SunLinux Systems Part I, Local Access and File Systems 817-3420(2003)

    26/40

    24 Securing Sun Linux Systems: Part I, Local Access and File Systems July 2003

    Restrict at, cron, and batch Command Access

    The at, cron, and batch commands execute processes (events) at a specified future

    time. Access control files are stored in the /etc directory.

    s The cron.deny an d cron.allow files manage access to the cron command.

    s The at.deny and at.allow files manage the access to the at an d batch

    commands.

    The allow files are checked first to determine if an account is explicitly allowed to

    use these facilities.

    Attackers can use these commands to implement logic bombs (triggered by a systemcondition, logic that causes d amage to da ta p rocessing systems) or other

    program med attacks that begin in the futu re. Unless administrators examine every

    at, batch, and cron event, tracking u sage and abu se can be difficult. Therefore, we

    recomm end that you restrict access to the at, batch, and cron command s to

    prevent attacks and abuse.

    By default, Sun Linux includes scheduled cron events for the root account. Do not

    include the root account in the deny files, because any scheduled jobs will beprevented from running.

    Ad d to the den y files any ad ditional system or software-specific accounts that d o not

    require cron, batch, o r at access.

    You m ight want to restrict user access to these comm and s as well. List individ ua l

    user accounts in the deny files. To restrict all user account access, create an empty

    allow file, then add only the accounts that need access.

    EXPIRE Expiration d ate of an account in th e forma t YYYY-MM-DD

    INACTIVE Maximum days after an unchanged and expired password that the

    account is locked ou t and can only be accessed by root

    SHELL Default shell

    TABLE 2 /etc/default/useradd File Param eters (Continued)

  • 8/6/2019 Securing SunLinux Systems Part I, Local Access and File Systems 817-3420(2003)

    27/40

    Managing Accounts 25

    Limit Root Access

    The sudo program implements a form of role based access control (RBAC). It is a

    comm only used tool for limiting access to pr ivileged comm and s and accounts. Usingsudo has the following benefits:

    s sudo is configured by default to ask for a u sers password

    s Fewer u sers need to log in as privileged u sers and know the passw ord

    s Access to privileged commands is determined by a policy; users are given access

    only to the comm and s they need

    s Access to p rivileged comm and s can be logged

    Common uses for sudo are allowing system op erators to make backups an d create

    user a ccounts withou t giving op erators full root access.

    To create a new account, an operator enters:

    It is very importan t to ensure that m ail to root is checked or forward ed.Unau thorized use ofsudo genera tes an email to the root user and creates an entry in

    the system log /var/log/messages file.

    To review valid uses ofsudo, refer to /var/log/secure . In the following examp le,

    th e sudo command was used by the user joe to access the /bin/bash command as

    root.

    The sudo command consults the /etc/sudoers configur ation file to deter mine if a

    comm and is allowed . This configura tion file contains access control lists (ACLs) as in

    the following example.

    # sudo useradd newuser

    May 4 18:25:14 scl1 sudo(pam_unix)[28769]: authentication

    failure; logname=attackerid uid=0 euid=0 tty=pts/2 ruser= rhost=

    user=attackerid

    May 4 18:25:28 scl1 sudo: sudoerid: TTY=pts/2 ; PWD=/home/

    sudoerid/joe ; USER=root ; COMMAND=/bin/bash

    = ( ) [, ]

  • 8/6/2019 Securing SunLinux Systems Part I, Local Access and File Systems 817-3420(2003)

    28/40

    26 Securing Sun Linux Systems: Part I, Local Access and File Systems July 2003

    A ru le of this form allows user logged in to hostname to run command as user

    account. By including the hostname in the rule, it is possible to share a single

    /etc/sudoers file between mu ltiple m achines. For m ore information about the

    format of these ACLs, refer to the sudoers manual page.

    Use the visudo command to edit the /etc/sudoers file. This comm and checks the

    syntax of edited contents before overwriting /etc/sudoers. If the /etc/sudoers

    syntax is incorrect, sudo does not work.

    To keep the description concise, you can define aliases for sets of users, hostnames,

    and comm and s. You can use the alias ALL in any field. In th e following exam ple, we

    allow a grou p of operators to make backups and restore them.

    Be aw are that w ith a little creativity, any user w ho can m ake backups an d restore

    them can gain root access, so this example is not a completely secure setup. Ingeneral, we advise that you create scripts or programs that wrap commands

    executed with privilege to limit the options available to its users. In addition, these

    scripts can sanitize the execution environment by checking or resetting variables

    such as a user s path to help en sure sane settings. This wa y, the use of p rivileged

    command s can be better controlled.

    You can configure sudo to allow only certain par ameters to be p assed to p rivileged

    command s. Verify that op erators cannot pass an y argum ents to privilegedcommand s that have u nintended consequences. The following ru le allows operators

    to change p asswords for all users except for root.

    The previous example p revents execution of the sudo passwd root command.

    However, it does allow execution of the sudo passwd --stdin root command. In

    this case, you can fix the problem by chang ing the d efinition ofPASSWDCMD slightly,

    as in the next example.

    # provide access to dump and restore for backup operators

    User_Alias OPERATORS = tom, dick, harriet

    Cmnd_Alias BACKUPCMD = /sbin/dump, /sbin/restore

    OPERATORS ALL = (root) BACKUPCMD

    # User alias specification

    User_Alias OPERATORS = tom, dick, harriet

    # Cmnd alias specification

    Cmnd_Alias PASSWDCMD = /usr/bin/passwd, !/usr/bin/passwd root# Defaults specification

    OPERATORS ALL = (root) PASSWDCMD

  • 8/6/2019 Securing SunLinux Systems Part I, Local Access and File Systems 817-3420(2003)

    29/40

    Managing Accounts 27

    The following example allows two classes of users (web masters an d operators) to

    man age a system. Web masters can stop an d start a w eb server. Operators can

    change forgotten u ser passw ords (except for root p asswords), start system backups,

    and perform web master duties.

    Use the Pluggable Authentication Module (PAM)The Pluggable Auth entication Mod ule (PAM) architecture allows ad ministrators to

    control and rep lace the m ethods u sed for au thentication. In concept, wh ile this is

    similar to the PAM functionality that is available in the Solaris OE, note that there

    are d ifferences.

    For more information on the Solaris OE implementation of PAM, refer to the Sun

    BluePrints OnLine two-part article titled Extending Authentication in the Solaris 9

    OE Using Pluggable Authentication Modules (PAM).

    s Part I: http://www.sun.com/blueprints/0902/816-7669-10.pdf

    s Part II: http://www.sun.com/blueprints/1002/816-7670-10.pdf

    Although PAM m akes auth entication operations m ore robust, it requires that system

    authen tication information be m aintained in m ore places than just /etc/passwd

    an d /etc/shadow. PAM can be expanded to support Kerberos, LDAP, OPIE, S/ Key,

    RSA SecureID, RADIUS, TACACS+, and ot hers. Un der stand ing h ow the PAM

    system functions is essential for maintaining the security of a system.

    # User alias specification

    User_Alias OPERATORS = tom, dick, harriet

    User_Alias WEBMASTERS = josephine, OPERATORS

    # Cmnd alias specification

    Cmnd_Alias PASSWDCMD = /usr/bin/passwd [!-]*, !/usr/bin/passwd

    root

    Cmnd_Alias BACKUPCMD = /usr/sbin/backup_script

    Cmnd_Alias HTTPDCTL = /etc/rc.d/init.d/httpd

    # Defaults specification

    Defaults authenticate, timestamp_timeout = 60

    # User privilege specification

    root ALL=(ALL) NOPASSWD: ALL

    OPERATORS ALL = (root) PASSWDCMD

    OPERATORS ALL = (root) BACKUPCMD

    WEBMASTERS ALL = (root) HTTPDCTL

  • 8/6/2019 Securing SunLinux Systems Part I, Local Access and File Systems 817-3420(2003)

    30/40

    28 Securing Sun Linux Systems: Part I, Local Access and File Systems July 2003

    All primary ap plications such as login, su, ssh, and sudo are PAM aware. Each

    app lication that uses PAM d oes so through a common API that references the

    general configuration file /etc/pam.conf or th e ap plication-specific file in the

    directory /etc/pam.d/, if it exists.

    Note If the directory /etc/pam.d/ exists, the file /etc/pam.conf is ignored.The directory /etc/pam.d/ is part of the standard Sun Linux installation.

    Caution Before editing PAM configuration files, make a backup of the files. Errorsmade in configuration files can prevent PAM or the service you modified from

    operating correctly, and might prevent privileged users from logging in. Also, youcould inadvertently disable authentication and expose the system. Do not change the

    default ow nership or file perm issions of the /etc/pam.d/ directory or its contents.

    Within the PAM configurat ion file, define meth od s for auth entication. Enter on e line

    per m ethod u sing the following format.

    [service] [type] [control]

  • 8/6/2019 Securing SunLinux Systems Part I, Local Access and File Systems 817-3420(2003)

    31/40

    Managing Accounts 29

    TABLE 3 lists the values for entering au thentication m ethods.

    For additional information on PAM, refer to the Linux PAM site at http://

    www.kernel.org/pub/linux/libs/pam/, the pam(8) manu al pages, and the

    PAM d ocumentation in /usr/share/doc/pam .

    After editing the configuration file, test the changes and make any necessaryadjustments.

    TABLE 3 PAM Configuration Values

    Field/Value Description

    service This field exists on ly if the /etc/pam.conf file is used and is the

    nam e of the service defined, such as login or su. If the file is in

    /etc/pam.d/ and is specific to the ap plication, then it is not u sed.

    type This field is the m anagemen t group and can be one of the following:

    account - Verify that the account is valid. For example: has the

    account expired?

    authentication - Verify the users identity by using apassw ord, smart card, or biometric device.

    password - Maintain the authentication method. For example: if

    the password has expired, prompt for a new one.

    session - Provide m ethods th at are performed before the

    session is started an d after the session is ended, such as setting

    up and reclaiming resources the user requires.

    control This field specifies wha t to d o w hen a mod ule fails its task:

    requisite - Imm ediate termination of the auth entication

    process; do n ot call add itional mod ules.

    required - If this modu le fails, then allow other m odu les to be

    called, but ultimately fail the auth entication attemp t. Each

    required m odu le must succeed for the au thentication to succeed.

    sufficient - Success of the mod ule is enough to succeed in

    authentication.

    optional - Success or failure of this mod ule is imp ortan t if it is

    the only mod ule in the stack associated w ith this service an d

    type.

    More complex control syntax can be u sed; refer to th e pam(8)

    manu al page.

    module-path This path is the full file name of the au thentication m odu le called

    with the default location /lib/security/. A special mod ule used

    by many configuration files is pam_stack. This modu le lets you

    call a service from inside the stack. This feature allows multiple

    services to include a system-wide configuration, so that it only

    needs to be ma intained in one p lace. The most comm on use for this

    feature is the configuration file /etc/pam.d/system-auth .

    module-arguments Valid argum ents are space-separated lists of tokens that m odify

    behavior of the mod ule called. They are m odu le specific.

  • 8/6/2019 Securing SunLinux Systems Part I, Local Access and File Systems 817-3420(2003)

    32/40

    30 Securing Sun Linux Systems: Part I, Local Access and File Systems July 2003

    Note If you lock yourself out of a system, reboot into single-user mode, thenrestore the configuration file from the backup.

    Disabling Null Passwords

    A nu ll passw ord allows users to log onto a system withou t having to first supp ly a

    valid password string. When u sers have null password s, they can p ress the Enter

    key when p romp ted for a password and gain access to systems without a password .

    Obviously, this poses a significant security risk to the system and to the

    accountability of actions performed by users.

    w To Disable Null Passwords

    q Make a backup of the /etc/pam.d/system-auth file, then modify the original

    by removing nullok from the line, resulting in the follow ing:

    Checking Passwords Against a Dictionary

    Sun Linux can be configured to verify that passwords cannot be guessed easily. On

    Sun Linux, this check is performed by the m odu le /lib/security/

    pam_cracklib.so . It checks to ensure that password s are a minimum length and

    verifies that a p assword does not occur in a d ictionary.

    The dictionary u sed by th is modu le is located in /usr/lib and is in cracklib

    format. By default, each of the dictionary files is prefixed with the file name

    cracklib_dict. For m ore information on cracklib including how to add new

    words to the dictionary, refer to http://www.crypticide.org/users/alecm/.

    This mod ule has a nu mber of param eters, the most u seful of which are as follows.

    auth sufficient /lib/security/pam_unix.so likeauth

    TABLE 4 pam_cracklib Parameters

    Parameter Description

    minlen Specifies the minimum password length allowed for an account

    difok Specifies the minimu m num ber of characters that have to d iffer from th e

    previous password

  • 8/6/2019 Securing SunLinux Systems Part I, Local Access and File Systems 817-3420(2003)

    33/40

    Managing Accounts 31

    w To Check Passwords

    q Add the following parameters to an entry in /etc/pam.d/system-auth,

    resulting in the following single line:

    Preventing Reuse of Old Passwords

    The PAM m odu le pam_unix.so can be configured to maintain a list of oldpassw ords for every u ser, to prohibit the reuse of old password s. The list /etc/

    security/opasswd is not maintained as p lain text, but shou ld be protected the

    same as shadow password files. This capability is often referred to a s passw ord

    history.

    w To Retain a List of Passw ord s

    q To remember the l ast 15 passwo rds, add the follo wing line in /etc/pam.d/system-auth file:

    Preventing Password Guessing

    The module pam_tally keeps track of u nsuccessful login attemp ts, and disables

    user accounts (not user IDs) when a preset limit is reached. This capability is often

    referred to as account lockout.

    w To Prevent Password Guessing

    q Add two entries in the /etc/pam.d/system-auth file:

    password required /lib/security/pam_cracklib.so retry=3 type=

    minlen=8 difok=3

    password sufficient /lib/security/pam_unix.so use_authtok

    md5 shadow remember=15

    auth required /lib/security/pam_tally.so onerr=fail

    no_magic_root

    account required /lib/security/pam_tally.so deny=5

    no_magic_root reset

  • 8/6/2019 Securing SunLinux Systems Part I, Local Access and File Systems 817-3420(2003)

    34/40

    32 Securing Sun Linux Systems: Part I, Local Access and File Systems July 2003

    Because the order of the lines in /etc/pam.d/system-auth is important, w e list

    the complete file contents.

    Monitoring System Activity

    Examine all of the log files regularly for errors, warnings, and signs of an attack.

    This task can be autom ated by using log analysis tools or a simple grep command.

    Sun Linux includes an autom atic log analysis and repor ting tool named logwatch.

    This tool sends nightly em ail reports to a root u ser. The em ail add ress can be

    changed by editing the /etc/log.d/conf/logwatch.conf file. Logw atch is of

    limited use from a security perspective, because it does not constantly monitor for

    unusual activity.

    The syslog daemon receives log messages from several sources and directs them tothe appropriate location based on the configured facility and priority. The

    programmer interface syslog() and system command logger are available for

    creating log messages. The facility or application type and the priority are

    configured in the /etc/syslog.conf file to forward log messages t o specified

    locations. The location can be a log file, network h ost, selected u sers, or all users.

    auth required /lib/security/pam_env.soauth required /lib/security/pam_tally.so onerr=fail

    no_magic_root

    auth sufficient /lib/security/pam_unix.so likeauth

    auth required /lib/security/pam_deny.so

    account required /lib/security/pam_unix.so

    account required /lib/security/pam_tally.so deny=5

    no_magic_root reset

    password required /lib/security/pam_cracklib.so retry=3

    type= minlen=8 difok=3

    password sufficient /lib/security/pam_unix.so use_authtok

    md5 shadow remember=15

    password required /lib/security/pam_deny.so

    session required /lib/security/pam_limits.so

    session required /lib/security/pam_unix.so

    d f l S i d fi l l fil i h / / fil

  • 8/6/2019 Securing SunLinux Systems Part I, Local Access and File Systems 817-3420(2003)

    35/40

    Monitoring System Activity 33

    By d efault, Sun Linu x defines several log files in the /etc/syslog.conf file:

    s The /var/log/messages log file contains a majority of the system messages.

    s The /var/log/maillog file contains mail system messages.

    s The /var/log/secure log file contains a m ajority of the security m essages fromsudo an d ssh.

    If you change the /etc/syslog.conf file, the syslog daemon must be restarted.

    Use the following command .

    In addition to logging syslog events locally on each client system, Sun recomm end s

    that syslog events be sent to a centralized log server w here logs can be more safely

    stored and analyzed. As an a dd ed benefit, by logging events to a central location,

    logs may be m ore readily preserved in the event that th e client system is

    compromised.

    Note that syslog monitoring is just a single process. Sun recomm ends that u sers

    protect their environments through architectures that implement defense-in-depth

    through mu tually reinforcing, complementary security controls. The m ethodology

    for determining wh ich controls are most approp riate to your en vironment and

    wh ere they should be positioned in your architecture is outside th e scope of this

    article.

    Add itional layered m onitoring m ethods su ch as p eriodic-vulnerability assessments,

    file system integrity monitoring, and host-based intrusion detection mechanisms can

    greatly improve your ability to detect attemp ted or actual breaches of security

    wh ereas a single method might be m ore easily subverted.

    # killall -HUP syslogd

  • 8/6/2019 Securing SunLinux Systems Part I, Local Access and File Systems 817-3420(2003)

    36/40

    34 Securing Sun Linux Systems: Part I, Local Access and File Systems July 2003

    References and Related Resources

    Publications

    s Extending Authentication in the Solaris 9 OE Using Pluggable Authentication

    Mod ules (PAM).

    Part I: http://www.sun.com/blueprints/0902/816-7669-10.pdf

    Part II: http://www.sun.com/blueprints/1002/816-7670-10.pdf

    s Hatch, Brian, and Osborne, James Lee. Hacking Linux Exposed, Second Edition

    McGraw-Hill, ISBN: 0072225645, Novem ber 2002.

    s Nemeth , Evi, Snyd er, Garth , Seebass, Scott, and Hein , Trent R. UNIX System

    Administration Handbook, 3rd Edition , Pren tice H all PTR, ISBN: 0130206016,

    Au gu st 2000.

    s

    Noord ergraaf, Alex. Solaris Op erating Environment Netw ork Settings forSecurity: Updated for Solaris 9 Operating Environment, Sun BluePrints OnLine,

    June 2003, http://www.sun.com/solutions/blueprints/0603/816-

    5240.html.

    s Noordergraaf, Alex and Watson, Keith. Solaris Operating Environment Security:

    Updated for the Solaris 9 Operating Environment, Sun BluePrints OnLine,

    December 2002, http://www.sun.com/solutions/blueprints/1202/816-

    5242.pdf.

    s Reid, Jason. Building Op enSSH - Tools and Trad eoffs, Sun BluePrint s On Line,January 2003, http://www.sun.com/blueprints/0103/817-1307.pdf.

    s Reid, Jason. Con figur ing th e Secure Shell Softw are, Sun BluePrints O nLine,

    April 2003, http://www.sun.com/blueprints/0403/817-2485.pdf.

    s Reid, Jason. Integr ating the Secure Shell Software, Sun BluePrint s On Line, May

    2003, http://www.sun.com/blueprints/0503/817-2821.pdf.

    s Red Hat Linux 9: Red Hat Linux Security Guide, Red Hat Inc., 2002.

    s Stevens, Richard W. TCP/IP Illustrated, Volume 1, 1st Edition, Ad d ison-WesleyPu blishing Company, ISBN: 0201633469, January 1994.

    W b Sit

  • 8/6/2019 Securing SunLinux Systems Part I, Local Access and File Systems 817-3420(2003)

    37/40

    About the Authors 35

    Web Sites

    Note Sun is not responsible for the availability of third -party Web sites men tioned

    in this docum ent. Sun does not end orse and is not responsible or liable for anycontent, advertising, prod ucts, or other m aterial on or available from such sites or

    resources. Sun will not be responsible or liable for an y d amage or loss caused or

    alleged to be caused by or in conn ection with u se of or reliance on any such conten t,

    goods, or services that are available on or throu gh an y such sites or resources.

    s Center for Intern et Security - Linux Benchm arkhttp://www.cisecurity.org/

    s OpenSSH tool: http://www.openssh.com/

    s Sendm ail Consortium: sendmail configuration information, http://

    www.sendmail.org/

    s SSH Communications Security, Secure Shell (SSH) tool: http://www.ssh.com/

    s Sun BluePrints: http://www.sun.com/blueprints

    s TCP Wrapp ers tool, Wietse Venem a: ftp://ftp.porcupine.org/pub/

    security/index.html

    About the Authors

    Glenn Brunette

    Glenn Brunette is a Sun Principal Engineer with over a decade of experience in

    information security. Glenn works in the Sun Professional Services division as the

    Am ericas Lead Security Architect. In th is role, he is respon sible for the d evelopm ent

    and execution of the regions security services strategy. He works with teams

    throughout the Americas and the world to improve the quality and security of

    services delivered to Suns customers.

    Previously, Glenn w orked in th e Nor th East and Finan cial Services Areas developing

    and delivering a wide array of tailored security solutions supporting the lifecycle of

    assessment, architecture, imp lementation, and m anagemen t. His customers have

    included major financial services firms, service providers, and life sciences and

    govern men t organizations. In add ition to contract services, Glenn w orks closely with

    teams across Sun on the development and delivery of security strategy,

    methodologies, best practices, training, and tools. Glenn is a co-founder of the very

    popular freeware Solaris Security Toolkit software Glenn is a Certified Information

  • 8/6/2019 Securing SunLinux Systems Part I, Local Access and File Systems 817-3420(2003)

    38/40

    36 Securing Sun Linux Systems: Part I, Local Access and File Systems July 2003

    popular freeware Solaris Security Toolkit software. Glenn is a Certified Information

    Systems Security Professional (CISSP) and has been trained in the N ational Secur ity

    Agencys INFOSEC Assessmen t Method ology (IAM).

    Michael H ullhorst

    Michael Hullhorst is a Staff Engineer working within Sun Microsystems as a Lead

    Security Architect and evangelist for the Sun Linux Security Group. The group is

    responsible for driving security into Suns Linux products.

    An engineer w ith three decades of system developm ent experience, Michael has

    worked in the capacity of Director of Engineering for Progressive Systems,

    developing Linu x based security produ cts including the Phoenix Adaptive Firewall

    App liance. Further, Michael has been an ind epend ent consultant with a w ide range

    of experience including the d evelopm ent of complex app lications and networks, as

    well as w orking w ith embed ded systems. Additionally, Michaels background

    includes being the Director of Information Systems for a large telecommunication

    provisioning group .

    Michael has been trained in the National Security Agencys INFOSEC AssessmentMethodology (IAM).

    G Weijers

    G Weijers is a staff engineer working for the Sun Linux Security Group in

    Colum bus, Oh io. He specializes in Security Engineering, the constru ction of systems

    that perform th eir intend ed function in a depend able way.

    Recently G worked on the design and delivery of software tha t redu ces the

    vulnerability of Linux-based Sun p rodu cts to network-based attacks, and he worked

    on the d evelopm ent of new initiatives within Sun to improve the security of Sun

    products.

    Prior to Sun, G worked for Progressive Systems, Inc. of Colum bus, Ohio. The main

    prod uct wa s the Phoenix Adaptive Firewall Appliance. He d esigned the

    cryptographic tools used to allow secure remote configuration of firewalls using a

    user interface based on Java technology.

    Some of G's professional interests are security engineering, cryptography, protocol

    design, and provable security.

  • 8/6/2019 Securing SunLinux Systems Part I, Local Access and File Systems 817-3420(2003)

    39/40

    Ordering Sun Documents 37

    Ord ering Sun Documents

    The SunDocsSM program provides m ore than 250 man uals from Sun Microsystems,

    Inc. If you live in the United States, Canada, Europe, or Japan, you can purchase

    documentation sets or individual manuals through this program.

    Accessing Sun Documentation OnlineThe docs.sun.com web site enables you to access Sun technical documentation

    online. You can brow se the docs.sun.com archive or sea rch for a sp ecific book title

    or subject. The URL is http://docs.sun.com/

    To reference Sun BluePrin ts On Line articles, visit the Sun BluePrints OnLine Web

    site at: http://www.sun.com/blueprints/online.html

  • 8/6/2019 Securing SunLinux Systems Part I, Local Access and File Systems 817-3420(2003)

    40/40

    38 Securing Sun Linux Systems: Part I, Local Access and File Systems July 2003


Recommended