shellshockfix for old Linuxsystems

Author: Stephan  |  Category: Linux, Netzwerk

Old Systems which are vunerable because wikipedia
shellshock aren’t that easy to update. One method is compilling bash manually ( stolen from ubuntu )

mkdir src
cd src
wget http://ftp.gnu.org/gnu/bash/bash-4.3.tar.gz
#download all patches
for i in $(seq -f "%03g" 0 25); do wget http://ftp.gnu.org/gnu/bash/bash-4.3-patches/bash43-$i; done
tar zxvf bash-4.3.tar.gz
cd bash-4.3
#apply all patches
for i in $(seq -f "%03g" 0 25);do patch -p0 < ../bash43-$i; done #build and install ./configure --prefix=/ && make && make install cd .. cd .. rm -r src

A strange rdiff_backup error and its solution

Author: Stephan  |  Category: Linux, Netzwerk, Sonstiges

After a longer migration of rdiff_backup repository (4 Weeks) I got this strange error

[03/20/13 13:31:44] Exception 'Found too many current_mirror incs!' raised of class
'':
[03/20/13 13:31:44] File "/usr/lib/pymodules/python2.6/rdiff_backup/Main.py", line 304,
in error_check_Main
[03/20/13 13:31:44] try: Main(arglist)
[03/20/13 13:31:44] File "/usr/lib/pymodules/python2.6/rdiff_backup/Main.py", line 324,
in Main
[03/20/13 13:31:44] take_action(rps)
[03/20/13 13:31:44] File "/usr/lib/pymodules/python2.6/rdiff_backup/Main.py", line 280,
in take_action
[03/20/13 13:31:44] elif action == "backup": Backup(rps[0], rps[1])
[03/20/13 13:31:44] File "/usr/lib/pymodules/python2.6/rdiff_backup/Main.py", line 337,
in Backup
[03/20/13 13:31:44] backup_final_init(rpout)
[03/20/13 13:31:44] File "/usr/lib/pymodules/python2.6/rdiff_backup/Main.py", line 501,
in backup_final_init
[03/20/13 13:31:44] checkdest_if_necessary(rpout)
[03/20/13 13:31:44] File "/usr/lib/pymodules/python2.6/rdiff_backup/Main.py", line 916,
in checkdest_if_necessary
[03/20/13 13:31:44] need_check = checkdest_need_check(dest_rp)
[03/20/13 13:31:44] File "/usr/lib/pymodules/python2.6/rdiff_backup/Main.py", line 907,
in checkdest_need_check
[03/20/13 13:31:44] assert len(curmir_incs) == 2, "Found too many current_mirror incs!"

What happened ? Because of the very long Migration of the repository more than one current_mirror Statusfiles had been synced.
In the errormessage above it had been two files .
how to solve ?
Simply delete in all rdiff_datadirs all current_mirror* files except the newest one and your rdiff_backup is running again

Apache solr search for my blog

Author: Stephan  |  Category: Linux, Netzwerk, Sonstiges

After a long time I finished Integrating my blog into an Apache Solr Search Server

version control ist not only for developers

Author: Stephan  |  Category: Linux, Sonstiges, windows

Who doesn’t know this:
“If I only had an old version of my bookmarks, my curriculum or another important office document”
This is the point to think about version control like developers use for Code.
One version control tool usable for this is git.
Git was developed by Linus Torvalds and others for the Linux Kernel but it also exist a windows version.
Lets make our first repository

cd mydir
git init
git add .
git commit

How track down Changes ?
git status
git diff

Commit History
git log
Howto revert the last commit
git revert HEAD

A useful link

https://git.wiki.kernel.org/index.php/GitCheatSheet

Numlock Madness with my ubuntu netbook

Author: Stephan  |  Category: Linux, Netbook

Last weekend my netbook had a very strange behaviour. When pressed “O” a “6 “appeared instead .; instead of a “.” a “,” appeared and so one.
It was the behaviour of a constantly pressed FN Key.
After an hour of debugging I found the solution. I used an external keyboard some days before ( with NUM Lock ) and my system saved this setting. releasing NUM Lock and the strange behaviour was gone.

Howto repair a server’s filesystem without rebooting

Author: Stephan  |  Category: Linux, Netzwerk

When you got the message that a drive is readonly because of a faulty filesystem or journal was aborted you want to repair it without rebooting especially if the computer is a remote server.

First shutdown all processes accessing the Filesystem
fuser -v -m /home/

If you have subdrive , umount them first
umount /home/myhome

then
tune2fs -O ^has journal /dev/sda7
fsck /dev/sda7
tune2fs -j /dev/sda7

restart stopped services again

OpenLDAP Backup

Author: Stephan  |  Category: Linux

The easiest way to backup your LDAP is slapcat:

linux ~# /usr/sbin/slapcat -l backup.ldif
Restore:

linux ~# /usr/sbin/slapadd -l backup.ldif

Last but not least – a redundant internet connection (Part 4)

Author: Stephan  |  Category: Linux, Netzwerk, openwrt

myNetz
foreword
1.) You need at least 2 Linux Boxes for this. I used my OpenSuse Server with the VDSL Connection and the wrt160NL with Openwrt and UMTS/3G for this. 2 Openwrt Boxes are also suitable
2.) On Openwrt 10.03 I had Problems with Quagga-vtysh so I don’t used it
( On the Suse Box vtysh was working fine)
Main
First you have to install the Quagga Packets. For OpenWRT install

