Shadow File Problems

In this example, we report shadow file problems.

The ShadowFileProblems script might send an alert message like the following:

                                PIKT ALERT
                         Tue Nov 25 11:53:05 2003
                                  kiev2

URGENT:
    ShadowFileProblems
        Report /etc/shadow file problems

        User smetana has NO PASSWORD!

The script follows.

ShadowFileProblems

        init
                status =piktstatus
                level =piktlevel
                task "Report /etc/shadow file problems"
                input file "=shadow"
                seps ":"
                dat $username [1]
                dat $password [2]
                keys $username

        begin
                set #crisis = #false()
#ifdef page
		set $pagemsg = "$hostname() urgent shadow problem (see alert email)"
#endifdef

        rule
                if #length($password) == 0
                        output mail "User $username has NO PASSWORD!"
                        output syslog "User $username has NO PASSWORD!"
                        if $username eq "root"
                                set #crisis = #true()
                        endif
                endif

#  ifdef page
        end
                if #crisis
#    if missioncritical
                        =page($pagemsg, =pagesysadmins, =allhours(#now()))
#    else
                        =page($pagemsg, =pagesysadmins, ! =offhours(#now()))
#    endif
                endif
#  endifdef

This is just one program example.  You could add rules, or write new scripts, for example to report:  frozen (starred out) accounts, password changes for certain key accounts, missing fields, malformed lines, violations of expiration rules, etc.

For more examples, see Samples.

 
Home | FAQ | News | Intro | Samples | Tutorial | Reference | Software
Developer's Notes | Licensing | Authors | Pikt-Users | Pikt-Workers | Related Projects | Site Index | Privacy Policy | Contact Us
Page best viewed at 1024x768 or greater.   Page last updated 2019-01-12.   This site is PIKT® powered.
Copyright © 1998-2019 Robert Osterlund. All rights reserved.
Home FAQ News Intro Samples Tutorial Reference Software
PIKT Logo
PIKT Page Title
View sample
passwd file
problems
Pikt script