Monthly Archives: May 2012

How to solve long queue qmail.

Damn, I hate mail administration… And I really like google apps (gmail) or appriver mail hosting.

Today we have issue with our corporate qmail server, mail stalled.
To be clear – I change job a week ago and just 5 days as I take care of new infrastructure.
Corporate mail server powered by qmail. Thay have zabbix as monitoring software, but not enough configured, without queue monitorind and SMS escalation. Due to great number of urgent tasks, I really have no enough hands to fix all at once…

So Monday begins with great fuckup… 180 000 messages in queue…
First diagnostic steps:
Read more »

How to verify your domain for GooGle Apps using bind

Damn, dudes from google didnt write howto for verification via bind nameserver.
It`s very very easy, just use @ as record name
Example:

am2# cat randomthemes.com
$ORIGIN .
$TTL 3600       ; 1 hour
randomthemes.com           IN SOA  ns1.randomthemes.com. root.randomthemes.com. (
                                2012052404 ; serial
                                3600       ; refresh (1 hour)
                                900        ; retry (15 minutes)
                                604800     ; expire (1 week)
                                3600       ; minimum (1 hour)
                                )
                        NS      ns1.randomthemes.com.
                        NS      ns2.randomthemes.com.
                        NS      ns3.randomthemes.com.
                        A       87.242.73.112
                        MX      1 ASPMX.L.GOOGLE.COM.
                        MX      5 ALT1.ASPMX.L.GOOGLE.COM.
                        MX      5 ALT2.ASPMX.L.GOOGLE.COM.
                        MX      10 ASPMX2.GOOGLEMAIL.COM.
                        MX      10 ASPMX3.GOOGLEMAIL.COM.

$ORIGIN randomthemes.com.
*                       CNAME   randomthemes.com.
www                     A       87.242.73.112

@       IN      TXT     "google-site-verification=XXXXXXXXXXXXXX-XXXXXX-XXXXXX-XXXXXXXXXXXXXX"

It`s working o.k.!

FreeBSD how to search and install apps from ports

Of course everyone know, how to do it. ๐Ÿ™‚ except me, old Linux geek. ๐Ÿ™‚
First, search for it, second install

ms2# whereis nmap
nmap: /usr/ports/security/nmap
ms2# cd /usr/ports/security/nmap
ms2# make install

Read more »

Find CPU and memory information FreeBSD and Linux

At Linux I use

#cat /proc/cpuinfo

at FreeBSD

ms3# sysctl -a | egrep -i 'hw.machine|hw.model|hw.ncpu|hw.physmem'
hw.machine: amd64
hw.model: Intel(R) Xeon(R) CPU           E5520  @ 2.27GHz  
hw.ncpu: 16
hw.machine_arch: amd64

Read more »

show open ports FreeBSD

In Linux I usually use

#netstat -4nlp

In FreeBSD syntax is different, your should use something like this:

#netstat -atn | grep LISTEN
or
#sockstat -l

df reports negative (minus) value FreeBSD

It was really surprise for me, Today is my first day working with FreeBSD after 11 years linux administration ๐Ÿ™‚

ms3# df -h
Filesystem       Size    Used   Avail Capacity  Mounted on
/dev/mfid0s1a     29G    5.9G     21G    22%    /
devfs            1.0K    1.0K      0B   100%    /dev
/dev/mfid0s1f    213G    9.9G    186G     5%    /hast
/dev/mfid0s1d    2.9G    2.7M    2.7G     0%    /tmp
/dev/mfid0s1g     97G     77G     12G    86%    /usr/local
/dev/mfid0s1e     29G    1.1G     26G     4%    /var
/dev/mfid1s1d    451G    421G   -6.8G   102%    /opt1
linprocfs        4.0K    4.0K      0B   100%    /usr/compat/linux/proc
ms3#

It`s o.k. it means, that I just using reserved space. (available for root, n/a for users.)
Read more »

Lenovo UEFI dual boot Windows7 Ubuntu

Today I had a real brainfuck, how to make Ubuntu and Windows 7 to coexist on my Lenovo Z570.
First I try grub-efi

 convert EFI partition to Fat32
 mount /dev/sda1 /boot/efi
 grub install /dev/sda
 
 mkdir /boot/efi/efi/boot/
 cp /boot/efi/efi/debian/grubx64.efi /boot/efi/efi/boot/bootx64.efi

Gentoo booting O.k., but I cannot make Windows 7 boot.
I copy windows loader efi from Windows/Boot/EFI And BCD (data for loader) at the same folder, and try custom menuitem at grub
It looks like this

menuentry "Win7" --class windows --class os {
  insmod part_msdos
  insmod fat
  set root '(hd0,msdos1)'
  search --no-floppy --fs-uuid --set root MY_UUID_FS
  chainloader $({root})/EFI/Microsoft/BOOT/bootmgfw.efi
}

Damn it`s not working. I`m talking about this wrong ways for you not to try this.

The only way how i make dual boot working.

1. Replace grub-efi with grub-pc (non efi grub build)
aptitude update && aptitude install grub-pc
2. install grub to linux partition my – /dev/sda6
3. Make it boot from Windows loader.

There is 2 way how to make it boot from Windows loader.
1. Use easybcd. (this will install grub4dos fork or other grub fork to load ubuntu from /dev/sda6)
2. Use windows native loader. Here are instructions for Windows 7 (there is no boot.ini at windows7 BCD used instead)

dd if=/dev/sda6 of=/mnt/share/linux.bin bs=512 count=1
bcdedit /create /d โ€œUbuntuโ€ /application BOOTSECTOR
BCDEdit will return an alphanumeric identifier for this entry that I will refer to as {ID} in the remaining steps. Youโ€™ll need to replace {ID} by the actual returned identifier. An example of {ID} is {d7294d4e-9837-11de-99ac-f3f3a79e3e93}. Next, letโ€™s specify which partition hosts a copy of the linux.bin file:
bcdedit /set {ID} device partition=c:
The path to our linux.bin file:
bcdedit /set {ID}  path \linux.bin
An entry to the displayed menu at boot time:
bcdedit /displayorder {ID} /addlast
and finally, letโ€™s specify how long the menu choices will be displayed:
bcdedit /timeout 30

It`s working! Now I have dual boot at this UEFI damned notebook!

How to remove backdore at inittab, left by ISP

Suddenly I found backdore at our servers, leaved by our dedicated server provider, I will not say it`s name, because we already talk to them, get a big discount and solve this issue.
If their engineer press Alt+ArrowUp he obtain a root console, without login record displayed by lastlog.
dump-utmp help ๐Ÿ™‚

r: ~ #aptitude install acct
  r: ~ # dump-utmp /var/log/wtmp

And here is a backdore:

r: ~ # cat /etc/inittab | grep kbre                                                                                                                
  #kb::kbrequest:/bin/echo "Keyboard Request--edit /etc/inittab to let this work."                                                                          
  kb::kbrequest:/sbin/getty -n -l /bin/bash tty12 115200                                                                                                    
  r: ~ #

How to remove it.

 #!/bin/sh
 
  for v in ` mkipsec -l |  awk '{print $1}' | sed s/:/\ / | tr -d '\n' | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g"`;
  do
    s=`echo $v|sed 's/.*\.//'` ;
    printf "$s :\n";
    ssh -q -t  $s "sed -i s/kb\:\:/\#kb\:\:/ /etc/inittab" ;
  done