By zoki | 9 april, 2011 - 12:18 - Posted in teknik

Som de flesta redan vet, är adressrymden i IPv4 begränsad till ca 4 miljarder adresser, ett utrymme som snart tar slut. Lösningen på problemet är att gå över från IPv4 till IPv6 som har 128-bitars adressrymd och således nästintill obegränsat med IP-adresser.

Även om IPv6 protokoll funnits i 12 år, så är användningen, konstigt nog, fortfarande låg. Många företag och ISP-er har fortfarande varken börjat implementera eller planerat att implementera IPv6 inom snar framtid. Något som jag tror kommer ändras väldigt snart i takt med att adresserna tar slut.

Statusen för IPv4 är sådan att centralorganisationen för adressallokering, IANA, redan för några månader sedan delade ut sina sista block till RIR-en (Regional Internet Registry), och inom loppet av två veckor räknar man att första RIR-en (APNIC) kommer dela ut sina sista adresser till lokala ISP-er och företag. Det kommer troligtvis vara ett uppvaknande för många IT-chefer och ansvariga runt om i världen.

Jag jobbar som IT-ansvarig på ett svenskt företag och för ungefär två månader sen införde jag IPv6. Nu tänkte jag beskriva processen jag valde, vilka svårigheter jag stötte på, allt taget ur verkligheten med faktiska exempel. Konkreta exempel på ”hur?” var väldigt svårt att hitta när man väl bestämde sig för utrullning.

Vi har 2 kontor, med varsin internet-förbindelse samt en dedikerad förbindelse mellan kontoren. IP-Only är leverantör av alla våra förbindelser.

Redan på planeringsbordet var jag säker på att största och absoluta kravet var att verksamheten inte fick bli störd på något sätt, något som kan tyckas självklart, men kan vara lite mindre självklart hur man lyckas med.

Andra kravet var att IPv6 ”stödet” skulle vara ”native”-stöd, alltså inga halvdana tunnellösningar med tredje part som ändå kanske måste migreras bort inom några år.

Tredje kravet var att säkerheten inte skulle bli lidande (ingår delvis i krav 1).

Mer krav än så fanns det inte i det skedet.

Det bästa sättet att implementera IPv6 är att börja utifrån och arbeta sig inåt mot nätverken. Med andra ord, se till att man har en IPv6 förbindelse som fungerar, sedan en brandvägg som stödjer IPv6, ett DMZ med företagets web, dns och mailserver som stödjer IPv6, och slutligen resten av interna nätverket.

Nu till problemen.

1 Det största problemet de flesta kommer att ha är att få sin ISP att faktiskt leverera IPv6. I mitt fall hade jag en ISP som var ett av de första i Sverige att erbjuda IPv6 (IP-Only) så efter en beställning, hade jag ett par dagar senare, IPv6 levererat till båda av våra kontor. Jag kan tänka mig att problemen kan variera från allt att ISPns säljorganisation inte riktigt vet vad IPv6 är, till att man har svårt att få rätt vägledning om ”vad” man egentligen ska beställa. Jag följde RIPE-s rekommendationer och beställde två konsekutiva ”/48”-prefixer till våra två kontor.

2. Det andra stora problemet är ens egen okunskap. På många sätt hade det varit bättre ifall IPv6 hade varit väldigt olikt IPv4, för då hade man behövt starta från början, men i det här fallet upplevde jag skillnaderna i protokollen förvirrande. I IPv4 är man van att tänka i ”nätmask”-format och det beteendet lever kvar ganska länge i huvudet, trots att begreppet inte existerar i IPv6 utan ”prefix” används istället. Prefix är egentligen enklare att förstå än ”nätmask” som ”maskar av” subnätet från den signifikanta adressen.

3. Det tredje problemet var att säkerställa att verksamheten inte blir störd. Att utföra en så pass fundamental förändring som införande av nytt protokoll i en heterogen miljö med otroligt många separata system, innebär risk att något inte fungerar som det ska eller slutar fungera helt och hållet.

4. Fjärde problemet är avsaknad av IPv6 stöd i utrustningen. Efter en analys av detta problem kom jag till slutsatsen att endast våra brandväggar är berörda. Våra core routrar är vanliga linuxmaskiner så IPv6-stöd fanns, och switcharna managerades via ett management-nät så jag bestämde helt enkelt att inte tvinga IPv6 på det nätet.

Dessa 4 problem visste jag om redan på planeringsbordet. Nu till utförandet!

Problem 1 löstes för 1 år sedan då vi valde en operatör som redan hade IPv6 i sin portfölj. Nog tänkte jag inte på det då, men idag är jag glad att jag valt IP-Only.

Problem 2 löstes genom att leta information på nätet och fördjupa sig i hur protokollet fungerar. Även om det är ”enkelt” att konfigurera ett nät att köra IPv6 så krävs det förståelse och kunskap för att möta upp de kraven om säkerhet, tillgänglighet och för att undvika att störa verksamheten.

Problem 3 är ett problem som måste lösas kontinuerligt i varje delmoment man gör. Ett av de självklara valen man måste göra är att köra ”dual stack configuration”, d.v.s. man kör båda protokollen samtidigt. En värd har då både en IPv4 och IPv6-adress och kan kommunicera genom att använda sig av båda. Notera också att de flesta operativsystem automatisk väljer IPv6 om det är möjligt, och det är viktigt att man kommer ihåg det annars kan man stöta på problem. Jag återkommer till detta senare.

Problem 4 var lite svårare. Även om alla våra interna routrar hade stöd för IPv6 (och jag valde att lämna switcharna på IPv4), så hade inte våra brandväggar det. Som det såg ut då kunde jag varken byta ut dem, eller uppgradera dem utan att störa verksamheten. Därför löste jag det genom att sätta upp helt nya brandväggar. I mitt fall blev det m0n0wall som installerades. Nog duger det med standard-linux med ip6tables, men just i det här skedet kände jag att jag inte ville lägga till fler möjligheter för misstag. M0n0wall har exemplariskt enkelt gränssnitt och stödet för IPv6 är riktigt bra.

