Thursday 18 December 2008

Fedora 10 package you need to compile kernel or build module

You have to download packages below.
# yum install yum-utils rpmdevtools
# yum install kernel-devel-$(uname -r)

Create user in Linux via vbscript

You can combine with previous script to handle creating users for AD and linux together.
I use plink to connect and execute useradd and passwd commands.
Edit sudo file to give these permissions to a user execute two command useradd and sudo. Do not forget to encrypt vbscript.


Dim strUser, strName, strContainer
strUser = InputBox (" Create user","username","")
strName = InputBox ("Name Surname","Name Surname","")
'if you want usernames in lowercase
'strUser = Lcase(StrUser)

' Check username length
If Len(strUser) = 0 Then
wscript.echo "empty username ?"
wscript.quit
End If

call Useradd(strUser)



Function Useradd(strUser)
Set WSHShell = WScript.CreateObject("WScript.Shell")
rc=WshShell.Run("c:\windows\plink.exe AUSERHAVINGSUDO@10.200.124.135 -pw password useradd -d /home/"&

strUser &" -s /bin/csh -c " & strUser & " -m " & strUser , 1, FALSE)
if err.number <> 0 Then
wscript.echo "problem creating user for linux"
wscript.quit
End if
End Function

Create user in AD, vbscript

Create and enable user in active directory environment. Set default password, and force user to change password in first logon.


Dim objRootLDAP, objContainer, objUser, objShell
Dim strUser, strName, strContainer
strUser = InputBox (" Create user","username","")
strName = InputBox ("Name Surname","Name Surname","")
'if you want usernames in lowercase
'strUser = Lcase(StrUser)

' Check username length
If Len(strUser) = 0 Then
wscript.echo "empty username ?"
wscript.quit
End If


call ADCreateUser(strUser,strName)



Function ADCreateUser(strUser,strName)
' parameters
' strName = strUser
strNewPasswd = "NA"&strUser&"99"
strContainer = "OU=YOUROU ,"

wscript.echo "username: " & strUser & " password: " & strNewPasswd

' Bind to Active Directory, Users container.
Set objRootLDAP = GetObject("LDAP://rootDSE")
Set objContainer = GetObject("LDAP://" & strContainer & objRootLDAP.Get("defaultNamingContext"))

' create user.
Set objUser = objContainer.Create("User", "cn=" & strUser)
objUser.Put "sAMAccountName", strUser
objUser.Put "displayName", strName
objUser.SetInfo

'Password set
objUser.Put "userAccountControl", 512
objUser.Put "PwdLastSet", 0
objUser.SetPassword(strNewPasswd)
objUser.SetInfo


End Function

Wednesday 17 December 2008

Fedora 10 Installation from hard disk without cd/dvd or usb

I have running Fedora 6 and enough disk space to hold fedora 10 dvd iso.
Main idea is using initrd.img and vmlinuz under isolinux directory of dvd iso. Put them under /boot directory, edit grub.conf and boot from that kernel.

Downloaded Fedora-10-i386-DVD.iso to /mnt/disk2part1
Disk2part1 is /dev/hdc1 or /dev/sdc1.

# cd /mnt/disk2part1
# mkdir test
# mkdir images
# mount -o loop Fedora-10-i386-DVD.iso test
# cd test/isolinux
# cp initrd.img /boot/fedora10initrd.img
# cp vmlinuz /boot/fedora10vmlinuz
# cd ../images/
# cp install.img ../../images/

Now edit /boot/grub/grub.conf and add lines below

title Install Fedora 10
root (hd0,0)
kernel /fedora10vmlinuz
initrd /fedora10initrd.img

You should know where is your /boot directory. For me(hd0,0).
I select "install fedora 10" in boot screen and hard disk installation method.

webmin ssl_error_rx_record_too_long error

Install perl-Net-SSLeay module.
# yum inatall perl-Net-SSLeay

Now you can use ssl for webmin.

Wednesday 12 November 2008

Ftp for Windows OS error handling

I need a ftp script for uploading files but in Windows OS this is not easy to handle. Error handling is painfull.
I wrote a python script, which you can supply two argument; local directory and file name you want to upload. So you can run this ftp python from batch file or vbscript.
It has good error handling for most kind of errors, could send email to you. Please fill related parameters. You should have running smtp server for getting email.

I put two vbscript function below, which can handle calling python script and send email in case of error.
First function for calling ftp python script.
Second function for sending email in case of vbscript error.(You should put "on error resume next" in your script)


Function ftppython(ftpfile)
Set objShell = CreateObject("WScript.Shell")
objShell.Run "E:\dirofyourscript\ftp.py E:\sysadmins\log "&ftpfile, 0, False
If Err.number <> 0 Then
sendanemail()
End If
Set objShell = Nothing
end function



Function sendanemail
Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = "Problem mnp1 alarm script"
objMessage.From = "mail@domain.com"
objMessage.To = "youremail@domain.com;anotheremail@domain.com"
objMessage.TextBody = "Problem script"
objMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "IPAdressofyoursmtp"
objMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objMessage.Configuration.Fields.Update
objMessage.Send
end function




Python ftp script starts here

from ftplib import FTP
import sys, os, os.path, operator, shutil, smtplib

def upload(handle,filename):
f = open(filename,"rb")
(base,ext) = os.path.splitext(filename)
picext = ".bmp .jpg .jpeg .dib .tif .tiff .gif .png"
if(operator.contains(picext,ext)):
try:
handle.storbinary("STOR " + filename,f,1)
except Exception:
sendanemailo("Successful upload,but check it")
else:
print "Successful upload."
f.close()
return

try:
handle.storbinary("STOR " + filename,f)
except Exception:
sendanemail("Successful upload, but check it.")
else:
print "Successful upload."
f.close()
return


def download(handle,filename):
f2 = open(filename,"wb")
try:
handle.retrbinary("RETR " + filename,f2.write)
except Exception:
sendanemail("Error in downloadtelneting the remote file.")
return
else:
print "Successful download!"
f2.close()
return

def sendanemail(msg):
fromaddr = "from@domain.com"
toaddrs = "tome@domain.com"
subject = "ftp problem"
headers = "From: %s\r\nTo: %s\r\nSubject: %s\r\n\r\n" % (fromaddr, toaddrs, subject)
message = headers + msg



server = smtplib.SMTP('ipadressofmailserver')
server.sendmail(fromaddr, toaddrs, message)
server.quit()
sys.exit()
return


#here are some parameters
host_name = "writeipaddress"
user = "user"
pwd = "password"
oldlocaldir = "z:\\sysadmins\log"
remotedir= "/remote/dir/"

if len(sys.argv) != 3:
sendanemail("there is no argument")
sys.exit()
uploadfile= sys.argv[2]
localdir = sys.argv[1]
os.chdir(localdir)
if not os.path.exists(uploadfile):
sendanemail("There is no file to upload")
sys.exit
if not os.path.exists(oldlocaldir):
sendanemail("There is no dir to move files")
sys.exit()
if not os.path.exists(localdir):
sendanemail("There is no local dir")
sys.exit()

