Posts Tagged ‘general idea’

GNU / Linux Widgets (gdesklets, screenlets) – Apple MacoSX / Microsoft Vista like Widgets

Tuesday, September 15th, 2009

Screenlet Widget
I’m staying in a friend’s place for few days. Nasko a friend of mine has apple pc and showed me some nice features of the apple MacBook’s Mac OS X. One of the features I liked was the Apple Widgets which are helpful in facilitating the work with your pc. The same widgets are also included in Windows Vista (I always disabled that when used Vista).
Anyways I wondered if there is a way to have the same shiny widgets running on my Debian GNU/Linux.
I first found Gdesklets which basicly is a collection of Widgets for the Linux Gnome desktop written in Python. To run the gdesklet after installation
I had to issue the command:
$ gdesklets .Then in the tray a small tray puzzle icon appears. I sort of wondered a bit until I figured out how to add some gdesklet widgets.
To do that I had to select
“Manage Desklets” and through the gdesklets shell
to click twice the widget I would like to add to the desktop and thendrag it to the exact desktop place I would like it to have it positioned.
I have to emphasize gdesklets widgets are very, very buggy. Many of the widgets I tried crashed the whole application.
After which I had to manually kill the gdesklets app
and delete all it’s temporary files located in
~/.gdesklets directory. Many of the apps that didn’t crashed the gdesklets that required extra data from lmsensors never worked even though I have working version of lmsensors.
I suspect some of the widgets which failed to gather data from lmsensors cause
My notebook is Lenovo Thinkpad R61 and uses some custom features from the thinkpad_acpi kernel module
. Another possible reason for the crashes and misworkings of some components of gdesklets could be because I’m currently running Debian Unstable.

After being a bit disappointment from gdesklets experience.
I went looking further for some Linux widgets alternative.
Next widget related gnome prog I stucked on was jackfield . This one is said to have worked with Apple’s Widgets I don’t believe it does any more since it’s not actively developed anymore.
I tried the jackfield python program with no luck. The untarred archive of it was really messy and what was even worse was it lacked any documentation.
Hence I continued my quest for widgets just to came across a real working Gnome widget application.
Just to find Screenlets! .
I’ve red somewhere that Screenlets is based on jacfield.
The current release of Gnome Screenlets which by the way is officially part of gnome-look.org is 0.1.2. I was pleased to find the application worked pretty decent.
Screenlets includes many, many widgets:
Here is a link containg a list of all the screenlets widgets
.If you like to have a general idea of how screenlets looks like please check out the screenlet in action screenshots
END—–

Create SVN (Subversion) web statistics on Debian Lenny Linux with mpy-svn-stats and svnstats.sh

Monday, July 5th, 2010

I’ve recently desired to have a visualized statistics on how many commits, imports, people who commit into subversion’s repositories,graphs showing up the most active comitters, commits into the all subversion repositories grouped by month, week etc.
This kind of valuable information can give you insight, on a projects code life cycle. It can also help you to find out who takes most active participation into a certain project code development etc. and therefore could play a vital role in finding out about the work efficiency within your IT company or IT department.

There are plenty of softwares that can generate you some shiny statistics on how often and by whom are commits into your repositories as well as general statistics concerning your repositories accessibility.

Some of the projects suggested by most Linux users online, who had to resolve the same task e.g. (find some decent software to generate them good statistics on the svn use.) are:

1. statsvn

Here is a description on what statsvn is directly taken from its website:

StatSVN retrieves information from a Subversion repository and generates various tables and charts describing the project development, e.g.

StatSVN looks really promising, however what I find personally repulsive about it is that it depends on a Sun Java virtual machine
I have a bad taste for third party software that depends on java and therefore the software uses an XML dump generated from svn log –xml -v path/to/repos > svn-logfile.xml after which it’s necessary to pass the generated svn-logfile.xml file to statsvn, for instance:

statsvn [options] svn-logfile.xml path/to/repos

though a debian of statsvn is available and packaged for Debian in /usr/share/doc/statsvn/README.Debian we read:

Notes to Debian users:

* the jtreemap-based report has been disabled as jtreemap is currently
not packaged for Debian, and Debian cannot ship the applet without
its sources (not included in statsvn’s sources).