När brandväggarna var installerade på vardera av kontoren och mina /48-prefixer levererade var det bara att sätta igång med praktiska implementationen. I m0n0wall måste man först slå på IPv6 stöd. Därefter har man möjlighet att mata in IPv6-adresser på de olika interfacen. Mina 48-or levererades över ett länknät, så jag började med att konfigurera mina WAN-interface i enlighet med informationen jag fick från IP-Only. Länknätet har 64-bitars prefix och mitt WAN måste ha den IP-adressen som min ISP angivit eftersom den IP-adressen används för routingen av det 48-nätet jag fått. Viktigt att komma ihåg är att man ser till att ”router advertisment” är avstängt på det interfacet. En sak jag saknade med m0n0wall är möjligheten att endast konfigurera IPv6 och lämna IPv4 okonfigurerat, men det gick inte i web-gränssnittet.  I det här skedet gick det inte att pinga exempelvis ”ipv6.google.com” troligtvis för att trafiken kom från vårt länknät som inte nödvändigtvis var globalt routad.

Nu till konfigureringen av vårt 48-nät. Innan jag fortsatte kontrollerade jag att det inte fanns några för ”generösa” IPv6-brandvägsregler. Det är vanligt (men felaktigt enligt mig) att administratörer slappnar av när de kör NAT på sina brandväggar för att man ”inte kan nå” värdar innanför nätverket och därför ibland slarvar med brandväggsregler. Med IPv6 är det inte nödvändigt att NAT-a och det medför att all slarv innebär öppna hål i brandväggen. När jag var säker på att all IPv6-trafik blockerades var det bara att fortsätta. Första frågan är hur man hanterar det 48-nätet som vi tilldelats. Att konfigurera LAN interfacet med det 48-nätet vore dumt, så jag valde att dela upp det i mindre subnät. Vi har ett antal olika subnät i IPv4, alla med olika VLAN-ID i våra switchar. Jag bestämde att varje IPv4 subnät skulle få ett motsvarande /64-bitars prefix i IPv6. (liten kuriösa: ett /48-bit prefix innehåller 65 536 /64-bit prefix. Om varje anställd skulle få en IP-adress för varje cell i sin kropp, skulle jag ha adresser för ungefär 32 000 anställda).

Låt oss säga att 2001:0DB8:4096::/48 är vårt 48-bitars nät jag fått av IP-Only. Det nätet delades upp i /64 bitars prefix som i sin tur tilldelades till var sitt VLAN. För att få det enklare att administrera och känna igen, valde jag VLAN-ID som den sista 16-bitars gruppen i det 64-bitars prefixet. Dvs VLAN med VLAN-ID 3 tilldelades 2001:0DB8:4096:3::/64 och så vidare.

Först konfigurerades LAN-interfacet med 2001:0DB8:4096::1/64. Nästa interface att konfigurera var vår DMZ  (VLAN ID 7 hos oss) med ett antal servrar däribland våra web-, dns- och mail-servrar. Följande min plan konfigurerade jag 2001:0DB8:4096:7::1/64 på DMZ-interfacet. Där slog jag på router advertisment. Genom att logga in på en av maskinerna i DMZ kunde jag konstatera att den omedelbart konfigurerades med korrekt prefix och route, mha SACP (Stateless autoconfiguration protocol). Jag bekräftade att alla servrar på det nätet hade gjort det och verifierade att de kunde kommunicera med varandra. Därefter fortsatte jag sedan att titta genom brandväggsregler. Jag öppnade upp i brandväggen för ICMP6 och testade att pinga ipv6.google.com från DMZ. SUCCESS!

Därefter anpassade jag brandväggsreglerna att tillåta trafik till de tjänsterna som kördes i DMZ, http, https, smtp, dns. Jag återigen dubbelkontrollerade att ingen trafik tilläts från DMZ till våra interna nät (mer än svarstrafik). Eftersom det är svårt att testa IPv6 access utifrån (man har ingen tillgång till andra IPv6-kapabla hostar på Internet), fick det duga med lokala tester.

Först ute var Apache på vår webbserver. Den svarade inte på IPv6 adressen. Efter att ha dubbelkollat att ingen IP-adress fanns specificerad i ”Listen”-direktivet krävdes det bara att starta om processen och så började den svara.  För att den ska lättare hittas utifrån, adderade jag en AAAA-post i vår DNS som pekade på serverns IPv6-adress och vips, vi var online på IPv6 med vår webbserver.

(En sak jag noterade senare efter att ha tittat på hur ”andra” gjort det, var att jag använde SACP-adressen för vår AAAA-record, vilket blev något i stil med: 2001:0DB8:4096:7:10dd:10ff:fed7:1a36  . De flesta andra jag tittat på, använder istället en ”enklare” adress vilket man får sätta manuellt. Tekniskt har det ingen betydelse, men jag antar att det blir lite ”snyggare”. Dvs något i stil med: 2001:0DB8:4096:7::5 eller liknande).

Vår mailserver kör mailsystem Zimbra, ett mailsystem som består av Postfix, Spamassassin och ett antal andra ”open source” delar. Jag räknade med att det som behövde “IPv6-anpassas” var de delar som behövde kommunicera med omvärlden, dvs Postfix som pratade SMTP, Zimbras egna IMAP-mjukvara, samt webbservern som tjänstgjorde som webmail samt administrationsgränssnitt. Det visade sig att det enda som krävdes för att få den att fungera med IPv6, var att konfigurera Postfix att lyssna på alla interfaces (inet_interfaces all) och sedan starta om hela Zimbra. Resten band till IPv6-interfacet automatiskt.

Därefter var det bara att lägga in en ny AAAA-post i DNS-en och vips så tar vi emot mail via IPv6.

När man lägger till AAAA poster har man ett val. Antigen lägger man en AAAA-post som är ett eget unikt namn (ipv6.example.com, såsom Google exempelvis gör), eller så lägger man till en AAAA-post till det namn man redan har en A-post för (www.example.com med både A och AAAA-post).