try: ftph = FTP(host_name)
except:
sendanemail("Host could not be resolved.")
sys.exit()
else: pass
try:
ftph.login(user,pwd)
except Exception:
sendanemail("Invalid login combination.")
sys.exit()
else:
print "Successfully connected!\n"
try: os.chdir(localdir)
except:
sendanemail("chdir problem ")
sys.exit()
try: ftph.cwd(remotedir)
except:
sendanemail("there is problem in remotedir")
sys.exit()
try: upload(ftph,uploadfile)
except:
sendanemail("upload problem")
ftph.close()
try: shutil.move (uploadfile,oldlocaldir)
except:
sendanemail("problem move file")

Tuesday 9 September 2008

How to find LUN id? Solaris

Your disk from Format command

6. c4t60060E8004F359000000F35900000D1Ad0
/scsi_vhci/ssd@g60060e8004f359000000f35900000d1a


grep related part luxadm probe

luxadm probe | grep c4t60060E8004F359000000F35900000D1Ad0
Logical Path:/dev/rdsk/c4t60060E8004F359000000F35900000D1Ad0s2


Use logical path

luxadm display /dev/rdsk/c4t60060E8004F359000000F35900000D1Ad0s2
DEVICE PROPERTIES for disk: /dev/rdsk/c4t60060E8004F359000000F35900000D1Ad0s2
Vendor: HITACHI
Product ID: OPEN-V -SUN
Revision: 5008
Serial Num: 50 0F3590D1A
Unformatted capacity: 30720.000 MBytes
Write Cache: Enabled
Read Cache: Enabled
Minimum prefetch: 0x0
Maximum prefetch: 0x0
Device Type: Disk device
Path(s):

/dev/rdsk/c4t60060E8004F359000000F35900000D1Ad0s2
/devices/scsi_vhci/ssd@g60060e8004f359000000f35900000d1a:c,raw
Controller /devices/pci@8,700000/SUNW,jfca@5/fp@0,0
Device Address 50060e8004f35919,0 (LUN is here, hex value)
Host controller port WWN 2000000173016d35
Class primary
State ONLINE
Controller /devices/pci@9,600000/SUNW,jfca@2/fp@0,0
Device Address 50060e8004f35909,0
Host controller port WWN 20000001730151e3
Class primary
State ONLINE



MPxIO c#t#d# c4t60060E8004F359000000F35900000D1Ad0
Array WWN 50060e8004f35919 (device address part)
lun 0 (device address part array wwn,LUN address (hex value) )
HBA WWNs 2000000173016d35

Friday 5 September 2008

Solaris x86 boot GRUB bootenv.rc problem

GRUB Based Booting for Solaris x86 http://docs.sun.com/app/docs/doc/817-1985/hbx86boot-68676?a=view
I had booting problem last week. After grub screen, screen was black and later reboot. First I try rebooting verbose mode editing line in grub "kernel /platform/i86pc/multiboot kernel/unix -v"
How to Modify the Solaris Boot Behavior by Editing the GRUB Menu --> http://docs.sun.com/app/docs/doc/817-1985/fwbme?a=view
Then I got:
/boot/solaris/bootenv.rc - line 23, syntax error.

first we edit bootenv.rc

setprop console 'ttyb'
to
setprop console 'screen'

I could proceed with pressing ctrl+d two times (which stops running script at that time). So I could proceed with booting.
This is a bug related to kernel. Probably kernel do not show boot process to screeen. Also some boot scripts which gets information from eeprom (related to boot-args) hanged. In that kind of situations Ctrl+d could be good solution if you belive scripts hanged during boot.

Thursday 4 September 2008

Export data from oracle via vbscript

I need to export data from oracle so it will be possible for me to generate alert from that log file. I do this because we do not have permission to change anything in the database.
Be carefull about fields section, you must know how many columns in the table.


'Parameters
path="c:\path.txt"
strHost="servername"
strPort="1529"
strSID="oraclesid"
strUsername="user"
strPassword="password"
dquerry="select * from table"


'Filesystem Object
Set objFSO = CreateObject("Scripting.FileSystemObject")

'Check if file exist
If objFSO.FileExists(path) Then
Set objFile = objFSO.OpenTextFile(path,8,True)
else
wscript.echo "there is no file I am creating"
set objFile = objFSO.createtextfile(path)
'set objFile = objFSO.OpenTextFile(path,8, True)
end If


'open connection to database
Dim strCon
strCon = "Driver={Microsoft ODBC for Oracle}; " & _
"CONNECTSTRING=(DESCRIPTION=" & _
"(ADDRESS=(PROTOCOL=TCP)" & _
"(HOST=" & strHost & ")(PORT=" & strPort & "))" & _
"(CONNECT_DATA=(SID = " & strSID & "))); uid=" & strUsername & ";pwd=" & strPassword & ";"
Dim oCon: Set oCon = WScript.CreateObject("ADODB.Connection")
Dim oRs: Set oRs = WScript.CreateObject("ADODB.Recordset")
oCon.Open strCon


Set oRs = oCon.Execute(querry)
While Not oRs.EOF
objFile.WriteLine(oRs.Fields(0).Value &"," & oRs.Fields(1).Value &"," & oRs.Fields(2).Value &"," & oRs.Fields(3).Value &"," & oRs.Fields(4).Value

&"," & oRs.Fields(5).Value &"," & oRs.Fields(6).Value &"," & oRs.Fields(7).Value &"," & oRs.Fields(8).Value &"," & oRs.Fields(9).Value &"," &

oRs.Fields(10).Value &"," & oRs.Fields(11).Value &"," & oRs.Fields(12).Value &"," & "Q3" &"," & "Q3" &"," & oRs.Fields(15).Value &"," & oRs.Fields(16).Value

)
oRs.MoveNext
Wend
oCon.Close
Set oRs = Nothing
Set oCon = Nothing

Wednesday 3 September 2008

Flash archive backup central server

I create flash archive backup and copy to central server. If there is any error in backup process or scp process I got mail.
Also scp works passwordless and secure.

First create transfer user at central server and give necceseery permissions.
At the main server:


# useradd transfer -d /export/home/transfer
# passwd transfer
# chown transfer /centralbackup/dir


At servers which you are going to backup, create public keys.


# ssh-keygen -t rsa
# cat ~/.ssh/id_rsa.pub


copy content to the transfer user in central server /transferuserhomedirectory/.ssh/authorized_keys . Be carefull there is no line break in the id_rsa.pub file.
now you can login without password to central server test is ssh transfer@centralserver.

This is the script that you can backup weekly.


backupname=$(hostname)_$(date '+%Y%m%d')
backupdir=/site/local/backupdir
remotebackupdir=/centralbackup/dir
remoteloc=transfer@mainserver:$remotebackupdir
mailaddress="yourmailaddress@domaim.com"
#if you want to exclude directories when you are creating flash archive use -x
flarcreate -c -S -n $backupname -x /putdirthatyouwanttoexclude -x /anotherexclude $backupdir/$backupname.flar
#check if there is problem creating flash archive
if [ $? -ne 0 ] ; then
echo flarcreate problem in $(hostname) "\n" | mailx -s "$(hostname) flarcreate problem" $mailaddress
exit 1
fi
scp $backupdir/$backupname.flar $remoteloc
#check if there is problem copying to central server.
if [ $? -ne 0 ] ; then
echo backup copy problem in $(hostname) "\n" | mailx -s "$(hostname) backup copy problem" $mailaddress
exit 1
fi
#deletes backup of previous week
rm $backdir/$(hostname)_$(TZ=GMT+167 date +%Y%m%d).flar
#check if there is problem deleting file
if [ $? -ne 0 ] ; then
echo old backup delete problem in $(hostname) "\n" | mailx -s "$(hostname) old backup delete problem" $mailaddress
exit 1
fi

Tuesday 2 September 2008

Inetadm connection_backlog

I patched Solaris 10 x86 which holding a another zone in container.
I got error booting guest zones

Sep 2 13:23:54 inetd[22765]: Unable to read debug property from config property group. scf_simple_prop_get() failed: entity not found
Sep 2 13:23:54 inetd[22765]: Property 'connection_backlog' of instance svc:/network/rpc/gss:default is missing, inconsistent or invalid
Sep 2 13:23:55 svc.startd[22540]: network/inetd:default failed repeatedly: transitioned to maintenance (see 'svcs -xv' for details)
Sep 2 13:23:55 svc.startd[22540]: failed to abandon contract 32259: Permission denied



Output of svcs -xv says gss inetd and related services are failing

svc:/network/rpc/gss:default (Generic Security Service)
State: uninitialized since Tue Sep 02 14:43:58 2008
Reason: Restarter svc:/network/inetd:default is not running.
See: http://sun.com/msg/SMF-8000-5H
See: gssd(1M)
Impact: 14 dependent services are not running. (Use -v for list.)

svc:/application/print/server:default (LP print server)
State: disabled since Tue Sep 02 14:43:57 2008
Reason: Disabled by an administrator.
See: http://sun.com/msg/SMF-8000-05
See: lpsched(1M)
Impact: 1 dependent service is not running. (Use -v for list.)

svc:/network/rpc/rstat:default (kernel statistics server)
State: uninitialized since Tue Sep 02 14:43:58 2008
Reason: Restarter svc:/network/inetd:default is not running.
See: http://sun.com/msg/SMF-8000-5H
See: rpc.rstatd(1M)
See: rstatd(1M)
Impact: 1 dependent service is not running. (Use -v for list.)

svc:/network/rpc/smserver:default (removable media management)
State: uninitialized since Tue Sep 02 14:43:58 2008
Reason: Restarter svc:/network/inetd:default is not running.
See: http://sun.com/msg/SMF-8000-5H
See: rpc.smserverd(1M)
Impact: 1 dependent service is not running. (Use -v for list.)

svc:/application/print/cleanup:default (print cleanup)
State: maintenance since Tue Sep 02 14:43:58 2008
Reason: Start method failed repeatedly, last exited with status 1.
See: http://sun.com/msg/SMF-8000-KS
See: /var/svc/log/application-print-cleanup:default.log
Impact: This service is not running.

svc:/network/inetd:default (inetd)
State: maintenance since Tue Sep 02 14:44:07 2008
Reason: Restarting too quickly.
See: http://sun.com/msg/SMF-8000-L5
See: inetd(1M)
See: /var/svc/log/network-inetd:default.log


I set the value below and restarted zone, now it is ok

inetadm -M connection_backlog=10

Thursday 28 August 2008

Booting Solaris Intel into single user mode

Press e in when grub shows at boot time.
Edit multiboot line below and add -s to the end press enter
then b for boot

root (hd0,0,a)
kernel /platform/i86pc/multiboot -s
module /platform/i86pc/boot_archive

Or you can edit /boot/grub/menu.lst and add new entries like below copy your original entries in the file and add -s to end of multiboot line.
title Solaris 10 11/06 s10x_u3wos_10 X86
root (hd0,0,a)
kernel /platform/i86pc/multiboot -s
module /platform/i86pc/boot_archive

Thursday 21 August 2008

Secure port forwarding without shell access

My aim was connection to ssh deamon on defined port (4321 for this example) different then default port and specific users (only for theusername for this example) without shell access and permiting port forwarding. Chroot for sshd is painfull.


Create custum sshd config file
cp /etc/ssh/sshd_config /etc/sshsshd_config_custom


Changed options in sshd_config_custom file
Port 4321
PermitRootLogin no
AllowUsers theusername


With this configuration file, only theusername could connect ssh deamon on port 4321.
Run sshd deamon
/usr/lib/ssh/sshd -f /data01/tcell/sshd_config_config


Change shell to /usr/bin/false in passwd file

vi /etc/passwd
theusername:x:404:808::/homefolder:/bin/sh
theusername:x:404:808::/homefolder:/usr/bin/false


If you do not have false shell create read only shell.
vi /usr/bin/dummyshell
add two lines below
#!/bin/bash
bash -r -c read

Make executable
chmod a+x  /usr/bin/dummyshell

From remote computer:
So user had to use -N option for ssh command
     -N

Does not execute a remote command. This is useful if you
just want to forward ports (protocol version 2 only).


For port forwarding from another system
ssh -N theusername@ipadressoftheserver -L 9999:127.0.0.1:9999 -p 4321


-p for changed ssh port in sshd_config_custom

Now user could not give any command on the server but could port forward 9999 from the server to computer.

Friday 15 August 2008

Shell script argument check and directory check

