wget

What version of wget supports SHA2?

Written by  on Dezember 14, 2015

I’ve already asked that question at Stackoverflow but it seems there is not a simple answer about that, or maybe just nobody ever thought about that before!
From what I found out earlier in „wget isn’t checking CRLs“, I see there is no need to verify the CRL with SHA2, because this simply won’t happen.
My best guess about that question is, that it simply depends on the used openssl version. There is some evidence – my wget here is linked against the openssl library. You might check for yourself with

$ ldd $(which wget)
...
        libssl.so.1.0.0 => /lib/i386-linux-gnu/libssl.so.1.0.0 (0xb76d3000)
...

Or you simply check, what you’ve got installed on your system

$ openssl version
OpenSSL 1.0.1f 6 Jan 2014

From the date you might find out, that your openssl version for sure supports SHA2! According to openssl 0.9.8 changelog each version since 0.9.8o, 01 Jun 2010, supports the SHA2 hash algorithms.

wget and the http protocol version

Written by  on Dezember 4, 2015

Found some scripts using wget, which suddenly stopped working after a server upgrade. Strange thing, using curl still worked. Using a proxy server also worked.
So what was the problem?
The new server version didn’t support HTTP version 1.0 and discarded the requests with HTTP status 403, forbidden. But why in all the possible worlds would wget send an HTTP 1.0 header? Oh, it’s just because its a freaking old wget version 1.12 used by Red Hat which simply won’t support HTTP 1.1!
Check out the version information at Wikidpedia.

Wget 1.13, released August 2011, supports HTTP/1.1

Any newer version than this old version from September 2009 wouldn’t have caused troubles.
If I understand this question at Stackoverflow correctly HTTP 1.1 was introduced in 1996 … but the wget version from 2009 won’t support that.

wget isn’t checking CRLs?

Written by  on Dezember 1, 2015

Just a wild theory, but wget is not checking for revoked certificates.
How did I come to this conclusion – and how did I try to verify that?

First some infos about versions – which may be rather important on that topic.

wget --version
GNU Wget 1.15 built on linux-gnu.
openssl version
OpenSSL 1.0.1f 6 Jan 2014

Check about the current certificate, like mine here at https://www.höllrigl.at -> you’ll see a certificate from „StartCom Class 1 Primary Intermediate Server CA“ CA and a CRL at http://crl.startssl.com/crt1-crl.crl

So I’m checking about where to find the CRL and get a nice list

# dig crl.startssl.com +short
www.startssl.com.edgesuite.net.
a1603.g1.akamai.net.
92.122.206.27
92.122.206.10

So let’s see if we find some traffic that goes there – first I tried a ping:

# tcpdump -i eth0 host crl.startssl.com
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes
21:34:23.967704 IP 192.168.3.1 > a92-122-206-10.deploy.akamaitechnologies.com: ICMP echo request, id 18687, seq 1, length 64
21:34:24.016819 IP a92-122-206-10.deploy.akamaitechnologies.com > 192.168.3.1: ICMP echo reply, id 18687, seq 1, length 64

Next thing, fetch that URL with wget

# wget https://www.höllrigl.at
--2015-11-30 21:35:46--  https://www.xn--hllrigl-90a.at/
Resolving www.höllrigl.at (www.xn--hllrigl-90a.at)... 193.239.248.170, 2a04:5540:1:41::10
Connecting to www.höllrigl.at (www.xn--hllrigl-90a.at)|193.239.248.170|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: ‘index.html.2’

    [ <=>                                                                                                                                                                                             ] 29,620      --.-K/s   in 0.05s

2015-11-30 21:35:48 (594 KB/s) - ‘index.html.2’ saved [29620]

Now I’d like to show to you the dumped packages in tcpdump – but there are none.
Other strong indicators are, that there only started to be a ‚–crl-file=file‘ option to wget starting with 1.16, which allows you to check your certificate against a locally stored CRL file.

Logging und Netzwerkverbindungen in der Bash

Written by  on Januar 16, 2011

Inspiriert vom Artikel Bash Bashing aus dem Linux Magazin 12/2010 hab ich mich etwas näher mit den Fähigkeiten der Bash beschäftigt.
Zwei interessante Punkte habe ich dabei entdeckt: …

  1. Mit dem Shell-Builtin „exec“ lassen sich ganz einfach Filedescriptoren verbiegen. Das Beispiel dazu im Artikel schreibt dazu:
    exec 77>&1

    , das heißt es wird der Deskriptor 1 – die Standardausgabe – mit dem Deskriptor 77 verbunden. Das dient eigentlich dazu, dass die Standardausgabe gesichert wird, um diese später wiederherstellen zu können. Dabei stellt sich mir allerdings die Frage warum gerade der Deskriptor 77 verwendet wird. Es kann dann mit

    exec > /tmp/logfile

    die gesamte Ausgabe aller folgenden Befehle in eine Datei umgelenkt werden, ohne diese extra angeben zu müssen. Wiederhergestellt wird die Standardausgabe dann über den Befehl

    exec 1>&77
  2. Der zweite wichtige Punkt ist der, dass die Bash bereits alles wichtige mitbringt um eine Netzwerkverbindung aufzubauen. Das sollte sich auch problemlos mit Punkt 1 kombinieren lassen. Um etwa eine Datei von einem Webserver herunterzuladen wird kein zusätzliches Werkzeug wie wget benötigt.
    Das Ergebnis war dieses Beispielscript mit dem z.B. eine Webseite heruntergeladen werden kann:

    #!/bin/bash
    # exec: bash builtin
    # exec 5<> filedescriptor 5 mit netzwerksocket verbinden
    # host www.orf.at; port 80
    exec 5<> /dev/tcp/www.orf.at/80
    # etwas an den socket schicken
    echo -e "GET / HTTP/1.0\n" >&5
    # antwort vom socket abholen (und in ein Datei outputfile schreiben)
    cat <&5 > outputfile
    

Eine Anleitung zu dem Ganzen findet sich auch unter „/dev/tcp“ im „Advanced Bash Scripting Guide“.