För mig var det obegripligt varför man skulle vilja ha två olika unika namn för olika protokoll med det utkristalliserades allt eftersom jag fortsatte med utrullningen. Om man har en AAAA-post, med samma namn som A-post, och en dual-stack klient försöker skapa en förbindelse, så kommer de flesta implementationerna föredra IPv6 så fort de har något mer än ”link-local” adress på någon av sina interfaces. Om det nu är fel med routingen eller brandväggsregler eller vad det nu kan vara under utrullningen, kommer klienten vänta… vänta…vänta… och sedan ge upp och falla tillbaka till IPv4. Den fördröjningen blir uppemot 10-20 sekunder, vilket är inte alls acceptabelt av de flesta. Det innebär att du bör kolla, INNAN du skapar AAAA-poster som heter likadant som A-poster, att den IPv6-adressen är nåbar från alla håll. I synnerhet om du ska skapa en sådan post för det interna nätverket. Ett tips är att använda sig av /etc/hosts eller c:\windows\system32\drivers\etc\hosts för att testa din IPv6 anslutning innan några AAAA-poster sätts upp,  eller så kommer du få många skrik av dina användare.

Jag spenderade en del tid på att göra en del tester på våra maskiner i DMZ innan jag fortsatte vidare inåt.

Innan man börjar låta servrar och klienter köra IPv6 på interna nätverket är det återigen läge att trippelkolla sina brandväggsregler, eftersom de får adresser som är globalt nåbara.

I vårt fall sitter vår brandvägg direktförbunden via ett management-nät med vår core router (en linuxmaskin) som är ansvarig för att routa mellan olika subnät. Alla servrar och klienter pratar endast med routern vilken i sin tur routar Internettrafik via brandväggen  ut. På management-interfacet (det som sitter på samma VLAN som brandväggen) konfigurerade jag adress 2001:0DB8:4096::2/64 och satte 2001:0DB8:4096::1 som default route (I mitt fall pekar detta på annan maskin än IPv4 eftersom jag satte upp separat brandvägg för IPv6-trafik). På resten av interfaces, satte jag upp /64-bitars prefix motsvarande det VLAN-ID som användes på det subnätet:
2001:0DB8:4096:50::1/64

2001:0DB8:4096:51::1/64

2001:0DB8:4096:60::1/64

I m0n0wall adderade jag statiska routes till dessa subnät via 2001:0DB8:4096::2.

Jag kunde verifiera med hjälp av ping6 att jag hade anslutning till ipv6.google.com. Det som återstod var att se till att klienterna får information om prefix och routes. Eftersom routern kör Linux, installerade jag radvd (Linux IPv6 Router Advertisment Daemon) och såg till att operativsystemet vidarebefordrade IPv6-paket. Efter att ha gjort en simpel konfiguration av radvd, startade jag upp den. Direkt efter kontrollerade jag IP-informationen på min dator. Interfacet kopplat till det subnätet hade omedelbart fått information om prefixet samt route. Ett snabbt test med ping6 mot ipv6.google.com bekräftade resultatet. Likaså fungerade det också med en browser.
Jag tog då en promenad genom kontoret och bad slumpmässigt valda personer att testa med en browser och det fungerade för alla.

Sammanfattningsvis gjorde jag följande saker för att rulla ut IPv6 på ett av kontoren:

  1. Satte upp en separat brandvägg (kanske inte nödvändigt för de som redan har IPv6-kapabla brandväggar)
  2. Konfigurerade WAN på brandväggen
  3. Konfigurerade LAN på brandväggen (management nät)
  4. Konfigurerade DMZ på brandväggen med router advertisment påslaget)
  5. Konfigurerade Interfacen på core routern
  6. Konfigurerade statiska routes till de olika subnäten på brandväggen
  7. Installerade och konfigurerade Radvd på routern

Med 7 steg gjordes en komplett utrullning av IPv6 på kontoret. Andra kontoret utrullades på samma sätt, med addition av ett direkt länknät mellan core-routrar samt nödvändiga routes som möjliggjorde intern kommunikation mellan näten.

Nästa blogginlägg kommer innehålla lite mer av mina erfarenheter kring utrullningen.

By zoki | 11 mars, 2011 - 07:18 - Posted in teknik

Turning off computers is soo 80-s.

Just had a kickstart installation install complete OS on the ”wrong disk”.

/dev/sda1 was 300Mb on /boot (correct)
/dev/sdb1 was 1Tb on / (wrong, I wanted it on /dev/sda2)

[root@phoebe ~]# mount
/dev/mapper/vg00-root on / type ext3 (rw)

Volume group ”vg00″ contained only /dev/sdb1 as phys-device and I wanted it on /dev/sda2

So you run:

[root@phoebe ~]# pvcreate /dev/sda2
Physical volume "/dev/sda2" successfully created
[root@phoebe ~]# vgextend vg00 /dev/sda2
Volume group "vg00" successfully extended
[root@phoebe ~]#

Now we move the data:

[root@phoebe ~]# pvmove /dev/sdb1 /dev/sda2
/dev/sdb1: Moved: 16.9%
/dev/sdb1: Moved: 33.3%
/dev/sdb1: Moved: 50.2%
/dev/sdb1: Moved: 67.6%
/dev/sdb1: Moved: 84.0%
/dev/sdb1: Moved: 85.4%
/dev/sdb1: Moved: 100.0%
[root@phoebe ~]#

And remove the /dev/sdb1 from the volume group:


[root@phoebe ~]# vgreduce vg00 /dev/sdb1
Removed "/dev/sdb1" from volume group "vg00"
[root@phoebe ~]#

Easy ey? 4 commands (”mount” wasn’t necessary). You gotta love LVM.

By zoki | 9 februari, 2011 - 17:49 - Posted in diverse

This is how it starts. Björn messes with my desk, and Andreas as the backstabber he is, just watches (and helps out).

Now, it’s all right, I can take it, but when these to start bullying me by sending me pics of the desk, it’s time for a small revenge. This is how you do it.

1. Send an email to corporate mail list that includes all employees with a warning about a terrible new virus that basically collects all your secret data and sends it to <somewhere>. You say that if they notice symptoms they must turn off the computer and contact you, pending reinstallation. As a side note, point out that some of the previous victims sometimes reported that all images on web pages were up side down.

2. Of course, before you execute point 1. make sure that only your victims are on the ”corporate mail list that includes all employees”. You don’t want to be spamming everybody.

3. Fire up a proxy (Squid will do perfectly), and make it use a script that will be turning your images upside down. For Squid, following configuration is significant:

