Monthly Archives: February 2009

Qmail Taps Extended

Problem

You're running qmail and you want to log as in "copy/archive/tap"  only the outgoing email messages.  Inter7, the creators of vpopmail have a nice solution in a patch named qmailtap.

This patch will actually give you the option to match a message's To and From addresses against a regexp and decide what to do with them, all in an easy to write configuration file but this solution will not differentiate between To and From so if any of them matches the regexp the messages will be copied.

If you would only want to log outgoing mail you could decide to log only the messages which have the From address set to a local account but since there's no way to know which of the From or To addresses  matched you can't do this.

Solution

I created another patch that would allow you to specify which address you want to match.

With the original patch to match everything To or From @domain.com and copy to copy@example.com  you would need a line like this in the configuration:

.*@domain.com:copy@example.com

With the new patch if you only want to log the messages with the From address @domain.com you would set the configuration like this:

F:.*@domain.com:copy@example.com

If you want to log only those with the To address @domain.com

T:.*@domain.com:copy@example.com

if you want the same behavior as the original patch:

A:.*@domain.com:copy@example.com

Note: When writing multiple rules you have to consider how qmail-queue works after this patch
For each message qmail-queue looks at the From address first and tries to match it against the lines
starting with F: or A:.   When it finds a match it copies the message and stops.
If it didn't find a match in the F: or A: lines  it will try to match the To address against
the T: and A: lines.

Download

If you have not applied qmailtap patch yet here is the new full patch:

[download#3]

If you have already applied the qmailtap patch here is a patch you have to apply to obtain the new functionality:

[download#4]

Got any questions ? Or maybe you have other solutions... hit the comments!

This week on twitter 2009-02-22

  • Download Debian Linux 5 Lenny ISO / CD / DVD Images http://ff.im/14vqe #
  • @noahkagan isn't bill.com mostly used in the port industry? #
  • @hacool I was hoping this would actually show me how to make a real cloud 😀 in reply to hacool #
  • iBelieve http://ff.im/14XoV #
  • RT: @improvingtheweb: RT @NicoleSimon exactly the reason y I only post very selective content & photos 2 facebook http://tinyurl.com/ca4r2l #
  • if you're looking to host your own photos gallery2 is a cool script #
  • 10 stonking email marketing systems reviewed. http://ff.im/157rY #
  • RT: @StephanieSAM: This is pretty good! RT @barbaraling: 10 Tips for Using Twitter And Email Marketing for B2B http://tinyurl.com/7hf86b #
  • @ao12 si eu, le iau cu lada de la metro. 🙂 in reply to ao12 #
  • RT @Othella 20 Expert WordPress Tips for Pro-Developers http://bit.ly/19nwI6 #
  • have shared hosting ? could you use it as a socks proxy: http://tinyurl.com/bzqtrt #
  • 20 Expert WordPress Tips for Pro-Developers | StylizedWeb.com http://ff.im/15wyD #
  • Inter7 - http://ff.im/15wyC #
  • RT: @denisecox: RT @StephanieSAM: Anyone doing email mrkting in Europe? Please take our survey! Pls RT http://bit.ly/gby6k #
  • tied to play with mozilla's cloud editor ( bespin ) but it's just too slow for me #
  • The rational marketer (and the irrational customer) http://ff.im/167dn #
  • Authenticity http://ff.im/168IC #
  • playing with zend Framework, second try... first time I got bored before I managed to actually do something with it #
  • @AlexVolocaru CAN-SPAM doesn't require double opt in, that's why many see it as a law that's actually encouraging spam in reply to AlexVolocaru #
  • @AnnePMitchell probably not many 🙂 in reply to AnnePMitchell #
  • Mahalo Caught Spamming Google With PageRank Funneling Link Scheme : SEO Book.com http://ff.im/16xOw #
  • seems like Zend Tool only works with 1.7.4 not the latest 1.7.5 #
  • @wllm it doesn't . It throws an error cause it can't find CodeGenerator in reply to wllm #
  • @wllm I gave up. Again! Just too much work to do before I actually get to do the REAL work. Feels like bureaucracy in reply to wllm #
  • @wllm yes exactly. But I found no indication about where I could get Zend_CodeGenerator. I ended up using 1.7.4 which worked well in reply to wllm #
  • cum poti sa pleci de la Cluj si sa ajungi in Bucuresti in jur de ora 13-14 ? #
  • wy did my blog' #
  • ok...sloppy fingers ... #
  • why did traffic on my blog (http://patchlog.com) double since yesterday ? I did nothing. Is there something wrong with wordpress stats? #
  • oh I found out what the problem was. I installed this the wp toolbar : http://tinyurl.com/d9xcms #
  • ... and now for every outgoing click I get two extra 'views' #
  • The Great Email Debate - Topic #1 - The Opt-In Box: Checked or Un-Checked http://ff.im/17KJ9 #
  • It’s All About You http://ff.im/17KJd #
  • thanks for spamming me with twine... good bye 🙂 #
  • I can't believe it ... google using asp ??? check out the link to "online registration form" on this post: http://tinyurl.com/594zeb #
  • I got an invitation to try the Zend Server beta. anyone tried it yet? #
  • Saki's Ext Examples http://ff.im/18rWU #
  • Plugin Authors, Are you making the best of Readme.txt? http://ff.im/18sqd #
  • Worst Unsubscribe Practices http://ff.im/18sqe #
  • Yahoo Returns to its Roots: Annoying Ads http://ff.im/18sqf #
  • I wonder why a lot of blogs still don't have the "Notify me of followup comments via email" on the comment form ... #
  • hmmm....what could have changed between firefox 3.0.4 and firefox 3.0.6 that messes up the layout of my Extjs grid ? ... #
  • and why isn't Saki's example (http://examples.extjs.eu/gridinbl.html ) messed up ? #
  • @mihaibrehar re: "subscribe to comments...", good question. It's very useful. But the plugin is good enough. in reply to mihaibrehar #
  • writing a site scrapper ... actually just configuring one I wrote some time some time ago #
  • RT: @jowyang: I'm waiting to see examples of baby day car centers providing tweets to anxious parents to monitor. Practical? #
  • project on elance.com: Find users talking about a specific topic near a given city and prepare a list of outgoing tweets 2 these users #spam #
  • Twitter endorses certain accounts. Is it fair? http://ff.im/1abpH #

Powered by Twitter Tools.

HowTo: Shared Hosting as Socks Proxy

Problem

You need a proxy to connect to a service that would only accept connections from a certain location.

You have a shared hosting account on a server in location that is accepted by the service where you want to connect. Could you use it as a proxy server.?

You could install one of those proxy scripts made in php but that would only let you browse the web, what you want is be able to proxify any application and for that you need a socks server working with one of those proxifier applications  (like tsocks on linux/unix ).

So could you use a socks proxy on your shared hosting account?

Solutions

The solutions are listed starting with the most simple working on the most permissive hosting accounts and ending with the most complex suited for the least permissive accounts.
There will be further posts describing the solutions in detail. This post is mostly an introduction.

  1. SSH Tunnel

    This is the simplest but it assumes that your hosts allows ssh access to your account and they don't block ssh tunnels.

    1.  

    This creates a socks server on your local host , then you can use it in the proxifyer app to forward all connections through it.

  2. Custom SSH Tunnel

    This is a solution for those hosting accounts that don't allow ssh tunneling, but allow you to connect over ssh and run a program ( antinat - a socks server ) once connected over ssh.

    ( One might wonder: why create a tunnel when you could just run antinat and connect directly to it? If you can do that then that's the best way to do it but most shared hosting servers would have all ports blocked so you would not be able to connect to any port other then the standard ones ( 80,443,25,110,143, etc ) but those are only available to root and are already busy anyway. )

    The idea is to forward the traffic from your computer to the proxy server through the actual ssh connection instead of using the standard tunneling mechanisms which are blocked by server's configuration.

    For this you would need a program on your host to act both as a socks server ( sort of ) and as a forwarder through a ssh connection. On the other side ( hosting account ) you would need another program that would receive data from the ssh connection and forward it to antinat. Both programs would actually have to forward data both ways.

    Both forwarders would have to multiplex connections and forward them through a single ssh connection because most hosting accounts only allow one connection / user

  3. Callback Socks server

    This is a solution in case your hosting account has no ssh access.

    It's similar to previous solution but in this case instead of having the local forwarder connect to the remote ( hosting ) forwarder through ssh, you eliminate the remote forwarder and just have the socks server connect back to the local forwarder and then forward everything through that connection.

    This would require modification to the socks server as antinat doesn't have this callback feature built in.

    Another requirement is that you are able to upload and run antinat on the server. Usually you can do this by just calling it in a php script ( eg.: system('antinat') ) or from a perl script if the host offers cgi access.

  4. Custom script ?

    What if for some reason (no cgi or php system() blocked ) you can't run antinat?

    Well in this case I'm guessing it would be possible to write a script that you could call over a http connection, and forward through it, but php's socket functions would need to be available and script's max execution time would limit your connection time so don't expect much of this.

I have used solution #1 and I wrote the software and patches required to make #2 and #3 work. In the following weeks I'll write the posts to describe them in more details.

You can subscribe to my RSS feeds or connect with me on one of the social networks listed in the sidebar if you want to be notified when they are posted.

If you know other ways of doing this or ideas about my solutions I'd love to read about them in the comments.

This week on twitter 2009-02-15

Powered by Twitter Tools.

Twitter is just Twitter

The web is amazing. Every once in a while a new service appears that brings together so many people and gets so much popularity that everyone starts to look at it as the solution to everything.

Twitter is one good example of such beast. Started as a microblogging tool, made popular by high profile bloggers like Robert Scooble, seen as the hidden treasure of branding and marketing, twitter currently has about 5 mil users and growing rapidly. ( you know it's growing when you see spam growing 🙂 )

One of the greatest things about twitter ( from a developer's point of view ) is that it allows developers access to it's data through a simple API. This allowed a lot of companies and individual developers to write a large variety of web based services and applications from simple clients to power monitoring , pregnancy monitoring and alarm monitoring applications .

All these new apps being created everyday make people think what more can we do with twitter ? How can we make it solve all of our problems? ( can it bail out the banks ? 🙂 ) .

A few weeks ago this post on Marketing Pilgrim blog suggests twitter could become a payment gateway, three days ago someone wrote a post suggesting twitter search could be a threat to google , I still see tweets about that post.

I see the value in each of those apps, in some there is more in others less, I can see how twitter search can be very useful for certain things, but it could never replace a search engine in the way google, yahoo, live work.

I'm not saying people shouldn't look for innovative ways to use a service, but headlines like "twitter threatens google" seem more like link bait.

I actually think something like friendfeed.com would be more efficient as a search engine then twitter is but would still not match google's power.

Sure people based search is cool but what about most of the people who don't  live in twitter, what about the forums, the mailing lists, the blog comments, the pdfs, .doc?

This week on twitter 2009-02-08

Powered by Twitter Tools.

Ip alias with dhcp in ubuntu

Problem

You have a machine running ubuntu, NetworkManager gets the ip from a dhcp server and you want to have another ip that never changes on the same interface (for example if you want to also act as a dhcp server for your local network and both the local and uplink are connected on the same interface).

Dhclient seems to support this through an "alias" statement and NetworkManager seems to use dhclient but I just couldn't make it work like this.

Solution

Create a script in /etc/network/if-up.d/ . Name is as  you wish. My choice was "alias" .

  1. span style="color: #ff0000;">"$IFACE" != "lo"

Then make sure the script is executable:

  1.  

You can replace the ip and mask to fit your needs.
NetworkManager will run this script automatically after it brings the interface up.

This worked for me but in the spirit of usability it would have been nice to have this kind of feature directly into NetworkManager's connection configuration gui.

Do you know any other way of doing this? Please share it in the comments.

This week on twitter 2009-02-01

Powered by Twitter Tools.

Bttv Kworld tv tunner setup

Problem

Can't get a  Kworld KW-TV878RF ( bt878 chipset ) to work, tvtime-scanner doesn't detect any channel, dmesg shows the module as loaded ( running the  2.6.28-6-generic kernel on Ubuntu 9.04 alpha , but that's not the issue as it turned out ), but still no channel available.

Solution

Edit /etc/modprobe.d/bttv and add the following lines:

alias char-major-81 videodev
alias char-major-81-0 bttv
options bttv card=78 tuner=5 radio=1

The first two lines might not be needed but that's how I had them on gentoo, before I decided to install ubuntu.
The last line is actually telling the bttv drive the exact type of card you have.
For other cards the card number might be different.