opkg install quagga quagga-libospf quagga-libzebra quagga-ospfd

For the second box please refer to the manual of your distribution.
If you don’t install vtysh , you can access to different consoles with
telnet 127.0.0.1 zebra (2601)
telnet 127.0.0.1 ospfd (2601)

For our case the interesting part is the ospf Configuration
router ospf
router ospf
ospf router-id 192.168.1.254
redistribute kernel
redistribute connected
network 192.168.1.0/24 area 0.0.0.0
neighbor 192.168.1.1
!
!

And the Configuration of the Suse Box

router ospf
ospf router-id 192.168.1.1
redistribute kernel
network 192.168.1.0/24 area 0.0.0.0
neighbor 192.168.1.254
!

Now let us check the routing table on both Boxes
suse# sh ip ro
Codes: K - kernel route, C - connected, S - static, R - RIP, O - OSPF,
I - ISIS, B - BGP, > - selected route, * - FIB route

O 0.0.0.0/0 [110/200] via 192.168.1.254, eth1, 00:04:37
K>* 0.0.0.0/0 is directly connected, dsl0

openwrt# sh ip ro
Codes: K - kernel route, C - connected, S - static, R - RIP, O - OSPF,
I - ISIS, B - BGP, H - HSLS, L - OLSR, M - BATMAN, > - selected route, * - FIB route

O 0.0.0.0/0 [110/200] via 192.168.1.1, br-lan, 00:00:48
K>* 0.0.0.0/0 is directly connected, ppp0

Both Router had their own defaultroutes and the Defaultroute of each other via ospf.
Has one router lost its connection , it has still the one of his neighbor

Source
http://www.taunusstein.net/index.php?option=com_content&view=article&id=62:routing&catid=15:linux

Installing 3G/UMTS ( Huawei e220 ) onto WRT 160nl and Openwrt(Part 3)

Author: Stephan  |  Category: Linux, Netzwerk, openwrt

First we need to install a bunch of packets

opkg install kmod-ar9170 kmod-usb-core kmod-usb-serial comgt kmod-usb-uhci kmod-usb2 kmod-ppp huaweiaktbbo

The E220 has two modes . To switch from USB Stick to UMTS you need huaweiaktbbo

root@OpenWrt:~# huaweiAktBbo
Searching modem...found supported modem!
Modem poked!

Its a clever idea to put it into init.d for startup. I used this script by Simon Josefsson


root@OpenWrt:/etc/init.d# cat huaweiAktBbo
#!/bin/sh /etc/rc.common
# Written by Simon Josefsson 2009-03-05. Released into the public domain.

START=70
start() {
huaweiAktBbo
}

Make the script accessible and enable it
And you need the following

root@OpenWrt:/# cat /etc/modules.d/60-usb-serial
usbserial vendor=0x12d1 product=0x1003

Then Reboot the Router

Next step ist to get ppp working. My working scripts ( I had a few tries before I found a working config)

root@OpenWrt:/# cat /etc/chatscripts/3g.chat
ABORT BUSY
ABORT 'NO CARRIER'
ABORT ERROR
REPORT CONNECT
TIMEOUT 10
"" "ATX"
OK "ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0"
OK 'AT+CGDCONT=1,"IP","$USE_APN","0.0.0.0"'

SAY "Calling UMTS/GPRS"
TIMEOUT 30
#OK "ATD*99***1#"
OK "ATD*99#"
CONNECT ' '


root@OpenWrt:/# cat /etc/ppp/options
115200
logfile /dev/null
noaccomp
nopcomp
nocrtscts
lock
maxfail 0
lcp-echo-failure 0
lcp-echo-interval 0
ipcp-max-failure 30


root@OpenWrt:/# cat /etc/config/network
...
#### UMTS configuration
config interface ppp0
option ifname ppp0
option proto 3g
option device /dev/ttyUSB0
option 'service' 'umts'
option apn internet.eplus.de
option pincode 0000
option 'defaultroute' '1'
option 'peerdns' '1'

With an ifup ppp0 , the 3G modem should start connecting

My Sources
http://www.it-slav.net/blogs/2010/06/12/howto-use-3g-dongle-huawei-e1750-in-openwrt/
http://josefsson.org/openwrt/dongle.html

Another try with the wrt160nl and openwrt(Part 2) – Installing virtual WLANs

Author: Stephan  |  Category: Linux, Netzwerk, openwrt

The next goal was the Konfiguration of two “virtual” WLANs on one physical router ; one private and protected WLAN and one open for Guests ( otherwise protected )

The Code is very simple :

config wifi-iface
option device radio0
option network lan
option mode ap
option ssid Secret-WLAN
option encryption psk
option key Secret
option hidden 1

config wifi-iface
option device radio0
option network lan2
option mode ap
option ssid OpenWLAN
option encryption none
option hidden 1

At last , you need a virutal ethernetdevice as bridiging point for the Second WLAN

config interface lan2
option ifname eth0.2
option type bridge
option proto static
option ipaddr 172.27.1.1
option netmask 255.255.255.0