With this part you can check arguments are supplied and give usage information.
if [ $# -ne 2 ]
then
echo 1>&2 Usage: $0 firstdatafile lastdatafile
exit 127
fi

Create if directory does not exist
DESTDIR=dirname
if ! test -d "$DESTDIR"
then mkdir -p $DESTDIR
fi

Tuesday 12 August 2008

Relocating Oracle Data Files

Check for location
SQL> SELECT FILE_NAME, BYTES FROM DBA_DATA_FILES WHERE TABLESPACE_NAME = 'TABLESPACE';

FILE_NAME
--------------------------------------------------------------------------------
BYTES
----------
/dbfiles/oradata03/loc/FILE_DATA01.dbf
4294967296


Take tablespace offline
SQL> ALTER TABLESPACE FILE_DATA OFFLINE NORMAL;

Tablespace altered.

Copy file to the new location.
cp /dbfiles/oradata03/loc/FILE_DATA01.dbf /dbfiles/oradata05/loc/FILE_DATA01.dbf
Check for file permission and owner.

Do it for Oracle
SQL> ALTER TABLESPACE FILE_DATA RENAME DATAFILE '/dbfiles/oradata03/loc/FILE_DATA01.dbf' to '/dbfiles/oradata05/loc/FILE_DATA01.dbf';

Tablespace altered.


Take tablespace online
SQL> ALTER TABLESPACE FILE_DATA ONLINE;

Tablespace altered.

Monday 11 August 2008

Solaris new disks from SAN

This commands help you to force configuration of new disks.
cfgadm -o force_update -c configure c3

Then you can run devfsadm or drvconfig
and later format and newfs.


Before

# cfgadm -al
Ap_Id Type Receptacle Occupant Condition
c0 scsi-bus connected configured unknown
c0::dsk/c0t0d0 CD-ROM connected configured unknown
c1 fc-private connected configured unknown
c1::500000e010c3b8e1 disk connected configured unknown
c1::500000e010c466c1 disk connected configured unknown
c1::500000e010c47e51 disk connected configured unknown
c1::500000e010c47f31 disk connected configured unknown
c1::500000e010c49711 disk connected configured unknown
c1::500000e010c49b41 disk connected configured unknown
c1::50800200001f8811 ESI connected configured unknown
c2 fc-fabric connected configured unknown
c2::50060e8000c41da3 disk connected configured unknown
c2::50060e8000c41da7 disk connected configured unknown
c2::50060e8004f35919 disk connected unconfigured unknown
c3 fc-fabric connected configured unknown
c3::50060e8000c41da2 disk connected configured unknown
c3::50060e8000c41da6 disk connected configured unknown
c3::50060e8004f35909 disk connected unconfigured unknown
pcisch0:hpc1_slot0 fibre/hp connected configured ok
pcisch0:hpc1_slot1 unknown empty unconfigured unknown
pcisch0:hpc1_slot2 unknown empty unconfigured unknown
pcisch0:hpc1_slot3 unknown empty unconfigured unknown
pcisch2:hpc2_slot4 unknown empty unconfigured unknown
pcisch2:hpc2_slot5 unknown empty unconfigured unknown
pcisch2:hpc2_slot6 unknown empty unconfigured unknown
pcisch3:hpc0_slot7 fibre/hp connected configured ok
pcisch3:hpc0_slot8 pci-pci/hp connected configured ok

You can see that c3::50060e8004f35909 c2::50060e8004f35919 not configured.

Run cfgadm
cfgadm -o force_update -c configure c2

Now you can see c2::50060e8004f35919 configured. Do this also for c3

# cfgadm -al
Ap_Id Type Receptacle Occupant Condition
c0 scsi-bus connected configured unknown
c0::dsk/c0t0d0 CD-ROM connected configured unknown
c1 fc-private connected configured unknown
c1::500000e010c3b8e1 disk connected configured unknown
c1::500000e010c466c1 disk connected configured unknown
c1::500000e010c47e51 disk connected configured unknown
c1::500000e010c47f31 disk connected configured unknown
c1::500000e010c49711 disk connected configured unknown
c1::500000e010c49b41 disk connected configured unknown
c1::50800200001f8811 ESI connected configured unknown
c2 fc-fabric connected configured unknown
c2::50060e8000c41da3 disk connected configured unknown
c2::50060e8000c41da7 disk connected configured unknown
c2::50060e8004f35919 disk connected configured unknown
c3 fc-fabric connected configured unknown
c3::50060e8000c41da2 disk connected configured unknown
c3::50060e8000c41da6 disk connected configured unknown
c3::50060e8004f35909 disk connected unconfigured unknown
pcisch0:hpc1_slot0 fibre/hp connected configured ok
pcisch0:hpc1_slot1 unknown empty unconfigured unknown
pcisch0:hpc1_slot2 unknown empty unconfigured unknown
pcisch0:hpc1_slot3 unknown empty unconfigured unknown
pcisch2:hpc2_slot4 unknown empty unconfigured unknown
pcisch2:hpc2_slot5 unknown empty unconfigured unknown
pcisch2:hpc2_slot6 unknown empty unconfigured unknown
pcisch3:hpc0_slot7 fibre/hp connected configured ok
pcisch3:hpc0_slot8 pci-pci/hp connected configured ok


After that I can see disk in format menu. Change disk layout.
6. c4t60060E8004F359000000F35900000D1Ad0
/scsi_vhci/ssd@g60060e8004f359000000f35900000d1a

Create file system
newfs /dev/rdsk/c4t60060E8004F359000000F35900000D1Ad0s0

Thursday 7 August 2008

Making rpm package from source

If you downloaded source rpm package like *.src.rpm,
You cand make rpm package with rpmbuild command.
# rpmbuild --rebuild /var/tcell/packagename.src.rpm

Sysstat linux package - sar sa1 sa2 sadc

For SUSE I installed these packages before installing sysstat
rpm -ivh libgcj-3.3.3-43.24.i586.rpm
rpm -ivh plotutils-2.4.1-575.1.i586.rpm
rpm -ivh gettext-0.14.1-30.1.i586.rpm
rpm -ivh sysstat-5.0.1-35.1.i586.rpm
rpm -ivh gnuplot-3.7.3-256.1.i586.rpm

sysstat-8.1.2-4.1.i586.rpm

I took some time for me to find cron job location
/etc/cron.d/sysstat
#crontab for sysstat

#activity reports every 10 minutes everyday
-*/10 * * * * root /usr/lib/sa/sa1

#update reports every 6 hours
0 */6 * * * root /usr/lib/sa/sa2 -A

You can check reports via sar command. If you want to be sure that cron wor
sar -f /var/log/sa/sa07
Last two digit depends on day of month

You can find configuration file under /etc/sysstat
ls /etc/sysstat
sysstat sysstat.cron sysstat.ioconf

Thursday 24 July 2008

unary operator expected shell script

Place quotes around your variables

if [ "$state" != "" ]
then
echo problem
fi

Monday 14 July 2008

Subtract dates in Linux

This is working for Linux
main idea find the seconds since "00:00:00 1970-01-01 UTC"
then subtract them. This is GNU extension.

$ a=$(date -d "Tue Apr 29 14:02:19 PDT 2003" +%s)
$ b=$(date -d "Tue Apr 05 14:02:19 PDT 2003" +%s)
$ d=$(( $a - $b ))
$ echo $(( $d / 3600 / 24 ))

Friday 11 July 2008

gcc-4.1.1 solaris 10 AMD Sun Fire X4100 M2

Old version off gcc was already installed so I used it.

bunzip2 gcc-4.1.1.tar.bz2
/usr/sfw/bin/gtar xvf gcc-4.1.1.tar
cd gcc-4.1.1

We need gnu make
ln -s /usr/sfw/bin/gmake /usr/sbin/make

Env variables
export PATH=/usr/ucb:/usr/sbin:/usr/bin:/usr/local/bin:/usr/ccs/bin:/usr/sfw/bin
export CC=gcc


Configure with recommended options
./configure --with-as=/usr/sfw/bin/gas --with-gnu-as --with-ld=/usr/ccs/bin/ld --without-gnu-ld --enable-languages=c,c++ --enable-shared
make
make install

typeflag L not recognized

Error with tar
typeflag 'L' not recognized, converting to regular file

use gtar
/usr/sfw/bin/gtar

Thursday 15 May 2008

Vmware Xp unmountable_boot_volume

vmware server installed in suse linux 9
When we were installing Windows Xp, we got unmountable_boot_volume error.
I converted Xp installation cd to iso image and mount iso image instead of mounting cd

Friday 18 April 2008

Use a PAE enabled kernel

If server has 4 GB or more memory, some operating systems may not access all of the memory. 64 bit OS are out of this subject.
Some PCI, PCI-X and PCI-Express cards use memory below 4 GB which known as PCI hole or PCI Extended Configuration Space. This space could not allocated for system memory and relocated above 4 GB. Then if the operating system is not PAE enabled or not allowed to because of limitation (like Windows Standart edition) could not use this memory location and shows less then 4 GB.

For Windows edition you can add /PAE switch to the boot.ini. (not for XP and standart edition)
For Linux
I confused, because kernel-smp (2.6) versions say that it is supporting up to 16 GB.
But You have to install bigsmp kernel instead of smp for SUSE. And i686-smp or hugemem kernels for Red Hat. (kernel-hugemem is required for memory configurations higher than 16 GB).
There is kernel-pae packeges for some distributions(Fedora, CentOS).

You can find warning message "Use a PAE enabled kernel" from output of dmesg command.
BTW There is another option that you can compile your kernel.

Thursday 17 April 2008

Zenoss Installation Fedora 7

Zenoss requires older version of python. But Fedora 7 or later comes with newer version.

Mysql installation
------
Mysql packages
mysql-devel-5.0.37-2.fc7.i386.rpm
mysql-libs-5.0.37-2.fc7.i386.rpm
mysql-5.0.37-2.fc7.i386.rpm
perl-DBI-1.53-2.fc7.i386.rpm
mysql-server-5.0.37-2.fc7.i386.rpm
perl-DBD-MySQL-3.0008-1.fc7.i386.rpm

# chkconfig mysqld on
# service mysqld start

Give password for mysql
# /usr/bin/mysqladmin -u root password pass

Some other packages you need:
make-3.81-6.fc7
swig-1.3.31-0.fc7
autoconf-2.61-8.fc7

python installation
------
You need older version of python (2.4) for zenoss installation. You can compile and install to another path

# mkdir /opt/python/python2.4.4
# ./configure --prefix=/opt/python/python2.4.4
# make
# make install
# cd /usr/local/bin
# ln -s /opt/python/python2.4.4/bin/python
# ln -s /opt/python/python2.4.4/bin/python2.4



zenoss installation
------
# useradd zenoss
# cat /etc/passwd | grep zenoss


edit profile
cd /home/zenoss
vi .bashrc
export ZENHOME=/usr/local/zenoss
export PYTHONPATH=$ZENHOME/lib/python
export PATH=$ZENHOME/bin:$PATH

# mkdir /usr/local/zenoss
# chown zenoss /usr/local/zenoss

$ tar xvf zenoss-2.1.3.tar.gz
$ cd zenoss-2.1.3
$ ./install.sh


I got this error
AttributeError: /usr/local/zenoss/bin/python: undefined symbol: netsnmp_get_version

Solve this with installing packages below
# rpm -ivh lm_sensors-2.10.3-2.fc7.i386.rpm
# rpm -ivh net-snmp-libs-5.4-13.fc7.i386.rpm
# rpm -ivh net-snmp-5.4-13.fc7.i386.rpm

Wednesday 16 April 2008

Solaris mpxio

I listed server and storage that I used. I do not know exact model names.
Sun Fire X4150 DGC
Sun Fire X4150 HITACHI-DF600F
Sun Fire X4150 SUN-StorEdge 3510
Sun Fire X4100 M2 HITACHI-OPEN-V*5 HITACHI-OPEN-V HITACHI-OPEN-V*14
Sun Fire X4100 M2 SUN-StorEdge 3510
Sun Fire X4100 M2 EMC-SYMMETRIX-5771

Default configuration worked for all storages above but I had to enter entries below to /kernel/drv/scsi_vhci.conf for mpxio
device-type-scsi-options-list="HITACHI DF600F", "symmetric-option";
symmetric-option = 0x1000000;

Monday 14 April 2008

Acronis True Image for Linux

Os SUSE LINUX Enterprise Server 9 (i586)
Acronis agent for linux

upload acronis.i686 to server
chmod u+x acronis.i686
./acronis.i686 -a -i TrueImageAgent

I got this error at console but there weren't file trueimage-setup.log. I used -d switch to get details.
Acronis True Image Echo Enterprise Server Setup failed to build kernel modules. Consult /var/log/trueimage-setup.log and /var/lib/dkms/snapapi26/0.7.29/build/make.log for error messages.

./acronis.i686 -d -a -i TrueImageAgent


In the log file I saw these entries.
Error! Your kernel source for kernel 2.6.5-7.244-smp cannot be found at
/lib/modules/2.6.5-7.244-smp/build or /lib/modules/2.6.5-7.244-smp/source.
DO YOU HAVE gcc INSTALLED???

Installation program build kernel modules for application. I installed this packages for this purpose.
kernel-source-2.6.5-7.244.i586.rpm
glib-devel-1.2.10-586.2.i586.rpm
gcc-3.3.3-43.41.i586.rpm
gcc-3.3.3-43.41.i586.rpm
glibc-devel-2.3.3-98.28.i686.rpm

Friday 11 April 2008

Fedora 6 MythTv

Installed packages:
FreeType development package
lame package
lame-devel
avahi-qt3-devel
libXv-devel
libXxf86vm-devel
liblXmu-devel
mysql
mysql-server
qt-MYSQL

downloaded and extracted mythtv-0.21
cd mythtv-0.21
configure
make
make install

echo /usr/local/lib >> /etc/ld.so.conf
/sbin/ldconfig

chkconfig mysqld on
service mysqld start
mysql -u root < mc.sql

run mythtv-setup command and configure MythTv

Tuesday 8 April 2008

grub: not found or no block device

grub-install command failed
grub: not found or no block device

So I used the grub shell
# grub
grub> root (hd0,0)
grub> setup (hd0)

Monday 7 April 2008

Install Linux from disk

I do not have DVD drive so I installed Linux from iso file.

Copy files
mount -o loop openSUSE-10.2-GM-DVD-i386.iso opensuse
cd opensuse
cp linux /boot/inst-linux
cp initrd /boot/inst-initrd

Edit /boot/grub/grub.conf
title Install SUSE
root (hd0,0)
kernel /boot/inst-linux
initrd /boot/inst-initrd

Drives and partitions start from 0. If your have boot filesystem as a partition change the lines "kernel inst-linux" and "initrd inst-initrd"

During installation first you choose disk then you have to type the directory and complete filename of the ISO file.

Ip configuration files for Solaris

Create related configuration file. e1000g? are network interfaces you can find for your host via ifconfig -a
ls /etc/hostname.*
/etc/hostname.e1000g0
/etc/hostname.e1000g1
/etc/hostname.e1000g2


Entries in these files
cat hostname.e1000g0
hstnameloc

cat hostname.e1000g1
hstnamesec

cat hostname.e1000g2
hstnamereal


You have to put ip adress to hostname
cat /etc/hosts
10.210.50.69 hstnamereal loghost
192.168.20.6 hstnamesec
192.168.25.6 hstnameloc

Also to netmaks
cat /etc/netmasks
192.168.20.0 255.255.255.0
192.168.25.0 255.255.255.0
10.210.50.0 255.255.255.0

You can configure nodename which you see at the command prompt
cat /etc/nodename
hstnamereal



Virtual interface
cat /etc/hostname.e1000g0:1
hstnamevirtual

add /etc/hosts
10.210.50.70 hstnamevirtual

Disk monitoring via mrtg

OS Fedora 6 (I do not have dvd drive so I am still using this version)
Go through http://kbase.redhat.com/faq/FAQ_40_11143.shtm this document which his written for Red Hat.


yum install sysstat
yum instal mrtg


edit /etc/httpd/conf/httpd.conf
DocumentRoot "/var/www/html/mrtg/disk"


Start services
# service httpd start
# chkconfig httpd on
# mkdir -p /var/www/html/mrtg/disk/

edit vi /var/www/html/mrtg/disk/mrtg_disk.sh
#!/bin/bash
hd=hda
disk=/dev/$hd
UPtime=`/usr/bin/uptime |awk '{print $3""$4""$5}'`
KBread_sec=`iostat -x $disk|grep $hd |awk '{print $8}'`
KBwrite_sec=`iostat -x $disk|grep $hd |awk '{print $9}'`
echo $KBread_sec
echo $KBwrite_sec
echo $UPtime
hostname


# chmod u+x /var/www/html/mrtg/disk/mrtg_disk.sh


edit /var/www/html/mrtg/disk/mrtg_cfg_disk
WorkDir: /var/www/html/mrtg/disk
Target[disk]: `/var/www/html/mrtg/disk/mrtg_disk.sh`
Title[disk]: Disk HDA I/O Utilization Report
#Unscaled[disk]: dwym
MaxBytes[disk]: 10240000
PageTop[disk]:

Disk I/O Utilization Report


kmg[disk]: KB,MB,GB
LegendI[disk]: Disk I/O KBread/sec
LegendO[disk]: Disk I/O KBwrite/sec
Legend1[disk]: Disk I/O KBread/sec
Legend2[disk]: Disk I/O KBwrite/sec
YLegend[disk]: Megabytes
ShortLegend[disk]: &
Options[disk]: growright,gauge,nopercent



edit crontab
*/3 * * * * /usr/bin/mrtg /var/www/html/mrtg/disk/mrtg_cfg_disk

Thursday 3 April 2008

Sun System Handbook

http://sunsolve.sun.com/handbook_private
You can find support matrix, info docs etc.
You need user to access this site

Hp, Windows Server 2003 support matrix

HP Windows Server Operating System Support Matrix
http://h71028.www7.hp.com/enterprise/cache/461942-0-0-0-121.html

Microsoft Windows Server 2003 matrix
http://www.microsoft.com/technet/windowsserver/evaluate/features/compare.mspx

Switches to enable more memory for Windows
boot.ini
/3GB /PAE
http://www.microsoft.com/whdc/system/platform/server/pae/default.mspx
http://www.microsoft.com/whdc/system/platform/server/PAE/pae_os.mspx
http://www.microsoft.com/whdc/system/platform/server/PAE/PAEmem.mspx

Thursday 27 March 2008

Argument list too long

If there are many files and your ls, rm or mv commands not working you can use one of these

find /path/to -name 'yourfiles*' | xargs rm
find /path/to -name 'yourfiles*' | xargs -i mv {} anildel/
find /path/to -name 'yourfiles*' -exec rm '{}' \;
find /path/to -name 'yourfiles*' -exec rm '{}' +

Wednesday 12 March 2008

Sendmail Troubleshooting

First of all I recommend enabling logging. Edit /etc/syslog.conf and be careful about using tab between entries.
mail.debug /var/log/mail.log

Restart syslog daemon
/etc/init.d/syslog restart

Check /var/log/mail.log.
You can find brief information about sendmail Email flow
http://sial.org/howto/sendmail/

Also some troubleshooting docs from HP
http://docs.hp.com/en/B2355-90685/ch04s11.html
http://docs.hp.com/en/5991-6611/ch02s10.html

Shell script Get the time difference

Get difference

date1=`date +%s`
commands
..
..
.
date2=`date +%s`
date -d "00:00:00 $(( ${date2} - ${date1} )) seconds" +"%H:%m:%S"

Wednesday 5 March 2008

Sed and awk, find pattern and get next lines

Search pattern and print next two lines. You can add more getline and print here for awk and n;p for sed. Also you can do it via +2p

awk '/pattern/{getline;print;getline;getline;print}' file
sed -n '/pattern/{n;p;n;p;}' file
sed -n '/pattern/,+2p' file

Get between two pattern

awk '/pattern1/,/pattern2/' file
sed -n '/pattern1/,/pattern2/p' file

This is small script do same another way.

pattern=yourpattern
bgn=$(grep -n $pattern scsconfig.log awk -F: {'print $1'})
ed=`expr $bgn + 3`
cat scsconfig.log sed -n ''$bgn','$ed'p'

Friday 29 February 2008

Tools for Troubleshooting Windows Server

http://www.microsoft.com/downloads/details.aspx?FamilyID=115905a2-2507-41db-9195-2e73c8a196a2&DisplayLang=en
Here is the list of tools which explained in the document.

Dependency Walker
Application and Service Tools
-Eventtriggers
-Event Viewer
-Gpresult
-Openfiles
-Performance Logs and Alerts
-Program Compatibility Wizard
-The Resultant Set of Policy
-Runas
-Sc
-Taskkill
-Tasklist
-Task Manager

Operating System and Driver Tools
-Boot Logging
-Device Manager
-Driver Verifier Manager
-Error Reporting Service
-File Signature Verification
-Kernel Debuggers
-Memory Pool Monitor


Online Crash Analysis
Recovery Console
Shutdown Event Tracker
System Configuration Utility (Msconfig.exe)
Systeminfo (systeminfo.exe)
System Information (msinfo32)
Wmic
Windows Update

Disk Tools
-Chkdsk
-Disk Cleanup

Networking Tools
-Arp
-Ipconfig
-Net
-Netdiag
-Netstat
-Network Monitor
-Nslookup
-Pathping
-Portqry
-Telnet Client

Remote Management Tools
-Computer Management
-Emergency Management Services
-Remote Desktop
-Telnet Server

Thursday 21 February 2008

Ext3 journaling

Get your journalling mode
cat /proc/mounts | egrep "ext3"

Journal
(slow, but least risky) Both metadata and file contents are written to the journal before being committed to the main file system. This improves reliability at a performance penalty because all data has to be written twice. Without this setting in /etc/fstab, a file being edited in-place during a power outage or kernel panic risks being corrupted, depending on how the application is writing to the file.

Ordered
(medium speed, medium risk) Ordered is as with writeback, but forces file contents to be written before its associated metadata is marked as committed in the journal. This is the default on many Linux distributions.

Writeback
(fastest, most risky; equivalent to ext2 in some sense) Here metadata is journaled but file contents are not. This is faster, but introduces the hazard of out-of-order writes where, for example, files being appended to during a crash may gain a tail of garbage on the next mount.

Set or clear the indicated default mount options in the filesystem
tune2fs -O has_journal -o journal_data /dev/hdXY
tune2fs -O has_journal -o journal_data_ordered /dev/hdXY
tune2fs -O has_journal -o journal_data_writeback/dev/hdXY

Also you can define when you are mounting
mount -o data=journal /dev/hdXY /mountpoint
mount -o data=ordered /dev/hdXY /mountpoint
mount -o data=writeback /dev/hdXY /mountpoint

Or in fstab file
LABEL=test /mountpoint ext3 data=writeback 0 0

Friday 8 February 2008

Export Local Group Policy settings to other Pc

If you want to move local policy settings to other Windows OS, move files under %systemroot%\system32\grouppolicy\ to other system.
Also if you delete files under this directory, you system will not have group policy. Do not forget to log off log on.
If you are managing workgroup. You can use this method for distributing policy.

Thursday 24 January 2008

Data Execution Prevention problems

After converting physical machine to VMware virtual machine, I had problems opening display properties. Data execution prevention prevented some features.
Changing settings under system properties --> advanced--> data execution prevention and allowing application did not help.
So I edited boot.ini and disabled DEP via adding /noexecute=AlwaysOff .
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /fastdetect /NoExecute=AlwaysOff

A detailed description of the Data Execution Prevention (DEP) feature in Windows XP Service Pack 2, Windows XP Tablet PC Edition 2005, and Windows Server 2003
http://support.microsoft.com/kb/875352

Tuesday 22 January 2008

Fedora 6 make music via Rosegarden and CT 670

Rosegarden is free software digital audio workstation. It has MIDI and audio playback.
So I connected my Casio CT 670 keyboard, and played midi files via Rosegarden.
Keyboard has 4 channel so I also use software synth (qynth) for having more channels. But If you want to have good sound via software synth you have to have good sound card (asio drive prefered).

Install Rosegarden
yum install qjackctl fluidsyth fluid-soundfont qsynth rosegarden4

run
qjackctl -> this is for connecting qynth your midi device and rosegarden
qsynth --> software synth, you can find soundfonts from internet
rosegarden

Tuesday 15 January 2008

Boot problem Solaris i386

I got below from http://blogs.sun.com/tdh/entry/grub_error_17_cannot_mount and I used this for fixing problem.

"error 17, cannot mount selected partition"

1. Boot into Solaris Safeboot mode. You can get access at the Grub menu, usually the 2nd option. Note: I had to use the DVD install media to do this.
2. Mount the found Solaris partition on /a Safeboot will usually find the slice on the disk with Solaris and ask if you want it to mount on /a. Select Yes.
3. Move /a/dev, /a/devices, and /a/etc/path_to_inst to another name (I just append .orig) and then create new directories, (mkdir) /a/dev and /a/devices, and touch /a/etc/path_to_inst. I did not do this step.
4. Run "devfsadm -r /a" to rebuild the device tree.
5. Edit /a/boot/solaris/bootenv.rc and modify the line with "setprop bootpath '/pci@0,0....' to match the path you'll find mounted for /a (i.e. run a 'df -k' command, and you should see /a mounted from /dev/dsk/c1d0s0 or something, then run 'ls -l /dev/dsk/c1d0s0' or whatever your device listed was, and you should see the actual link point to ../../devices/pci@0,0/...) The path to bootpath you want should be the hard disk which is mounted as /a and you just need to find the expanded /devices/pci@0,0/... path and put that in the bootenv.rc file on the Solaris root filesystem on the hard disk (sans the /devices/ prefix of course). This is a key step.
6. Now run "bootadm update-archive -v -R /a" to rebuild the boot-archive on /a.
7. Make sure to edit /etc/vfstab
8. run a 'touch /a/reconfigure'
9. Run "cd /; sync; sync; sync; umount /a" And I skipped this one.
10. and finally reboot.

Saturday 12 January 2008

dd for windows

Find exe and usage info
http://www.chrysocome.net/dd
I use it for copying image file to usb disk.

Configuration and Troubleshooting of 3510

Look documentation in http://sunsolve.sun.com

Verifying STMS (mpxio) Health
Troubleshooting Fibre Channel Devices from the OS
How to verify HBA Connectivity
Troubleshooting Sun StorEdge[TM] 33x0/351x Configurations
Troubleshooting Sun StorEdge[TM] 33x0/351x Hardware
Troubleshooting Sun StorEdge[TM] 351x Cabling

"Can't Connect to Sun StorEdge[TM] array via Ethernet."

sccli Library database update error

Disable mpxio

/kernel/drv/fp.conf
change line to yes.
mpxio-disable="yes";
reboot server

Configuration steps Sun Storage 3510

Os Solaris 10 i386
Server Sun Fire X4100 M2
Storage SUN StorEdge 3510


sccli> show disks
h Id Size Speed LD Status IDs Rev
----------------------------------------------------------------------------
2(3) 6 279.40GB 200MB NONE FRMT SEAGATE ST330055FSUN300G 0691
S/N 14T0VB9R
WWNN 2000001862817790
2(3) 7 279.40GB 200MB NONE FRMT SEAGATE ST330055FSUN300G 0691
S/N 14T0VE2D
WWNN 2000001862817673
2(3) 8 279.40GB 200MB NONE FRMT SEAGATE ST330055FSUN300G 0691
S/N 10T0PZNQ
WWNN 2000001862811CF3
2(3) 9 279.40GB 200MB NONE FRMT SEAGATE ST330055FSUN300G 0691
S/N 14T0PQYD
WWNN 2000001862817416
2(3) 10 279.40GB 200MB NONE FRMT SEAGATE ST330055FSUN300G 0691
S/N 10T0NHYW
WWNN 2000001862811D30
2(3) 11 279.40GB 200MB GLOBAL STAND-BY SEAGATE ST330055FSUN300G 0691
S/N 14T0QYAG
WWNN 2000001862817F59

I used disk 6 to 10 create logical drive RAID5 configuration.


sccli> create logical-drive RAID5 2.6-10
sccli: created logical drive 72BE98D8

now status

sccli> show disks
Ch Id Size Speed LD Status IDs Rev
----------------------------------------------------------------------------
2(3) 6 279.40GB 200MB ld0 ONLINE SEAGATE ST330055FSUN300G 0691
S/N 14T0VB9R
WWNN 2000001862817790
2(3) 7 279.40GB 200MB ld0 ONLINE SEAGATE ST330055FSUN300G 0691
S/N 14T0VE2D
WWNN 2000001862817673
2(3) 8 279.40GB 200MB ld0 ONLINE SEAGATE ST330055FSUN300G 0691
S/N 10T0PZNQ
WWNN 2000001862811CF3
2(3) 9 279.40GB 200MB ld0 ONLINE SEAGATE ST330055FSUN300G 0691
S/N 14T0PQYD
WWNN 2000001862817416
2(3) 10 279.40GB 200MB ld0 ONLINE SEAGATE ST330055FSUN300G 0691
S/N 10T0NHYW
WWNN 2000001862811D30
2(3) 11 279.40GB 200MB GLOBAL STAND-BY SEAGATE ST330055FSUN300G 0691
S/N 14T0QYAG
WWNN 2000001862817F59

Check logical drive now

sccli> show ld
LD LD-ID Size Assigned Type Disks Spare Failed Status
------------------------------------------------------------------------
ld0 72BE98D8 1.09TB Primary RAID5 5 1 0 Good I
Write-Policy Default StripeSize 128KB


Create logical volume

sccli> create lv ld0 primary
sccli: created logical volume 391D4ADF
sccli> show lv
LV LV-ID Size Assigned Write-Policy LDs
-----------------------------------------------------------------
lv0 391D4ADF 1.09TB Primary Default 1 ld0

Create map

sccli> show channels
Ch Type Media Speed Width PID / SID
--------------------------------------------
0 Host FC(L) 2G Serial 40 / N/A
1 Host FC(L) N/A Serial N/A / 42
2 DRV+RCC FC(L) 2G Serial 14 / 15
3 DRV+RCC FC(L) 2G Serial 14 / 15
4 Host FC(L) 2G Serial 44 / N/A
5 Host FC(L) N/A Serial N/A / 46
6 Host LAN N/A Serial N/A / N/A

3510 use channel 0 and pid 40 and channel 4 pid 44 here.


sccli> map lv0 0.40.0
sccli: mapping lv0-00 to 0.40.0
sccli> show map
Ch Tgt LUN ld/lv ID-Partition Assigned Filter Map
---------------------------------------------------------------------
0 40 0 lv0 391D4ADF-00 Primary

I recommend disabling mpxio if you are facing problems.


sccli> map lv0 4.44.0
sccli: mapping lv0-00 to 4.44.0

sccli> show map
Ch Tgt LUN ld/lv ID-Partition Assigned Filter Map
---------------------------------------------------------------------
0 40 0 lv0 391D4ADF-00 Primary
4 44 0 lv0 391D4ADF-00 Primary

Be sure devices are connected now. If you have problem in this step and for the rest of them, I highly recommend check configuration of 3510 .

#luxadm -e port
/devices/pci@0,0/pci10de,5d@e/pci1077,143@0/fp@0,0:devctl CONNECTED
/devices/pci@0,0/pci10de,5d@e/pci1077,143@0,1/fp@0,0:devctl NOT CONNECTED
/devices/pci@0,0/pci10de,5d@d/pci1077,143@0/fp@0,0:devctl CONNECTED
/devices/pci@0,0/pci10de,5d@d/pci1077,143@0,1/fp@0,0:devctl NOT CONNECTED


And see that disk devices are ok.

#luxadm -e dump_map /devices/pci@0,0/pci10de,5d@e/pci1077,143@0/fp@0,0:devctl
Pos Port_ID Hard_Addr Port WWN Node WWN Type
0 a7 0 216000c0ff8b5125 206000c0ff0b5125 0x0 (Disk device)
1 1 0 2100001b3202e7c4 2000001b3202e7c4 0x1f (Unknown Type,Host Bus Adapter)

and

#luxadm -e dump_map /devices/pci@0,0/pci10de,5d@d/pci1077,143@0/fp@0,0:devctl
Pos Port_ID Hard_Addr Port WWN Node WWN Type
0 a5 0 226000c0ffab5125 206000c0ff0b5125 0x0 (Disk device)
1 1 0 2100001b3202dc8f 2000001b3202dc8f 0x1f (Unknown Type,Host Bus Adapter)


Now check that they are connected and configured, if not configure them

#cfgadm -al
Ap_Id Type Receptacle Occupant Condition
c3 scsi-bus connected configured unknown
c3::dsk/c3t2d0 disk connected configured unknown
c4 fc-private connected configured unknown
c4::226000c0ffab5125 disk connected configured unusable
c5 fc-private connected configured unknown
c5::216000c0ff8b5125 disk connected configured unusable
c6 fc connected unconfigured unknown
c7 fc connected unconfigured unknown

and run devfsadm command to build device tree. and see them with format command.

Friday 4 January 2008

Fedora WPA wpa_supplicant

Operating system ; Fedora Linux 6
Wireless Card ; Dlink D520 atheros based wireless pci card

For enabling wpa install wpa_supplicant*.rpm

edit /etc/wpa_supplicant/wpa_supplicant.conf


ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=wheel
#
# home network; allow all valid ciphers
network={
ssid="yourssid"
scan_ssid=1
key_mgmt=WPA-PSK
psk="yourpassword"
}

And add line to /etc/rc.local for starting at boot time run the commands for starting wpa
wpa_supplicant -B -c/etc/wpa_supplicant.conf -iath0 -Dmadwifi &
dhclient ath0

So WPA

Use WPA, if your wireless modem supports.
For cracking WPA, attacker has to do dictionary attack. If you use complex password, it is nearly impossible to hack WPA, if your password is not in the dictionary.
Also for cracking WPA, attacker has to catch handshake data, there are some ways to force handshake . But again the reason above, it is really hard to hack WPA wireless network.

What about 128 bit WEP

For best data collection I use --ivs --channel and --bssid options for airdump.
I collect about 300000 ivs. Collection time for ivs depends traffic for the wireless network.
And again it took about a second to find the key I used.

For more security with WEP use dynamic key provisioning. 128 bit key or more. Then the attacker has to collect more data to hack your network.
Also use MAC filter and disable SSID Broadcast. But do not forget it is possible to change mac address and find your hidden SSID for an attacker.

Wednesday 2 January 2008

Risky WEP 64 bit

This is for testing purpose and it is about my home network. I highly recommend not to access networks you do are not allowed to. This could be illegal for some countries.

I have HP Pavilion dv6000 series (dv6699ea)
I use BackTrack distro live cd (http://distrowatch.com/table.php?distribution=backtrack)
I configured my wireless adsl modem 64 bit key.

After booting linux,
dv6699ea has ipw3945 wireless. You have to start wireless for this version:
cd /usr/src/drivers/ipw3945-1.2.0/ && ./load
aircrack support certain wireless cards please check it
http://www.aircrack-ng.org

Dump from wireless interface
bt ~ # airodump-ng eth1 --write test1

After collecting enough
bt ~ # aircrack-ng test1.ivs

It takes about less than a second to find keys for 64 bit.
So never use 64bit WEP wireless adsl  modem.

I also tried
 atheros based Dlink D520 in Fedora 6
and U.S. Robotics USB Adapter USR805422 in Windows XP.  It worked.