— Vincent Fourmond <fourmond@debian.org>, Tue, 4 Mar 2008 21:14:14 +0100

What I understood from statsvn documentation is that jtreemap is absolutely necessary in order to have a running statsvn, regardless if you have or you don’t have a java vm installed.

To take a general idea on what kind of Repo Roadmap does svnstat generates with jtreemap check out the following link

Since jtreemap is not available prepackaged for Debian I decided not to use svnstats though it looked quite superb.

Some further research on the kind of softwares available online able to generate me some statistics from cvs or subversion source repositories led me to,

2. svnplot

svnplot stroke me with it’s perfect looking many graphics generated on the Lines of Code commited, contribution of different authors to the repository, File count, avarage commit file sizes, common activity, author commit activity etc. etc.

I think tt’s worthy to check out some example statistics about a sample repository statistics generated by svnplot to get a better idea what to expect if you choose to install it on your server.

Even though svnplot looked also promising It wasn’t actually my choice because I think it’s not really mature enough as a software, the second reason which hold me back from installing it on my debian server was that I find it too much as a work in progress still.

Since neither svnstast nor svnplot didn’t well match my expectation and lacked a debian package I finally choose:

3. mpy svn stats as a solution to generate and graph information about svn usage

There are few reasons I finally took svn-mpy-stats to be the solution of choice.

1. It is available as a package in Debian Linux and easily installable via apt-get
2. It is written in Python and therefore doesn’t require a java virtual machine or some extra cosmetics to make it work3. It’s really simple and straight forward to configure and already tested and reported that it works well in Debian GNU/Linux

So here is the few simple steps I took to install mpy-svn-stats on Debian Lenny (in Debian Sid / Squeeze I suppose the procedure would be analogous.

– Install mpy-svn-stats via apt-get or aptitude

debian-server:~# apt-get install mpy-svn-stats

Run it for your svn repository with a command like:

debian-server:~# mkdir /var/www/svnstats
/usr/bin/mpy-svn-stats -o /var/www/svnstats/ file:///var/svn-repos/repository_name

In the above command substitute /var/www/svnstats/ and /var/svn-repos/repository_name with a directory of choice where you like to generate the html statistics for the svn usage as well as the full path and name of your repository.

Of course it’s a good idea to make mpy-svn-stats run periodically with for instance crontab or at or any other unix task cheduler available for your Linux system.

So far so good. You have probably already noticed that it’s rather inconvenient because you have to execute mpy-svn-stats command to each of your svn repositories individually.
This is absolute madness if your company is creating new svn source repository projects often, like let’s say everyday, because you will have to generate statistics for each of the repositories either manually or add new repositories manually to a script which will be later invoked by a crontab rule.

To get around this constrain, I’ve come up with a tiny shell script svnstats.sh which takes care for everything on it’s own.

It automatically will loop in your main subversion repositories directory through all the sub-repositories and generate individual html statistics in a separate automatically created directory by the script.

So to make your life easier and automate the process of generating stats with mpy-svn-stats consider downloading svnstats.sh and installing it as a separate rule like so:

debian-server:~# crontab -u root -e

Include therein the following:

# generate svn statistics everyday in 05:20 a.m.20 5 * * * /usr/sbin/svnstats.sh >/dev/null >>&1

Now everyday at 05:20 your mpy-svn-stats will generate a nice graphs and statistics for your subversion repository usage in /var/www/svstats, if you consider generating the data into a different location consider editting the head of mpy-svn-stats svnstats.sh script and change according to your likings.

Now let’s create an Alias in Apache to enable the (mpy-svn-stats generated by svnstats.sh) to be visualized via web:

– Edit VirtualHost configuration file of choice and put there, something like:

Alias /svnstats/ /var/www/svnstats/

Lastly it might be a good idea to use htaccess to protect your url with a password, afterwards you can enjoy your mpy svn statistics.

IQ world rank by country and which are the smartest nations

Friday, March 14th, 2014

IQ_world_rank_by_country_world_distribution_of_intelligence
In a home conversation with my wife who is Belarusian and comparison between Bulgarian and Belarusian nation, the interesting question arised – Which nation is Smarter Bulgarian or Belarusian?

This little conversation pushed me to intriguing question What is the IQ World rank if compared by country? Since a moment of my life I'm trying to constantly prove to myself I'm smart enough. For years my motivation was to increase my IQ. I had periods when studied hard history, philosophy and literature then I had periods to put all my efforts in music and mysticism then there was my fascination about IT and informatics and hacking, I had periods with profound interest in Biology and neourosciences, then of course psychology and social sciences and since last 10 years as I belived in God, I'm deeply interested in world religions and more particularly in Christniaty. All this is connected with my previous IQ (Intelligence Quotient) and my desire to develop my IQ. I'm quite aware that IQ statistics can never be 100% reliable as there is deviation (standard error) and its a very general way to find out about a person psychology. But anyways it is among the few methods to compare people's intelligence… I've done an IQ test in distant 2008 and I scored about 118 out of 180  – meaning my  IQ level is a little bit above average. The IQ conversation triggered my curiousity so I decided to check if my current IQ has changed over the last 6 years. Here is results from test I took March, 2013 on free-iqtest.net

IQ Test
IQtest just prooved, my IQ kept almost same, still a little bit above avarage.
Further on, I did investgation online to see if I can prove to my wife the thesis Bulgarians overall IQ is higher than Belarusian. I googled for IQ world rank by Country
Here is what I found ;

 

Nations Intelligence as sorted by Country

Rank
——–

Country
———————–

%
————-

1

Singapore

108

2

South Korea

106

3

Japan

105

4

Italy

102

5

Iceland

101

5

Mongolia

101

6

Switzerland

101

7

Austria

100

7

China

100

7

Luxembourg

100

7

Netherlands

100

7

Norway

100

7

United Kingdom

100

8

Belgium

99

8

Canada

99

8

Estonia

99

8

Finland

99

8

Germany

99

8

New Zealand

99

8

Poland

99

8

Sweden

99

9

Andorra

98

9

Australia

98

9

Czech Republic

98

9

Denmark

98

9

France

98

9

Hungary

98

9

Latvia

98

9

Spain

98

9

United States

98

10

Belarus

97

10

Malta

97

10

Russia

97

10

Ukraine

97

11

Moldova

96

11

Slovakia

96

11

Slovenia

96

11

Uruguay

96

12

Israel

95

12

Portugal

95

13

Armenia

94

13

Georgia

94

13

Kazakhstan

94

13

Romania

94

13

Vietnam

94

14

Argentina

93

14

Bulgaria

93

15

Greece

92

15

Ireland

92

15

Malaysia

92

16

Brunei

91

16

Cambodia

91

16

Cyprus

91

16

FYROM

91

16

Lithuania

91

16

Sierra Leone

91

16

Thailand

91

17

Albania

90

17

Bosnia and Herzegovina

90

17

Chile

90

17

Croatia

90

17

Kyrgyzstan

90

17

Turkey

90

18

Cook Islands

89

18

Costa Rica

89

18

Laos

89

18

Mauritius

89

18

Serbia

89

18

Suriname

89

19

Ecuador

88

19

Mexico

88

19

Samoa

88

20

Azerbaijan

87

20

Bolivia

87

20

Brazil

87

20

Guyana

87

20

Indonesia

87

20

Iraq

87

20

Myanmar (Burma)

87

20

Tajikistan

87

20

Turkmenistan

87

20

Uzbekistan

87

21

Kuwait

86

21

Philippines

86

21

Seychelles

86

21

Tonga

86

22

Cuba

85

22

Eritrea

85

22

Fiji

85

22

Kiribati

85

22

Peru

85

22

Trinidad and Tobago

85

22

Yemen

85

23

Afghanistan

84

23

Bahamas, The

84

23

Belize

84

23

Colombia

84

23

Iran

84

23

Jordan

84

23

Marshall Islands

84

23

Micronesia, Federated States of

84

23

Morocco

84

23

Nigeria

84

23

Pakistan

84

23

Panama

84

23

Paraguay

84

23

Saudi Arabia

84

23

Solomon Islands

84

23

Uganda

84

23

United Arab Emirates

84

23

Vanuatu

84

23

Venezuela

84

24

Algeria

83

24

Bahrain

83

24

Libya

83

24

Oman

83

24

Papua New Guinea

83

24

Syria

83

24

Tunisia

83

25

Bangladesh

82

25

Dominican Republic

82

25

India

82

25

Lebanon

82

25

Madagascar

82

25

Zimbabwe

82

26

Egypt

81

26

Honduras

81

26

Maldives

81

26

Nicaragua

81

27

Barbados

80

27

Bhutan

80

27

El Salvador

80

27

Kenya

80

28

Guatemala

79

28

Sri Lanka

79

28

Zambia

79

29

Congo, Democratic Republic of the

78

29

Nepal

78

29

Qatar

78

30

Comoros

77

30

South Africa

77

31

Cape Verde

76

31

Congo, Republic of the

76

31

Mauritania

76

31

Senegal

76

32

Mali

74

32

Namibia

74

33

Ghana

73

34

Tanzania

72

35

Central African Republic

71

35

Grenada

71

35

Jamaica

71

35

Saint Vincent and the Grenadines

71

35

Sudan

71

36

Antigua and Barbuda

70

36

Benin

70

36

Botswana

70

36

Rwanda

70

36

Togo

70

37

Burundi

69

37

Cote d'Ivoire

69

37

Ethiopia

69

37

Malawi

69

37

Niger

69

38

Angola

68

38

Burkina Faso

68

38

Chad

68

38

Djibouti

68

38

Somalia

68

38

Swaziland

68

39

Dominica

67

39

Guinea

67

39

Guinea-Bissau

67

39

Haiti

67

39

Lesotho

67

39

Liberia

67

39

Saint Kitts and Nevis

67

39

Sao Tome and Principe

67

40

Gambia, The

66

41

Cameroon

64

41

Gabon

64

41

Mozambique

64

42

Saint Lucia

62

43

Equatorial Guinea

59

 

North Korea

N/A

 

– Countries are ranked highest to lowest national IQ score.

Above statistics are taken from a work carried out earlier this decade by Richard Lynn, a British psychologist, and Tatu Vanhanen, a Finnish political scientist. To extract statistics they analized  IQ studies from 113 countries.  

For my surprise it appeared Belarusian (ranking 10th in the world) have generally higher IQ than Bulgarians (ordering 14th). Anyways being 14th in world IQ Ranking is not bad at all as we still rank in the top 20 smartest nations.

IQ is a relative way to measure intelligence, so I don't believe these statistics are revelant but they give some very general idea about world IQs.

I learned there are some claims that in more developed economies people have higher IQs than less developed. If we take in consideration above statistics its obvious such claims are dubious as you can see there are countries in top 5 countries with highest IQ, and surely Mongolia is not to be ordered in countries with high economic development.

There are plenty of other interesting researches like "Does IQ relates to people Income?", Does Religious people score higher than atheists? According to research done in U.S. Atheists score 6 IQ points higher than Religious people. However most "religous" people IQ tested were from protestant origin so results are relative (I'm sure Orthodox Christian would score higher 🙂 ). The IQ nation world ranks fail in a way that, a social, economic and historical factors are not counted. According to Gallups research, the world poorest people tend to be the most religious, a fact supporting well the saying of all saints who say that for saintly life people who preferred deliberately to live as poor people.

 

A preaching words Paschal greeting for Great Saturday and the Resurrection day by Byzantium Emperor Theodore II Ducas Laskaris

Friday, April 29th, 2011

Theodore Ducas Lascaris coin Christian Seal

Below’s text is a Paschal greeting of the Byzantium Emperor Thedodore Ducas Lascaris, the text is really beautiful, I’ve translated it from Bulgarian translation which was translated from Greek, the general idea of the text is clearly observable. I’m really sorry if the text has translation mistakes. Have an enjoyable reading!

“Christ is risen from the death”, that are the words of the Angel; this saw the women; this testifies Pilatus stamps, this is what the empty grave of the Saviour proclaims; this is what testifies for the moved tomb (about 2 tons) stone; the guardians lay bare by their own speech; the grave guards acknowledges and takes the money; the High Priests [Anna and Caiphas] show off they’re guilty; Pilatus is feeling guilt; the centurion on the curtain tear down does believe; the sun has prooved the Godly essence of Christ darkening itself during the crucifix; the resurrected bodies of the many dead saints does testified about the truth; the whole nature confirmed the Resurrection, which has happened in the end of the Saturday, in the beginning of the [first day of the week].

Rejoice oh Man: Christ has Risen from the dead; the testimonial is truthful; Rejoice for you have been freed; hell is bound up, Rejoice!; It’s the day of the Resurrection, rise up your voice; The master of our salvation has risen up from the dead; rejoice oh heaven and earth, see through the resurrection a harmony between holy Angels and humans has been established; rejoice oh you plants; the execution of Christ has been on a Cross, but through the Cross the Resurrection has accomplished; Adam has been risen up again; Eva has been released from the chains; Christ has preceeded over the prophets; The Kings Solomon and David are salute with victorious songs!

Rejoice oh man the darkness has lessen [in the world] the light has come; the shadow has fade away quickly; grace come in; the spring of life has rised. Does somebody needs to hear about God? Doesn’t everybody know, that he rose up from the dead? Why Pilatus is riotous; Chaiphas thinks where to have the assembly of the Jewish elders. Rejoice oh also you robber, and enter in paradise, when everyone is gathered there; here is the firy sword has turned it’s back; the grandparent has been released; rejoice oh you children of him. From Eva has the has the falling come, from the immaculate Theotokos – the rising up; through disobey death has come, through humility of the Son of God has the resurrection was given as a gift. Through a woman the fall up come, and through a woman is the resurrection preached.

Christ is Risen from the death!, let the clouds flow the rain of joice, let the plants draw a fresh leaves and the earth does bring forth fruits.

The creator of all has Risen from death and you rejoice; virtuous branches bring forth your fruits.
Who is not joious today; who is not feeling sweet joy, who is not rejoicing?

Risen up from the death, Christ destroyed kingdom of hell, He is Risen and destroyed the devil; he has risen and erased sin; he has Risen and decreased the idol-mania; He has risen and chased away dilusions; he has risen and rescued Adam; he has Risen and made the engles motionless for evil; He has risen and rescued Man; He has risen and joined the heaven ones with the earth ones, ruling himself as a King of the whole world and most-supreme ruler of all; angels and man, elements, elemental force something unseen so far by the demons.

Therefore rejoice with unspeakable joy; rejoice oh you who hear that Christ is Risen from the death; who does not obey to the first and the last in accordance with the God driven voice (Revel. 22:13), who is not glorifying him? The darkness has been crucified, we’re free from the chains; we’re risen to the upper (heavenly) kingdom.

It’s the day of the Resurrection; who is not picking up a spiritual guitar, to sing up many times a repeating song, with songs, psalms and great joy and with a piercing melody to cry out?: “He is risen from the death” Christ has risen from the death

Let all demons phalanx run far away; and the ruler of darkness with his army let enter the Tartara (hell), because the master of life has Risen and the evil one’s kingdom is robbed.

Let noone all you who are truthful be on the feast with poor garments; let we the Orthodox, does dress our corporeal and spiritual eyes with the shiny garments of goodness; let we the orthodox christians, be dressed up shiny; the enemy [the devil] is dead; the Bishop of Bishops has Risen; yesterday’s sorrow has turned to joy, what is keeping us to sing together with the pupils, to sing up victorious songs together with the Maryies? The Godly home-building is achieved: the descendance of [the Holy Spirit], the conceal, the birth of a Virgin, the baptizmal, the Godly signs, the suffering and Resurrection; Christ has risen from the death, rejoice ohh all you nations.

Likely we on Great Sunday with a divine hymn do glorify the risen from the death Master Christ – truly Risen, truly without doubt.
And for us oh God where from will there be mercy sent for our petitions.

Theodore II Laskaris head painting
Paschal Greeting Text by Byzantium’s Emperor Theodore II Ducas-Lascaris (1254-1258 AD)
Translated from Bulgarian (Original text translated from Greek by Alexey Stambolov)

Filter messages in Qmail with unwanted words, get rid of the Viagra annoying spam with Qtrap

Sunday, September 4th, 2011

Drop qmail received mail containing banned / unwanted words to get rid of Viagra and Sex related spam

Recently the annoying Viagra spam has emerged again. Therefore I decided to clean up some of the mails received to one of the qmail servers to protect users emailbox from this viagra peril.

To do so I’ve remember about an old script which used to be part of qmailrocks.org qmail install, the script is called qtrap and is able to filter emails based on list of specific mail contained words.
Since qmailrocks.org is gone (down) for some time and its still available only on few mirrored locations which by the way are not too easy to find I decided to write a little post on how qtrap.sh could be integrated quick & easy with any Qmail + Vpopmail install out there.

Hereby I include the description for qtrap.sh given by the script author:

“qtrap.sh script is applied on a per domain basis and serves as a “bad word” scanner to catch any spam that Spamassassin may have missed. This filter serves as the last defense against SPAM before it arrived in your inbox. I like this filter because it helps to get rid of any SPAM that happens to make it by Spamassassin. Without any protection at all, my mailbox gets a shit ton of SPAM every day. Within the first 3 months I enacted the Qtrap filter, Qtrap logged over 9,000 deleted SPAM messages, none of which were legitimate e-mails. My keyboard’s delete key was very appreciated the extra rest.

Any emails that are scanned and contain a banned word will be automatically deleted and logged by the qtrap script. A whitelist feature now exists so that individual addresses or domains can be exempt from the qtrap scan.”

Now as one might have general idea on what the script does. Here is the step by step qtrap.sh integration;

1. Create necessery qtrap directory and logs and set proper permissions

If the vpopmail is installed in /home/vpopmail , issue the following commands.

debian:~# cd /home/vpopmail
debian:~# mkdir -p qtrap/logs
debian:/home/vpopmail/qtrap# cd qtrap
debian:/home/vpopmail/qtrap# wget https://www.pc-freak.net/files/qtrap.sh
...
debian:/home/vpopmail/qtrap# cd ~
debian:~# touch /home/vpopmail/qtrap/logs/qtrap.logdebian:~# chown -R vpopmail:vchkpw /home/vpopmail/qtrapdebian:~# chmod -R 755 /home/vpopmail/qtrap

On older qmail installations it could be vpopmail is installed in /var/vpopmail if that’s the case, link /var/vpopmail to /home/vpopmail and go back to step 1. To link:

debian:~# ln -sf /var/vpopmail/ /home/vpopmail

2. Edit qtrap.sh to whitelist email addresses and build a ban words list

a) Include the email addresses mail arriving from which would not be checked by qtrap.sh

Inside qtrap.sh in line 63, there is a shell function whitelist_check(), the function looks like so:

whitelist_check () {
case $WHITELIST in
address@somewhere.com|address@somewhereelse.com)
echo $SENDER found in whitelist on `date "+%D %H:%M:%S"` >> /home/vpopmail/qtrap/logs/qtrap.log
exit 0;;
*)
;;
esac
}

By default the script has just two sample mails which gets whitelisted this is the line reading:

address@somewhere.com|address@somewhereelse.com

The whitelisted emails should be separated with a pipe, thus to add two more sample emails to get whitelisted by script the line should be changed like:

address@somewhere.com|address@somewhereelse.com|hipod@mymailserver.com|hipo@gmail.com

In order to whitelist an entire domain let’s say yahoo.com add a line to the above code like:

address@somewhere.com|address@somewhereelse.com|hipod@mymailserver.com|hipo@gmail.com|*yahoo.com

b) Defining the bad words ban list, mails containing them should not be delivery by qmail

The function that does check for the ban word list inside the script is checkall();, below is a paste from the script function:

checkall () {
case $BANNED_WORDS in
porn|PORN|Sex|SEX)
printout $BANNED_WORDS
echo MESSAGE DROPPED from $SENDER because of $BANNED_WORDS on `date "+%D %H:%M:%S"` >> /home/vpopmail/qtrap/logs/qtrap.log
exit 99;;
*)
;;
esac
}

checkall(); is located on line 74 in qtrap.sh, the exact list of banned words which the script should look for is located on line 76, the default qtrap.sh filters only mails containing just 4 words, e.g.:

porn|PORN|Sex|SEX)

To add the Viagra and VIAGRA common spam words to the list, modify it and expand like so:

porn|PORN|Sex|SEX|viagra|Viagra)

The delimiter is again | , so proceed further and add any unwanted spam words that are not common for any legit mails.

3. Install qtrap.sh to process all emails delivered to vpopmail

If its necessery to install the dropping of mails based on word filtering only to a single vpopmail virtualdomain do it with cmd:

debian:~# cd /home/vpopmail/domains/yourdomain.com
debian:/home/vpopmail/domains/yourdomain.com# touch .qmail-default.new
debian:/home/vpopmail/domains/yourdomain.com# echo '| /home/vpopmail/qtrap/qtrap.sh' >> .qmail-default.new
debian:/home/vpopmail/domains/yourdomain.com# echo "| /home/vpopmail/bin/vdelivermail '' bounce-no-mailbox" >> .qmail-default.new
debian:/home/vpopmail/domains/yourdomain.com# chown vpopmail:vchkpw .qmail-default.new
debian:/home/vpopmail/domains/yourdomain.com# cp -rpf .qmail-default .qmail-default.bak; mv .qmail-default.new .qmail-default
If however qtrap.sh needs to get installed for all existing vpopmail virtualdomains on the qmail server, issue a one liner bash script:

debian:~# cd /home/vpopmail/domains
debian:/var/vpopmail/domains# for i in *; do cd $i; echo "| /home/vpopmail/qtrap/qtrap.sh" >> $i/.qmail-default.new;
echo "| /home/vpopmail/bin/vdelivermail '' bounce-no-mailbox" >> $i/.qmail-default.new;
chown vpopmail:vchkpw .qmail-default.new; mv .qmail-default .qmail-default.old; mv .qmail-default.new .qmail-default; cd ..; done

This for loop will add ‘| /home/vpopmail/qtrap/qtrap.sh’ to all .qmail-default for all vpopmail domains.

Afterwards the .qmail-default file should contain the following two lines:

| /home/vpopmail/qtrap/qtrap.sh
| /home/vpopmail/bin/vdelivermail '' delete

A very important thing here you should consider that adding some common words, as let’s say hello or mail etc. could easily drop almost all the emails the qmail hands in to vpopmail.

Caution!! Never ever implement common words in the list of words !!
Always make sure the banned words added to qtrap.sh are words that are never enter an everyday legit email.

Another thing to keep in mind is that qtrap.sh doesn’t make a copy of the received message ,though it can easily be modified to complete this task.
Any mail that matches the banned words list will be dropped and lost forever.

4. Check if qtrap.sh is working

To check, if qtrap is working send mail to some mailbox located on the qmail server containing inside subject or mail message body the unwanted word defined inside qtrap.sh.

The mail should not be received in the mailbox to which its sent, if qtrap is working moreover qtrap.sh should log it inside it’s log file:

debian:~# cat /home/vpopmail/qtrap/logs/qtrap.log
MESSAGE DROPPED from hipo@mytestmail.com because of viagra on 09/03/11 11:34:19
MESSAGE DROPPED from support@mymailserver.com because of Viagra on 09/03/11 11:39:29

If the qtrap.log contains records similar to the one above, and the mail matching the banned word is not delivered, qtrap.sh is properly configured. If any issues check in qmail logs, they should have a good pointer on what went wrong with qtrap.sh invokation.

Note that I’ve integrated qtrap.sh to custom qmail install running on Debian Lenny 5.0 GNU/Linux.
If I have time I’ll soon test if its working fine on the latest stable Debian Squeeze and will report here in comments.
If however someone is willing to test if the script works on Debian Squeeze 6.0 or have tested it already please drop a comment to report if it works fine.
qtrap.sh, is a bit oldish and is not written to work too optimal therefore on some heavy loaded mail servers it can create some extra load and a bit delay the mail delivery. Thus when implementang one needs to consider the downsides of putting it in.

Also I was thinking tt might be nice if the script is rewritten to read the ban words and whitelist mails from files instead of as it is now as the words are hard coded in the script.
If I have some free time, I’ll probably do this, though I’m not sure if this is a too good idea as this might have a negative performance impact on the script execution time, as each instance of the script invoked should do one more operation of reading a file storing the ban words.

Well that’s pretty much it, enjoy 😉