url_rewrite_program /usr/bin/upsidedown.pl
location_rewrite_program /usr/bin/upsidedown.pl
Where /usr/bin/upsidedown.pl is something like (this one borrowed from http://www.ex-parrot.com/pete/upside-down-ternet.html, but you get the principle):
#!/usr/bin/perl
$|=1;
$count = 0;
$pid = $$;
while (<>) {
        chomp $_;
        if ($_ =~ /(.*\.jpg)/i) {
                $url = $1;
                system("/usr/bin/wget", "-q", "-O","/opt/WebPages/images/$pid-$count.jpg", "$url");
                system("/usr/bin/mogrify", "-flip","/opt/WebPages/images/$pid-$count.jpg");
                print "http://172.25.0.1:81/images/$pid-$count.jpg\n";
        }
        elsif ($_ =~ /(.*\.gif)/i) {
                $url = $1;
                system("/usr/bin/wget", "-q", "-O","/opt/WebPages/images/$pid-$count.gif", "$url");
                system("/usr/bin/mogrify", "-flip","/opt/WebPages/images/$pid-$count.gif");
                print "http://172.25.0.1:81/images/$pid-$count.gif\n";

        }
        else {
                print "$_\n";;
        }
        $count++;
}
Make sure you adapt the script so it saves the images somewhere where they are available through a web-server, and adapt that correct IP address is output by your script.
4. Also, configure Squid to support ”transparent”-mode. So instead of http_port 3128, configuration should be
http_port 3128 transparent

5. If you don’t know the IP-addresses your victims are using, have a look in the logs of the services that those numbnuts are probably using, searching for their usernames. In my case, it was matter of seconds to find them in our mail server logs.

6. Login to one of the routers that your vicims pass. Put a simple iptables-rule to redirect the IP-s to your ”trap”:

[0:0] -A PREROUTING -s  <victim ip> -p tcp -m tcp --dport 80 -j DNAT --to-destination <proxy ip>:<proxy port>

(For this to work, you will need nat table in your iptables. This is not created per default. Something like this will create it for you:

*nat
 :P REROUTING ACCEPT [0:0]
 :P OSTROUTING ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]

7. Wait for your reward. Now, in retrospect, sending email to them, also gave them a possible suspect. Still, seeing them in your logs googling like possessed for more info about the virus is hilarious. Can you see their faces is also a bonus.

By zoki | 28 januari, 2011 - 17:19 - Posted in diverse
V2UgYXJlIGxvb2tpbmcgZm9yIGEgcGFzc2lvbmF0ZSBhbmQgZXhwZXJpZW5jZWQgU3lzdGVtIEFk
bWluaXN0cmF0b3IuCgpXZSB3YW50IHlvdSB0byBoYXZlOgoqIEV4cGVyaWVuY2UgZnJvbSBzZXR1
cCwgbWFpbnRlbmFuY2UgYW5kIHN1cHBvcnQgb2YgTGludXggc2VydmVycyBhbmQgSVAgbmV0d29y
a3MKKiBFeHBlcmllbmNlIGZyb20gc3lzdGVtIGFkbWluaXN0cmF0aW9uCiogS25vd2xlZGdlIGFi
b3V0IHNjcmlwdGluZy9hdXRvbWF0aW9uIG9mIGRlcGxveW1lbnRzIGFuZCB1cGdyYWRlcwoqIEEg
c2VydmljZS1taW5kZWQgYXR0aXR1ZGUsIHRvIGJlIGFibGUgdG8gaGFuZGxlIDE6c3QtbGluZSBx
dWVzdGlvbnMgZnJvbSBvdXIgY3VzdG9tZXLigJlzIChtYWlubHkgVFYtb3BlcmF0b3LigJlzKSBJ
VCBkZXBhcnRtZW50cwogCklkZWFsbHkgeW91IGFsc28gaGF2ZSBrbm93bGVkZ2Ugb2YgdGVjaG5v
bG9naWVzIGxpa2UgdmlydHVhbGl6YXRpb24sIE1QRUcsIFJUU1AsIERWQiwgQ0FTLCBNaWRkbGV3
YXJlLCBTVEIsIEhlYWRlbmQgYW5kIElQVFYgZnVuZGFtZW50YWxzLgoKU2VuZCB5b3VyIGFwcGxp
Y2F0aW9uIHRvIGNoYWxsZW5nZUBkcmVhbXBhcmsuY29tCgo=
By zoki | 25 december, 2010 - 12:07 - Posted in barnen

Santa is real! Did you know that? Of course you did. You’ve seen him when you were a child. I’ve seen him when I was a child. Remember the feeling? I actually do when I think about it. There are not many ”feelings” from childhood I do remember, but this feeling of anticipation combined with faith, beleving in that mystical red man, I do. I remember that wasn’t my dad who dressed up like Santa (although, physically he’d be perfect), but it was some corporate Santa that was arranged by his ”company” (the state actually). I remember waiting in the company aula where the Santa finally arrived and then started calling up the names. It was magical. He was REAL. I had no doubt in my mind that there was a reindeer sled outside waiting for him (in fact there was, but that it could fly).

The thing is, we say that Santa comes to all good kids and gifts them if they had been nice. The older we get, the more we start noticing that dad is missing EVERY time Santa arrives, that Santa has remarkably similar hands to dad’s, or that dad had this strange piece of white cotton in his face when he ”came back from the store”. We are getting older and not little kids any more. We precept that we are understanding that dad is the Santa, but what happens is that the Santa is gradually turning us over to our parents instead. Magic doesn’t just disappear. It gradually weakens as we grow bigger. The smallest ones are still left in the veil of magic. It’s in their harts, their eyes, and their minds.

Yes, I do dress up in red, put the beard on, and go ”Ho ho Marry Christmas” with a funny distorted voice, but to become Santa, magic is required.

Yesterday, our family got visited by Santa. I was, like always, out to get some olive oil (papers don’t work for us as the kids always wanted to see if I bought some children’s magasine, catching me ”red handed”, since all shops nearby are closed). Anyway, the Santa gave the presents, encouraged the kids to be as good as they were the past year, and went towards the door to ”serve all the other children in the world”. Michel (5 years) runs after him and says: ”Santa, I’ll run to the window now and watch you fly away with your reindeer”.  Now, what is that if not magic?

So Santa may not actually be a person, a human that lives on North pole, but put a little makeup, a scary fake beard, too small red clothes, a big portion of love for your kids, and the big portion of beautiful magic from the harts of your kids and the Santa is very much real, and alive.

By zoki | 12 juli, 2009 - 11:48 - Posted in diverse

Sometimes you need to compile a package as superuser (root), or test a package upgrade, or test a complete system upgrade. Doing so is a risky operation and could (and has) cause(d) severe damage. If there are no other options but doing this on production system (for instance the production system is the only remaining system with exactly that combination of hardware, OS, compiler, and so on), following procedure can be used to do it more or less safe.

There are different methods to achieve this, depending on how the system is configured. This instruction will be based on Logical Volume Management in Linux. I relies on that LVM is able to create RW-snapshots of LV. Same thing can probably be accomplished using similar filesystem features on different OS-es and architectures.

The base for this operation is creating a chroot-environment for our process, and a snapshot copy of our filesystems. We will enter a chroot-shell, do our operations on the snapshot-filesystem, extract our result to the ”real” filesystem if applicable, and then destroy the snapshot.

So, let’s create snapshot for our operation:

[root@titania ~]# lvcreate -s -L 1G -n root-mirror -p rw /dev/vgr01/root
Logical volume "root-mirror" created

This will create a rw snapshot LV called ”root-mirror” from ”root” LV in our ”vgr01″ volume group. This snapshot will contain 1Gb of free space for our changes. If you know you will need more, substitute 1G to whatever you might need, given that your volume group has enough unallocated space.

In similar manner, create any additional partitions that might be needed (for example /var, /tmp, /opt, /usr if they are not on same partition as /).

Remember: on Linux system, /boot can’t reside on a LV. In this tutorial, we will not mount it, and in our chroot-environment it will be empty. If you need it for some reason (to test upgrade of kernel or grub), and you happen to have it on a md-mirror, you could split the mirror and use that. But this is beyond the scope of this tutorial and also a very risky operation.

Now we mount our ”snapshot”:

[root@titania ~]# mkdir /mirror
[root@titania ~]# mount /dev/vgr01/root-mirror /mirror

Make sure it’s really mounted. If your system consists of several partitions (/var,/usr and so on), you need to mount them in consecutive order. ”/” needs to be mounted first and following partitions need to be mounted properly relative to the ”/”. Now we ”chroot” to it:

[root@titania /]# chroot /mirror
[root@titania /]# pwd
/
[root@titania /]# ls
bin dev export lib matrix misc net proc sbin software sys usr
boot etc home lost+found media mnt opt root selinux srv tmp var
[root@titania /]#

The output does not reveal whether we succeeded or not, but if we create a file in our ”mirror” and exit the chroot-environment we can see that it’s working:

[root@titania /]# touch test.chroot
[root@titania /]# ls /
bin dev export lib matrix misc net proc sbin software sys tmp var
boot etc home lost+found media mnt opt root selinux srv test.chroot usr
[root@titania /]# exit
exit
[root@titania /]# ls /
bin dev export lib matrix mirror mnt opt root selinux srv tmp var
boot etc home lost+found media misc net proc sbin software sys usr
[root@titania /]# ls /mirror
bin dev export lib matrix misc net proc sbin software sys tmp var
boot etc home lost+found media mnt opt root selinux srv test.chroot usr
[root@titania /]#

Now we can go back to our chroot-environment and start building/testing:

[root@titania /]# chroot /mirror
[root@titania /]#
.... DO OUR BUILDING STUFF HERE....
[root@titania /]#
[root@titania /]# exit
exit
[root@titania /]#

Your build/test is ready. Any changes/results/files are found in /mirror-directory. Make sure you copy it to the real filesystem before you destroy the snapshot LV.

Now it’s safe to unmount and remove our snapshot LV (and of course, WARNING FOR TYPOS HERE!!!!):

[root@titania /]# umount /mirror
[root@titania /]# lvremove /dev/vgr01/root-mirror
Do you really want to remove active logical volume "root-mirror"? [y/n]: y
Logical volume "root-mirror" successfully removed
[root@titania /]#

DISCLAMER:This tutorial is for people who know what they are doing and know LVM. This method works for me on my systems and I believe it will work on most of the systems out there. However I’m not offering any guarantee that it will work on yours, or not make your system unusable. You have been warned!

By zoki | 15 juni, 2009 - 11:36 - Posted in diverse

As I wrote in my previous post, I’ve got a classified ad on Eniro where I sell a Dell workstation. Prevously I got replies to that ad that were obviously generated by spam-bots.

Yesterday, I’ve got a reply that said:

””"

Hej!
Detta är en intresseanmälan från Eniro Köp & Sälj!

Hej,
       Jag såg din annons och jag är verkligen intresserad av
att köpa ditt objekt, priset 3500,00 Sek är väl okej för mig.
Vänligen gå tillbaka till mig för att slutföra överföringen.
Hoppas att läsa från dig soonest.

Tack.

””"”

I noticed directly that this was obviously translated by google or babelfish, so in order to avoid revealing my email address, I copied this to my Windows-Live account and replied from there.

””"

Hej,

Kan du berätta var du finns i Sverige så jag kan kolla
vilka fraktmöjligheter det finns?

Dessutom kan jag inte skicka maskinen förän tisdag
tidigast, men troligtvis onsdag. Är det OK?

Med vänliga hälsningar
Zoran

””"

Just couple of minutes later, I got another reply, this time in english:

””"
Hello,
My Name is Dallas Martins, i will like to buy and ship the laptop to my son internationally. Get back to me with the following information so that i can make the payment immediately via Bank transfer:
Name:
Address:
Bank Name:
Account Number:
IBAN:
BIC:
Name of the Item:
Cost of the item including shipping cost through TNT Global Express (EMS Speed Post) or Swedish Registered Priority post:
This is the address of my son who will receive the item in internationally
Name: Kabir.A.Martins
Address:No. 10 Iremo Road,
P.O.Box 20,
Ile-Ife,
Osun State,
Nigeria (234036)
I’ll wait for your reply
Thanks
Hope to read from you soonest.
””"

Lovely. Googling for ”Kabir.A.Martins” gave some really interesting hits. Most of those hits were describing replies to classifieds that looked exactly like this one. A good thing about having his direct email was that I was able to retrieve the IP-address of the computer that was origin of the email.

””"

X-Message-Delivery: Vj0xLjE7RD0wO2w9MQ==

X-Message-Info: JGTYoYF78jEHjJx36Oi8+Z3TmmkSEdPt3Mi6GgUSv7y
YKHQgGfDe+2wCW4LegkYQav29Pp7Mm4E=

Received: from snt0-omc3-s2.snt0.hotmail.com ([65.55.90.141])
 by snt0-hmmc2-f9.Snt0.hotmail.com with Microsoft SMTPSVC(6.0.3790.3959);

	 Sun, 14 Jun 2009 22:28:42 -0700

Received: from SNT113-W64 ([65.55.90.135]) by snt0-omc3-s2.snt0.hotmail.com
 with Microsoft SMTPSVC(6.0.3790.3959);

	 Sun, 14 Jun 2009 22:28:42 -0700

Message-ID: <SNT113-W64C06439DFB5BCA00E8F5AA63E0@phx.gbl>

Return-Path: dallasmartins@hotmail.com

Content-Type: multipart/alternative;

	boundary="_aa5c44ab-eab9-406f-b016-58519758cd99_"

X-Originating-IP: [213.239.234.53]
                   ^^^^^^^^^^^^^^

””"

Now I checked that IP:

[root@matrix ~]# host 213.239.234.53
53.234.239.213.in-addr.arpa domain name pointer 213-239-234-53.clients.your-server.de.

Looks like some german computer with broadband connection.


[root@matrix ~]# whois 213.239.234.53
[Querying whois.ripe.net]
[whois.ripe.net]
% This is the RIPE Whois query server #2.
% The objects are in RPSL format.
%
% The RIPE Database is subject to Terms and Conditions.
% See http://www.ripe.net/db/support/db-terms-conditions.pdf

% Note: This output has been filtered.
% To receive output for a database update, use the ”-B” flag

% Information related to ’213.239.234.48 – 213.239.234.63′

inetnum: 213.239.234.48 – 213.239.234.63
netname: ROQUE-HOLDINGS-NET
descr: Roque Holdings Inc
country: DE
admin-c: BSR5-RIPE
tech-c: BSR5-RIPE
status: ASSIGNED PA
remarks: MeshMX.com Anonymizing Network
mnt-by: HOS-GUN
mnt-lower: HOS-GUN
mnt-routes: HOS-GUN
source: RIPE # Filtered

person: Brianda Sanchez Rodriguez
address: Seism Technology S.A
address: La Uruca de el Banco Cuscatlan 3000
address: San Jose, COSTA RICA
phone: +4913122123419
e-mail: support@metropipe.net
nic-hdl: BSR5-RIPE
remarks: Anonymizing networks, all abuse to abuse@metropipe.net
mnt-by: HOS-GUN
source: RIPE # Filtered

% Information related to ’213.239.192.0/18AS24940′

route: 213.239.192.0/18
descr: HETZNER-RZ-NBG-BLK2
origin: AS24940
mnt-by: HOS-GUN
source: RIPE # Filtered

[root@matrix ~]#

So, we got a german IP for a customer in San Jose, that ”sells” anonymization.  OR? Now, whois gives me MeshMX.com Anonymization Network. We can lookup that too:


[root@matrix ~]# whois 88.198.74.14
[Querying whois.ripe.net]
[whois.ripe.net]
% This is the RIPE Whois query server #2.
% The objects are in RPSL format.
%
% The RIPE Database is subject to Terms and Conditions.
% See http://www.ripe.net/db/support/db-terms-conditions.pdf

% Note: This output has been filtered.
% To receive output for a database update, use the "-B" flag

% Information related to '88.198.74.8 - 88.198.74.15'

inetnum: 88.198.74.8 - 88.198.74.15
netname: ROQUE-HOLDINGS-NET
descr: Roque Holdings Inc
country: DE
admin-c: MM4735-RIPE
tech-c: MM4735-RIPE
status: ASSIGNED PA
remarks: MeshMX.com Anonymizing Network
mnt-by: HOS-GUN
source: RIPE # Filtered

person: Matthias Menk
address: Suite #105
address: Markgrafenstrasse 56
address: D-10117 Berlin
phone: +442071932753
fax-no: +41443553587
e-mail: menk.rhc@meshmx.com
nic-hdl: MM4735-RIPE
remarks: Operated by Roque Holdings Corporation.
remarks: Anonymizing networks for
remarks: Cryptohippie Inc., PA
remarks: Please contact abuse@meshmx.com in case of abuse.
mnt-by: HOS-GUN
source: RIPE # Filtered

% Information related to '88.198.0.0/16AS24940'

route: 88.198.0.0/16
descr: HETZNER-RZ-NBG-BLK4
origin: AS24940
org: ORG-HOA1-RIPE
mnt-by: HOS-GUN
source: RIPE # Filtered

organisation: ORG-HOA1-RIPE
org-name: Hetzner Online AG
org-type: LIR
address: Hetzner Online AG
Attn. Martin Hetzner
Stuttgarter Str. 1
91710 Gunzenhausen
GERMANY
phone: +49 9831 610061
fax-no: +49 9831 610062
e-mail: info@hetzner.de
admin-c: GM834-RIPE
admin-c: HOAC1-RIPE
admin-c: MH375-RIPE
admin-c: RB1502-RIPE
admin-c: SK2374-RIPE
admin-c: DM93-RIPE
mnt-ref: HOS-GUN
mnt-ref: RIPE-NCC-HM-MNT
mnt-by: RIPE-NCC-HM-MNT
source: RIPE # Filtered

[root@matrix ~]#

Hey, we have at least a name, email and telephone of the person we can bug about this. A german company that provides anonymization to it’s customers have probably targeted ”porn-hiding-husbands” and might not feel the same about internet fraud. Who knows.

In the meanwhile, I replied to the scamer again. As you might have noticed, he said ”laptop” in his email. I’m not selling laptop. I’m selling a workstation. So I replied kindly that I’m unfortunately selling a professional workstation, not laptop. An hour later, I got another reply, identical to previous, with the word ”laptop” changed to ”Dell”. The good thing with this exercise was that I could find out that he isn’t changing proxys, but uses same one.

However we are not likely to reveal the real IP-address of the scammer. Question is if I can find a way to trick him to give it up. Scammers migh know how to scam people, but hopefully they aren’t that familiar with TCP/IP and can make a mistake.

A quick portscan of the server revealed few open ports of the proxy:

[root@matrix ~]# nmap 213.239.234.53

Starting Nmap 4.20 ( http://insecure.org ) at 2009-06-15 11:02 CEST
Interesting ports on 213-239-234-53.clients.your-server.de (213.239.234.53):
Not shown: 1673 filtered ports
PORT STATE SERVICE
21/tcp open ftp
22/tcp open ssh
24/tcp closed priv-mail
80/tcp open http
81/tcp closed hosts2-ns
82/tcp closed xfer
84/tcp closed ctf
110/tcp open pop3
113/tcp closed auth
143/tcp closed imap
443/tcp open https
444/tcp closed snpp
447/tcp closed ddm-dfm
465/tcp closed smtps
666/tcp closed doom
993/tcp closed imaps
995/tcp closed pop3s
1000/tcp open cadlock
1022/tcp open unknown
1026/tcp closed LSA-or-nterm
1080/tcp closed socks
3128/tcp closed squid-http
8000/tcp closed http-alt
8080/tcp closed http-proxy

Nmap finished: 1 IP address (1 host up) scanned in 147.369 seconds
[root@matrix ~]#

Also, making a bogus http-request might give up some more information:

[root@matrix ~]# telnet 213.239.234.53 80
Trying 213.239.234.53...
Connected to 213-239-234-53.clients.your-server.de (213.239.234.53).
Escape character is '^]'.
Hello there

400 Bad Request
<h1>Bad Request</h1>
Your browser sent a request that this server could not understand.

Invalid URI in request Hello there

<hr />
<address>Apache/1.3.34 Server at fastbankaccounts.com Port 80
</address>

Connection closed by foreign host.
[root@matrix ~]#

Unfortunately ”fastbaknaccounts.com” is non-existent domain, so this test didn’t show more than version of the web server. Going to http://213.239.234.53 reveals some weird company that can help you out with creating offshore accounts, credit and debit cards, western union quickpay accounts. It appears that they are in Riga, and that they expertise lies in ripping you off.

I’m not sure how this hangs together with the German company yet, but. Who knows, I might find out (hopefully not from the scammer knocking on my door)

To be continued…

I have a classified where I’m selling a computer I no longer need on few sites in Sweden. Today I got a reply to the classified from one of the sites. The content was just ”What is your final price” (In english actually).

I automatically hit the ”Reply”-button and started to write an answer. Then it hit me, this COULD be a spambot that filled out the form on the classifieds site and sent it out.

Let me break this down.

1. You fill in a classified, selling something. All serious sites will not show your email on the web. As spambots (programs that crawl the web and search for publicly visible email-addresses) probably search their site regularly. However, a visitor must be able to respond to your classified, and for that there is usually a simple form available.

2. As email addresses are not directly available on the web site, there is only one option left to collect it, and that is when YOU reply to the spammer.

3. The only thing left to do is to make a program that will fill out a form and send a simple question to which majority will reply and then make it crawl the site and post replies to all forms it can find. That question needs to be generic to apply to a variety of classifieds and also variety of sites. A spammer is NOT going to make a program that only targets car-selling sites, but more generic. The question I got was ”What is your final price”. That question is very generic and will apply to virtually every classified.

The sender of the email I got was a @gmail.com-address. This makes it more believeable that real human is behind it then a robot-program. However, it’s very simple to construct another program that will use IMAP-protocol to talk to that particular inbox on Gmail and simply collect the email-addresses and store them to a spammer-database.

Conclusion:
To avoid getting your mailbox spammed senseless, keeping your email address off the web isn’t sufficient. You need to pay attention to what you are replying to.

In my case, this letter could have been legitimate, from a real person. That’s why I replied anonymously, without revealing my real email address and telling him to contact me again through the form on the site.

By zoki | 9 maj, 2009 - 11:05 - Posted in diverse

After giving advice to numerous friends and acquaintances about what to be afraid of Internet and what not, I decided to make a list for those who don’t already know this stuff.

VIRUS VS HOAX
(Can you warm 2 houses by NOT forwarding hoax? read on…)

First of all, I’ll address one big problem most of my friends have. That is numerous warnings about all that terrible viruses that will delete everything on their hard drive and cause the motherboard to catch fire. All my friends are aware of the word ”virus”, a small program made to do something unwanted on the victims computer and made to reproduce itself by copying itself through email or some other security vulnerability. Viruses are usually made by guys who want to leave a ”footprint” on the Internet. A kind of wicked legacy, by which they will be noticed and remembered. They find it ”cool” to see everybody trying to fight their creation. However kinds of viruses that have another purposes have been increasing in number. These kind try to collect data, such as your passwords or credit card numbers (trojans) or just wait there to get orders about what to do (for instance attack another computer on the Internet (DDOS-trojans).  There is one thing they have in common and that all viruses rely on a vulnerability to be able to spread. Often it is not question about vulnerability of your computer, but yourself. Viruses rely on humans to activate malicious programs, open malicious emails or go to malicious web-pages to execute viruses.

Hoaxes are similar to viruses, however much more simple than ”real” viruses. A hoax is an email, specially crafted to encourage you or to scare you to forward it to your friends. A hoax wouldn’t be a threat if it didn’t use one of the most wide spread vulnerabilities, and that’s humans. Hoaxes can tell you about that terrible virus that is spreading and urges you to warn everybody you know. It can also tell you (a fictional story) about a missing child that you have to find. The one thing every hoax has in common is that it relies upon you to spread. So, how bad is it to forward an email? So what if it’s not true, it’s better to be safe then sound? Well no. First, you annoy your friends and contribute to spreading of the hoax (which encourages hoax-makers to make new ones). Second, do some calculations. A standard hoax I receive have been forwarded 10-20 times before it reaches me. Each time to 20-30 users. Lets calculate a bit. We calculate how many mails it generates to forward 10 times, and let’s say that 10 of 30 recipients do actually forward.

10^10 = 10 000 000 000 emails. Now, lets say that each email is 8kb big. That is 80 000 000 000 kB, roughly 80 000 000 MB, roughly 80 000 GB, roughly 80 TB. A brand new computer, today, has about 500GB storage space. That means, one simple hoax would fill the space of 160 new computer hard drives.

Now, remember also that each email will also be sent, which involves network resources and cpu resources. The cpu and network use electrical power to function, which means that you are contributing in wasting valuable resources in times where we should save them. Wanna play more? I found that each email takes about 5 cal to be sent (let’s say that’s correct). That’s about 21 joules. That translates to 0.0000055 kWh. Total for our hoax, it would be 55 000 kWh. (0.0000055×10 000 000 000). Standard Swedish house is using about 25 000 kWh per year. That finally means, that sending that hoax for 10 times to 10 friends, would actually warm 2 standard Swedish houses for whole year!!!! Or you could take that 15 000 SEK worth of electricity, and give it to charity. Still think it’s no harm? Don’t believe me? Do your own calculations and correct me, please!!!!

SPAM VS NIGERIA LETTERS AKA 419-LETTERS

Now, how about those annoying emails that keep bugging you about your erectile problems? Are they dangerous? Well, apart from taking your computer resources they are not. However there are few things you need to be aware of. Spamers, usualy don’t know if your email address is correct. They usually have programs that assemble possible addresses and send out LARGE amounts of email. If you recieve what you suspect to be spam, the very best thing is to delete it immediately. There are in fact, ways for spammers to se if your email account is active and if someone is reading the emails. It is quite simple, they put an image or a link in the email, with unique ID that is connected with ”guessed” (your) email address. If your email client is NOT well behaved and opens those, or if you are foolish enough to click on the image or the link, you will tell the spammer that you just read the email, and mark your own address as active. Now embrace yourself for a SHITLOAD of SPAM.

The other ways for spammers to get ”real” addresses is simply browsing the web. Try now to google for your address! Did you find it on Google? Well, spammers did that too. No, they are not browsing like you and me, and copy-pasting into an email client. They are more advanced than so. They have ”harvesters”, a programs that will browse the web automatically, like spiders, and follow all links, scanning and identifying everything that looks like an email-address and storing it into a big ”sucker”-database. These databases can be used directly or sold further to other spammers.

Let me enlighten the gravity of this. On our company’s web-page, I put a bogus email-address hidden in the web page code. The email address wasn’t visible in a browser nor accessible through any links. It was actually commented out (means the browsers should disregard from that part of the page). The address was something like youbastardshouldntmailme@ourcompany.com. The last part, the domain part (after the @) was correct. Then I configured our email systems to ban all servers that would send email to this address. I knew that no humans would send anything to this address, but if it was harvested by a spam-bot it wouldn’t take long for spam to arrive. Guess how long it took before our systems started to recieve spam to this address (and banning those systems clean out)? 2 days.

That means, if you can google your email address and find it, you are in spammers database.

So, how do you avoid winding up on Google? First of all, don’t put your email address on a web-page. :) This one is no brainer. That means, do not leave your address on guest books, forums, blogs. Most of these have option of hiding your email-address when you leave a post. Make sure you don’t include your email address in the text. Basically, think of your email address as something that should be kept private. Only people that you would like to communicate to you should have it.

This goes for registrations on different sites on Internet, communities and so on. You can never know who will get your address after you filled in the registration form. Myself, I use this following method. I have 2 email addresses. One is my spam-free email-address. I never EVER use it in registrations anywhere. I do not allow it to appear on any web page. The second one, is a hotmail-address. This one is not that important, and I use it when I want to register somewhere. I don’t mind if I get spam to that address.

So what about Nigeria letters? Nigeria letters are those letter that claim that you won a lottery and you just need to collect it, or that you are carefully selected to help out with transferring LARGE amount of funds from another country for what you will be rewarded with $$$$$! Originally those letters were usually from people claiming that they were descendants of Nigerian oil businessmen. These rely on you to reply and send them a ”small fee” to be able to ”unlock the account”, ”bribe the lawyer”, ”prove that you exist” and what not.

Now… a promised list

1. Have an antivirus software installed on your computer and updated with latest virus definitions.

2. Do not click on executables found on internet, if you are not 100% sure what you are doing.

3. Do not open emails from unknown senders with suspicious subjects.

4. Be careful when opening emails from KNOWN senders with suspicious subjects or suspicious attachments.

5. Do not forward any emails that state that you should forward them.

SPAM

1. Do not leave your email address visible on the internet.

2. Never EVER reply to a spam

3. Never EVER click on a link in a spam email

4. Never EVER click on image in a spam email (or allow your email client to ”download images”)

5. Use ”junk-address” for registration on various web sites, not your real one

By zoki | 27 februari, 2009 - 12:39 - Posted in diverse

This one is for all AC/DC fans all over the world. This one is for those who like Bon Scott more than Brian Johnson (Sorry Brian, we like you, but Bon is the legend).

Ever since Bon died, we missed his voice. The music isn’t like it used to be, it reminds of AC/DC, but it’s too modern for my taste. Too commercial.

I searched Spotify for some AC/DC music today. Not one single song was there to be found. Too bad I thought and clicked on ”Live Wire” (Live Wire perform the best of AC/DC). Wondering how that would sound, I listened to familiar guitarr riffs comming from my speakers. Thinking that this would be an instrumental (I didn’t dare to hope that someone would try to sing Bon Scotts song and make fool of himself), I waited untill a familiar voice started to sing. Allright, did these guys just put an AC/DC song on Spotify claiming they do it? After a minute it came to me that they are simply that good. Chris (their lead singer) is AMAZING. If you listen carefully, you will eventually detect that he is not Bon, but he is VERY ALIKE. He is at least as good as he is. And that is the point.

I got goose bumps instantly. It was as someone resurected my old legend from my youth. I even could listen Chris sing Brian Johnson’s songs and see how it would sound if they were done by Bon Scott trying to sound like Brian Johnson. It’s perverted I know, but I promise you, Chris does them MUCH BETTER than Brian himself.

If they ever come to Sweden to play, the only thing that will stop me from seeing them is if someone shoots me in the head. Well, maybe not even that.

If you are AC/DC-fan, listen to Live Wire, they are amazing. Can’t even express that in words.

http://www.acdctributeband.com/