Archiv

Archiv für Februar, 2016

Spammers everywhere

24. Februar 2016 Keine Kommentare

Since I started this blog in June 2015 I got as many as 60 spam comments from various strange people (or rather bots I guess) who think that this blog is fantastic and that I should consider getting a loan, mattress dealers, SEO specialists, experts who know how to lose 10 pounds in a month and others. I often wonder who replies to such king of posts or e-mails and how profitable is this for spammers. Wikipedia article on spam says that:

According to the Message Anti-Abuse Working Group, the amount of spam email was between 88-92% of email messages sent in the first half of 2010.

90% of all e-mails is spam! And this article proves that spammers are profitable because apparently there are still many naive people in this world.

Kategorienspammers Tags:

Use magit with SOCKS proxy

23. Februar 2016 Keine Kommentare

Sometimes it is necessary to use git in places where it’s blocked by overzealous firewalls. Instead of a successful push you end up with this:

ssh: connect to host github.com port 22: Connection timed out
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

A known way to overcome this problems is tunneling a traffic through an external server with SOCKS protocol over SSH using tsocks, possibly with autossh instead of regular ssh to make a connection permanent, for example:

autossh -M 15000 home -D 12000

In this example home is a name of our external server configured in ~/.ssh/config. We tell autossh to listen on port 15000 and create SOCKS proxy on port 12000 – these are not privileged ports so we don’t need sudo. To actually use SOCKS we need tsocks. First we need to tell tsocks what’s address and a port of our SOCKS proxy. Add this to /etc/tsocks.conf:

server = 127.0.0.1
server_port = 12000

Using tsocks is very simple – just put it before every command you want to tunnel like this:

tsocks git push

Now how to make magit use git in conjunction with tsocks? It’s not correct to do this:

(setq magit-git-executable "tsocks git")

When pushing with magit:

Searching for program: no such file or directory, tsocks git

The problem is that magit will look for a program „tsocks git“ which of course does not exist. What we need to do is to wrap git inside a shell script and call tsocks in it. For example, make ~/bin/tgit with the following contents:

#!/usr/bin/env sh

tsocks git "$@"

Now tell magit to use it:

(setq magit-git-executable "~/bin/tgit")

That’s it – now it’s possible to use magit comfortably as usual.

Kategoriengit, magit, networking, proxy, socks, ssh Tags: