;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Copyright 2002 Routrek Networks,Inc. All rights reserved ; Solaris definition ; Version 0.1 ; $RCSfile: TargetSolaris.txt,v $ ; $Revision: 1.7 $Date: 2003/04/16 09:04:40 $ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; RMC configuration example: ; ; copy terminal running-config (then paste this file.) ; set port comN ; set tartget-type solaris ; set target-login-name ("root" if not set) ; set target-login-password ; set target-check ; set network-info-time ; set connect-log ; set spy comN tfl0 ml0 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Note: ; ; To enable to use serial console, see the following : ; 1. Connect a keyboard and a display to Sun workstation. ; 2. Connect the COM port of Sun and RMC. ; 3. Boot RMC. ; 4. Turn on Sun workstation. ; ; To enable syslog to serial console, see the following example: ; 1. add the following lines to the /etc/syslog.conf ; *.err;kern.notice;auth.notice /dev/msglog ; (The character in front of the '/dev/msglog' is a TAB.) ; 2. reload syslog.conf to syslogd (eg. /etc/init.d/syslogd restart) ; 3. execute command 'consadm -a /dev/term/a ; consadm -p -a /dev/term/a' ; on command line of Solaris server. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; set user-target-type solaris ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; set target-filter solaris tfl0 # syslog filter for Solaris # $Revision: 1.7 $ $Date: 2003/04/16 09:04:40 $ # All syslog message /[A-Z][a-z][a-z] [0-9]+ [0-9:]+ [a-zA-Z][^ ]+ +[^ :]+:/ ----END OF FILTER---- ; set target-filter solaris tfl1 # syslog filter for Solaris # $Revision: 1.7 $ $Date: 2003/04/16 09:04:40 $ # High severity : emergency, alert, critical /[A-Z][a-z][a-z] [0-9]+ [0-9:]+ [a-zA-Z][^ ]+ +[^ :]+: +\[ID +[^ ]+ +[^ \.]*\.(emerg|alert|crit)/ ----END OF FILTER---- ; set target-filter solaris tfl2 # syslog filter for Solaris # $Revision: 1.7 $ $Date: 2003/04/16 09:04:40 $ # Middle severity : error, warning, notification /[A-Z][a-z][a-z] [0-9]+ [0-9:]+ [a-zA-Z][^ ]+ +[^ :]+: +\[ID +[^ ]+ +[^ \.]*\.(error|warning|notice)/ ----END OF FILTER---- ; set target-filter solaris tfl3 # syslog filter for Solaris # $Revision: 1.7 $ $Date: 2003/04/16 09:04:40 $ # Low severity : information, debugging /[A-Z][a-z][a-z] [0-9]+ [0-9:]+ [a-zA-Z][^ ]+ +[^ :]+: +\[ID +[^ ]+ +[^ \.]*\.(info|debug)/ ----END OF FILTER---- ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; set target-script solaris login # Login script for Solaris. # $Revision: 1.7 $ $Date: 2003/04/16 09:04:40 $ # 'set target-login-name' should be set or "root" is used # Send [enter] and wait login prompt. login_loop: send "" expect { "$ " exit 0 "# " exit 0 "login:" goto login "assword:" goto login_loop timeout 10 goto error } # Send login name login: ! test "$TARGET_LOGIN_NAME" if $? = 0 send $(TARGET_LOGIN_NAME) if $? != 0 send "root" expect { "assword:" goto password timeout 10 goto error } # Send password password: send $(TARGET_LOGIN_PASSWORD) expect { "$ " exit 0 "# " exit 0 "incorrect" goto password_error timeout 20 goto error } password_error: exit 3 error: exit 1 ----END OF SCRIPT---- ; set target-script solaris command # command script for Solaris verbose off call login timeout 240 verbose on # if "show version" command then it is for checking target type ! test "`sendcmd -t`" = "show version" if $? != 0 goto loop print "" print "---start command result---" print "---show version---" send "uname -a" gosub wait_prompt goto logout # Command loop loop: # send a command one by one ! sendcmd if $? != 0 goto logout gosub wait_prompt goto loop wait_prompt: expect { "$ " goto wait_interval "# " goto wait_interval "assword:" goto sudo_password timeout 120 goto error } # Wait 2 sec interval to confirm prompt wait_interval: expect { timeout 2 return } goto wait_interval sudo_password: send $(TARGET_ENABLE_PASSWORD) goto wait_prompt logout: verbose off send "exit" expect { "$ " goto logout "# " goto logout "login:" exit 0 timeout 20 goto error } error: exit 1 ----END OF SCRIPT---- ; set target-script solaris target-check # target-check script for Solaris # set target-script solaris target-check ! test $ARG1 if $? != 0 goto normal_check call login timeout 600 send "su" wait_prompt: expect { "$ " goto error "# " break "assword:" goto sudo_password timeout 120 goto logout_error } send "/usr/bin/ps -e | /usr/bin/grep \c" send $(ARG1) expect { $(ARG1) break timeout 5 goto logout_error } expect { $(ARG1) break timeout 15 goto logout_error } ! test $ARG2 if $? != 0 goto logout_normal send "/usr/bin/ps -e | /usr/bin/grep \c" send $(ARG2) expect { $(ARG2) break timeout 5 goto logout_error } expect { $(ARG2) break timeout 15 goto logout_error } ! test $ARG3 if $? != 0 goto logout_normal send "/usr/bin/ps -e | /usr/bin/grep \c" send $(ARG3) expect { $(ARG3) break timeout 5 goto logout_error } expect { $(ARG3) break timeout 15 goto logout_error } ! test $ARG4 if $? != 0 goto logout_normal send "/usr/bin/ps -e | /usr/bin/grep \c" send $(ARG4) expect { $(ARG4) break timeout 5 goto logout_error } expect { $(ARG4) break timeout 15 goto logout_error } logout_normal: set r 0 goto logout logout_error: set r 1 goto logout logout: send "exit" expect { "$ " goto logout "# " goto logout "login:" break timeout 20 goto error } if r = 0 exit 0 if r = 1 exit 1 sudo_password: send $(TARGET_ENABLE_PASSWORD) goto wait_prompt normal_check: send "" expect { "$ " exit 0 "# " exit 0 "login:" exit 0 timeout 20 exit 1 } error: exit 1 ----END OF SCRIPT---- ; set target-script solaris network-info # # Network information command for Solaris (use command script) su last | grep -v "^$LOGNAME " netstat -a netstat -vr ps -lfe cksum /bin/* /usr/bin/* /sbin/* /usr/sbin/* ls -al /etc/ /etc/mail/ /etc/cron.d/ /etc/inet/ /etc/init.d/ ls -lR /etc/security/ cksum /etc/shadow /etc/passwd cat /etc/aliases cat /etc/hosts cat /etc/inetd.conf cat /etc/inittab cat /etc/nsswitch.conf cat /etc/resolv.conf cat /etc/services cat /etc/syslog.conf exit ----END OF SCRIPT----