so I took my laptop back to a-mac utrecht, as its still got its crash-every-three-days problem. They refused to either refund the money or replace the laptop with a new one. Whilst they said they would talk to apple about a replacement, this has gone far enough for a product that was defective as sold, so I'm going to take advantage of the transaction protections I apparently get from the consumer credit act (and Visa), and dispute the transaction.
I got a lovely comment from the manager of the store when I said that I would expect a kernel crash every one to two years not every three days, that he would expect it to never happen. Which is funny in a "yes we sold you crap but we won't fix it" way.
17 March, 2011
11 March, 2011
numbering commits
svn gives each commit a unique number. mercurial does somethign similar. CVS doesn't. git has commit IDs btu they are big and dont' have an intrinsic order (if you dehash two commit IDs you can figure out relative order but its not apparent from the IDs themselves)
I'm interested in numbering the commits on a git branch that is imported from CVS, so there's a well defined linear order (unlike in git in general).
I hacked together this script:
which works like this:
This being a hack, I don't attempt to handle previously tagged revisions and instead let
Now I end up with commit tags that look like
I'm interested in numbering the commits on a git branch that is imported from CVS, so there's a well defined linear order (unlike in git in general).
I hacked together this script:
#!/bin/bash COMMITCOUNT=$( git rev-list origin | wc -l) echo There are $COMMITCOUNT commits on the origin branch # this strips whitespace export COUNT=$(($COMMITCOUNT)) git rev-list origin | while read commitid ; do echo numbering $commitid as $COUNT TAG=cvs$COUNT git tag $TAG $commitid COUNT=$(( $COUNT -1)) done
which works like this:
$ ./number-cvs There are 205 commits on the origin branch numbering fea9db3bc7b3e36f82a97d3bb194eb60ecb3b57f as 205 numbering aedbfe81cc1dbf3d6f833225aa41826854398a3c as 204 numbering f040d23565211acb637d3325d240d675fe1e61a6 as 203 numbering eef4a46ce30de2836402a373e8eae49fc1b75935 as 202 numbering 2bb5b931be9beb0d90a2796b85585149465f8fc3 as 201 numbering a4372569c60bcb6d92a63b258389b5f1a210dd40 as 200 fatal: tag 'cvs200' already exists numbering bbd6af71ef17fcb05a9cf86a372837dcf470e30b as 199 fatal: tag 'cvs199' already exists numbering 6e1dc4d7d59b3515a3f46c17517c1bb85172c7bc as 198 fatal: tag 'cvs198' already exists numbering 87c59d4b1bf4c7b1bcb64af078a66290d74f6ebf as 197 fatal: tag 'cvs197' already exists [...]
This being a hack, I don't attempt to handle previously tagged revisions and instead let
git tag give a fatal error that isn't really fatal...Now I end up with commit tags that look like
cvs200, cvs201, ...
last repair attempt which pretty much says they did nothing actually seems to have done nothing
Well, it took about 46h from my Mac being returned to me for it to crash again. I won't be in Utrecht until next Thursday so I can't take it back to a-mac to grumble some more until then.
08 March, 2011
result of 2nd repair
after the previous failed attempt to make my new mac work, the 2nd repair attempt of my new mac is reported as:
which in a one-liner is "we found some corrupted files and repaired them. this is a software problem. it works fine now."
To be honest, that sounds like complete BS given the symptoms and the actions taken for previous repair (meaning its had at least two separate OS installs on two different hard-drives)... plus yes "it works fine" most of the time - just it crashes every 3 or 4 days. As the mac has been in their possession for repair for only 3 days, and I'm sure they haven't been using it as much as I do during that time, I don't think they can accurately state that it works now. The next week should tell, though.
In the meantime, Apple sent me a questionnaire about the previous repair attempt which gave me the opportunity for further grumbling (can you tell I'm English?).
-- later --
got laptop back - total result of repair: some screen dumps of them running the disk repair utility, and they wiped some fingerprints off the screen. lets see if that fixed the problem. <cough;>
Uitvoerig getest . weer waren er kleine problemen op de schijf ditmaal konden ze wel hersteld worden Ik zie aan de log files dat de kernel panic puur om software gaan en niet hardware. deze problemen zijn hersteld , en de Macbook werkt weer prima voor een goede test zal ik de mac nog door testen Na diverse testen werkt de Macbook prima geen verdere problemen 07-03-2011 Aan de log files van de machine te zien heeft het probleem te maken met het feit dat er een Backup is terug gezet , waarvan de fouten waarschijnlijk mee over zijn gekopieerd Na herstel van de Harddisk * software ( werkt hij prima
which in a one-liner is "we found some corrupted files and repaired them. this is a software problem. it works fine now."
To be honest, that sounds like complete BS given the symptoms and the actions taken for previous repair (meaning its had at least two separate OS installs on two different hard-drives)... plus yes "it works fine" most of the time - just it crashes every 3 or 4 days. As the mac has been in their possession for repair for only 3 days, and I'm sure they haven't been using it as much as I do during that time, I don't think they can accurately state that it works now. The next week should tell, though.
In the meantime, Apple sent me a questionnaire about the previous repair attempt which gave me the opportunity for further grumbling (can you tell I'm English?).
-- later --
got laptop back - total result of repair: some screen dumps of them running the disk repair utility, and they wiped some fingerprints off the screen. lets see if that fixed the problem. <cough;>
05 March, 2011
ssh over CONNECT over port 80
I run an ssh server on port 443 (the https port) of one of my machines. That's good when I want to get ssh from a network which bans "everything but web-browsing" - once I have ssh I can tunnel pretty much what I want.
But the other day I ran across a network (at an airport) which allowed only port 80 - the regular http port. Even port 443 was banned (so not only could I not connect to my ssh server, but no facebook, gmail, etc...)
I already have stuff on port 80 - my webserver - so what could I do? I know ssh can be tunnelled through the http CONNECT method. Could I set that up so that my web server would serve web traffic as usual but allow me to CONNECT to the ssh server?
Turns out yes.
In the http server config - enable mod_proxy and mod_proxy_connect. Then this config in proxy.conf (or the main server config, I guess):
(If you're doing this yourself - be careful about what you allow - if you are too liberal you turn your server into an open spamming and hacking engine for the world to exploit. And it will be found. Automatically, and within days or maybe hours.)
On the client side, use netcat as a proxy command in SSH: (you can also put the proxy command in ~/.ssh/ssh_config)
Tada.
Note that the ssh server now sees you connecting from localhost, and the http server is the one who logs the real IP address. A caveat here is if you have IP-based security policies that make localhost special, then anyone connecting through this proxy is also special.
Lots of the config for this came from http://mariobrandt.de/archives/technik/ssh-tunnel-bypassing-transparent-proxy-using-apache-170/
So that gets me a CONNECT proxy.
But does it work at the airport? No.
Turns out the airport is also running everything through a transparent proxy: when I connect to s0.barwen.ch port 80, I'm actually connected to the airport's transparent proxy. So an http CONNECT command to localhost:22 both points to the wrong place and is administratively prohibits.
It turns out I can http CONNECT to s0.barwen.ch port 80, though, and there issue another CONNECT command to get to localhost:22:
So I can get to the server this way.
How can I get the ssh commandline to talk to the remote server, with the extra proxy step added?
Like this:
Now once that's done, I can run a SOCKS proxy over the same ssh connection, and route my normal web browsing through that - giving me access to https sites, and anything else that can use SOCKS.
But the other day I ran across a network (at an airport) which allowed only port 80 - the regular http port. Even port 443 was banned (so not only could I not connect to my ssh server, but no facebook, gmail, etc...)
I already have stuff on port 80 - my webserver - so what could I do? I know ssh can be tunnelled through the http CONNECT method. Could I set that up so that my web server would serve web traffic as usual but allow me to CONNECT to the ssh server?
Turns out yes.
In the http server config - enable mod_proxy and mod_proxy_connect. Then this config in proxy.conf (or the main server config, I guess):
<IfModule mod_proxy.c>
ProxyRequests On
<Proxy *>
AddDefaultCharset off
Order deny,allow
Deny from all
</Proxy>
<Proxy localhost>
Allow from all
</Proxy>
AllowCONNECT 22
ProxyVia On
</IfModule>
(If you're doing this yourself - be careful about what you allow - if you are too liberal you turn your server into an open spamming and hacking engine for the world to exploit. And it will be found. Automatically, and within days or maybe hours.)
On the client side, use netcat as a proxy command in SSH: (you can also put the proxy command in ~/.ssh/ssh_config)
ssh -o 'ProxyCommand nc -X connect -x myhost.example.com:80 localhost 22' myhost.example.com
Tada.
Note that the ssh server now sees you connecting from localhost, and the http server is the one who logs the real IP address. A caveat here is if you have IP-based security policies that make localhost special, then anyone connecting through this proxy is also special.
Lots of the config for this came from http://mariobrandt.de/archives/technik/ssh-tunnel-bypassing-transparent-proxy-using-apache-170/
So that gets me a CONNECT proxy.
But does it work at the airport? No.
Turns out the airport is also running everything through a transparent proxy: when I connect to s0.barwen.ch port 80, I'm actually connected to the airport's transparent proxy. So an http CONNECT command to localhost:22 both points to the wrong place and is administratively prohibits.
It turns out I can http CONNECT to s0.barwen.ch port 80, though, and there issue another CONNECT command to get to localhost:22:
$ nc -4 -X connect -x s0.barwen.ch:80 s0.barwen.ch 80 CONNECT localhost:22 HTTP/1.0 200 Connection Established Proxy-agent: Apache/2.2.14 (Ubuntu) SSH-2.0-OpenSSH_5.3p1 Debian-3ubuntu5
So I can get to the server this way.
How can I get the ssh commandline to talk to the remote server, with the extra proxy step added?
Like this:
$ cat t.sh ( echo "CONNECT localhost:22" ; cat ) | nc -X connect -x s0.barwen.ch:80 s0.barwen.ch 80 | ( read ; read ; read; cat) $ ssh -o 'ProxyCommand ./t.sh' s0.barwen.ch
Now once that's done, I can run a SOCKS proxy over the same ssh connection, and route my normal web browsing through that - giving me access to https sites, and anything else that can use SOCKS.
04 March, 2011
disappointing new mac
Well my last mac died, as they do every now and then. So I activated my usual replacement behaviour: go to nearest mac store (in this case, Amac in Utrecht) and buy a new macbook.
Alas this new macbook started BSODing every few days, usually after a resume. So I took it back to the shop. They took it off for repair and diagnosed it with a faulty hard drive (?) and returned it after a week with a new HD.
Macbook still BSODs ever few days.
So back to the shop again. I thought maybe this time they'd give me a real replacement. No they want to take it off for repair again. I wonder if some dude has to sit in a room repeatedly suspending it and unsuspending it for a week to try to reproduce? Presumably it'll come back in a week with "cannot reproduce" and then it will continue crashing for me and then I will have to go argue with them lots?
This is a disappointingly slow and lame process which is not what I expected from either a Mac or from a Premium Reseller. grumble.
Alas this new macbook started BSODing every few days, usually after a resume. So I took it back to the shop. They took it off for repair and diagnosed it with a faulty hard drive (?) and returned it after a week with a new HD.
Macbook still BSODs ever few days.
So back to the shop again. I thought maybe this time they'd give me a real replacement. No they want to take it off for repair again. I wonder if some dude has to sit in a room repeatedly suspending it and unsuspending it for a week to try to reproduce? Presumably it'll come back in a week with "cannot reproduce" and then it will continue crashing for me and then I will have to go argue with them lots?
This is a disappointingly slow and lame process which is not what I expected from either a Mac or from a Premium Reseller. grumble.
27 February, 2011
dnssec: automated re-signing of hawaga.org.uk
In a previous post on DNSSEC-signing my zone
Basically I need to run the
The most awkward was that I need to increment the zone serial number in the
So I wrote a quick utility,
Now I'll use the
I put the above in a script called from cron, and set it to run every week.
Now a weakness here is that I have to keep my signing key unpassworded and on a system connected to the internet. The zone-signing and key-signing key separation should help here, by allowing me to keep a more important key offline and a less important key online, but I haven't investigated it in any greater depth - perhaps I should...
hawaga.org.uk, I mentioned that signatures will expire after 30 days, and so I (or rather one of my computers) will need to re-sign the zone at least every month.Basically I need to run the
dnssec-signzone command again, but there is some dancing around that needs to happen.The most awkward was that I need to increment the zone serial number in the
SOA record of my zone. Previously I've maintained this by hand, keeping it in format YYYYMMDDNN (year, month, day, sequence-number-on-that-day). That format is quite appealing because even if I forget what number I got up to, I can wait a day and know that I have a number in sequence.dnssec-signzone offers a couple of options for doing things to serial numbers, but neither was what I wanted: one will increment the input SOA by one, but I want to maintain a pristine source zone file; another will set the SOA to the number of seconds since the unix epoch. This changes the format away from what I want.So I wrote a quick utility,
soatick, to generate zone serial numbers based on the current time and a state file, so that each invocation will generate a new serial number matching the format that I want:$ ./soatick 2011010901 $ ./soatick 2011010902 $ ./soatick 2011010903
Now I'll use the
m4 macro processor to put this in place before signing the zone:export NEWSERIAL=$(/home/benc/src/soatick/soatick ) m4 -D___SERIAL___=$NEWSERIAL < db.hawaga.template > db.hawaga.generated /usr/sbin/dnssec-signzone -S -t -a -l dlv.isc.org -f db.hawaga.signed -o hawaga.org.uk db.hawaga.generated
I put the above in a script called from cron, and set it to run every week.
Now a weakness here is that I have to keep my signing key unpassworded and on a system connected to the internet. The zone-signing and key-signing key separation should help here, by allowing me to keep a more important key offline and a less important key online, but I haven't investigated it in any greater depth - perhaps I should...
19 February, 2011
public nmap server
Well, I put up a public nmap server on barwen.ch that will nmap whatever address you are connecting from in your browser. I really wonder what the bad uses and the good uses (if any) this can be put to are. It was at least funny to watch yahoo and google hammer on it 'till I put a robots.txt in place.
13 February, 2011
choosing a password
many sites want a password. for a lot of middle-to-low security accounts, I keep a(n encrypted) database of passwords on my computer, rather than making them memorable or using the same one on all. So I cut and paste each password and don't care about it being easily typable. To generate the passwords, I use a command-line like this:
$ cat /dev/random | strings -n 16
:*jx4%8er:>kRKh:
a#ka;lPB6rB9SX";lk
6B!'X@Q{@QQ LZB?
hZ if=A2u3;-S]v?P
Ix6RwEwqVqEg~0fFi
[hkE*0T~GZX^5=h<4
06 February, 2011
Using mrtg and iptables to record IPv4 vs IPv6 traffic
I wanted to plot IPv6 vs IPv4 traffic on my hosts - I have most services enabled for IPv6 but I know they don't get used much. I had MRTG already.
iptables on Linux counts bytes that pass through it, even if there are no iptables rules:
That counts ipv4 packets. The ipv6 equivalent is ip6tables.
So without needing to add any iptables rules at all, I can feed this output to mrtg with a script as follows, which outputs IPv4 traffic (for all three categories) as the first (input) variable, and IPv6 as the second(output) variable.
On one host, there really is hardly any ipv6 traffic (2 bytes/sec!) so I turned on the log scale plot option in MRTG to show the ipv6 a bit more (though to be honest its still pretty invisible).
Here's the config I used in MRTG to call the above script:
and here's an example graph (live, click for historical data):

Caveats:
I'm summing the all three iptables chains: input, output, and forwarded, for all interfaces. So some traffic here can be counted unexpectedly: A forwarded packet traverses all three chains (I think) so this is not a good way to count traffic if your linux box is a router; The lo interface will also be counted, so traffic to localhost (127.0.0.1 or ::1) will be counted in this graph. This might be useful to remove.
When there's a tunnel endpoint on the machine, then traffic to that tunnel will be counted twice: one as it passes the tunnel interface, and once as the encapsulated form passes the physical ethernet interface.
These are not insurmountable, I think: by setting specific iptables rules that address these concerns and counting traffic from those instead of the main chain counters.
iptables on Linux counts bytes that pass through it, even if there are no iptables rules:
$ iptables -L -v -x Chain INPUT (policy ACCEPT 6079694 packets, 2474020715 bytes) [...]
That counts ipv4 packets. The ipv6 equivalent is ip6tables.
So without needing to add any iptables rules at all, I can feed this output to mrtg with a script as follows, which outputs IPv4 traffic (for all three categories) as the first (input) variable, and IPv6 as the second(output) variable.
#!/bin/bash A=0 IP4=$(/sbin/iptables -L -x -v | grep -e ^Chain | sed 's/.* \([0-9]*\) bytes)$/\1/' | ( while read n ; do A=$(( $A + $n )) ; done ; echo $A)) A=0 IP6=$(/sbin/ip6tables -L -x -v | grep -e ^Chain | sed 's/.* \([0-9]*\) bytes)$/\1/' | ( while read n ; do A=$(( $A + $n )) ; done ; echo $A)) echo $IP4 echo $IP6 echo 0 echo unknown
On one host, there really is hardly any ipv6 traffic (2 bytes/sec!) so I turned on the log scale plot option in MRTG to show the ipv6 a bit more (though to be honest its still pretty invisible).
Here's the config I used in MRTG to call the above script:
Target[ip46]: `/home/benc/bin/iptables-to-mrtg` Target[ip46]: `curl http://dildano.hawaga.org.uk/mrtg-iptables.txt` options[ip46]: growright,logscale MaxBytes[ip46]: 1000000000000 Title[ip46]: IPv4 vs IPv6 YLegend[ip46]: bytes/sec LegendI[ip46]: IPv4 LegendO[ip46]: IPv6
and here's an example graph (live, click for historical data):
Caveats:
I'm summing the all three iptables chains: input, output, and forwarded, for all interfaces. So some traffic here can be counted unexpectedly: A forwarded packet traverses all three chains (I think) so this is not a good way to count traffic if your linux box is a router; The lo interface will also be counted, so traffic to localhost (127.0.0.1 or ::1) will be counted in this graph. This might be useful to remove.
When there's a tunnel endpoint on the machine, then traffic to that tunnel will be counted twice: one as it passes the tunnel interface, and once as the encapsulated form passes the physical ethernet interface.
These are not insurmountable, I think: by setting specific iptables rules that address these concerns and counting traffic from those instead of the main chain counters.
Subscribe to:
Posts (Atom)