BIND DNS Web Interface

Working on a web interface for BIND DNS with major inspiration from probinder, here are some preliminary screenshots:

Zone record view

Record edit

Generate and push zone files

This is still in development and very alpha quality, will post some more as I add things.

Exim stop all outgoing emails

A client wanted to ensure their scripts were sending out mails without the clients actually receiving the mails and having them redirected somewhere else.

You can do this with an exim filter:

1. Create /etc/cpanel_exim_system_filter_custom with the following content:

# Stop outgoing emails and redirect

if first_delivery
and (“$h_from:” contains “outgoing@domain.com”)
then
seen deliver “test@otherdomain.com”
endif

Then in whm->Exim Configuration Editor->Filters

Change the filter to point to this new file.

Kayako 3.70 and Ckeditor

We are using kayako 3.70 at work, unfortunately the rich text editor that comes with it is pretty old and next to useless, I’ve integrated the fabulous ckeditor with file upload to enable us to build our knowledgebase:

ROOT will refer to the root directory of your kayako installation.

1. Create a folder called rteeditor in your kayako includes folder – ROOT/includes/rteeditor
2. Download ckeditor and ckfinder and uncompress to ROOT/includes/rteeditor – this will give you ROOT/includes/rteeditor/ckeditor & ROOT/includes/rteeditor/ckfinder
3. Edit ROOT/themes/admin_default/cpheader.tpl

Comment out all the references to htmlArea and insert the ckeditor code:

You can see the code here: http://pastebin.com/AL2r6qzW

For file upload you will have to modify ckfinder’s config.php file and amend the authentication section, unfortunately I cant seem to get at the kayako session data as yet so cant ensure authentication properly, as I have this installation behind a password protected url I have had to just return true in the config file (I strongly recommend you do not do this as it will enable anyone to upload to your server.)

Once I get more time I’ll work on the authentication and try and tie in the kayako session data into the upload authentication.

Anyway, I hope this helps someone.

Best Doughnut Recipe Ever!

This is my variation on a recipe I found online, bill style, these doughnuts are the best ones I ever made, they are light fluffy, sweet and taste just like shop bought doughnuts, easy and quick to make.

Ingredients:

  • 6-7 Teaspoons of yeast
  • 1/4 cup lukewarm water
  • 1 & 1/2 cups of lukewarm milk (full fat)
  • 3/4 cup sugar
  • 2 eggs
  • 1/3 cup shortening (lard) – I couldn’t get hold of lard which is basically pig fat, but you can get it from a polish shop, its called smalec and has pictures of pigs on the wrapper.
  • 4 cups plain white flour
  • 1 cup cornflour
  • 1 teaspoon salt

Doughnuts:

Put water in bowl, add in yeast and 1 tablespoon sugar – leave for 10 minutes until frothy.

In another bowl mix:

Milk, sugar, salt, eggs, shortening and 2 cups of the plain flour

After 5 minutes add in the remaining ingredients and mix thoroughly:

2 cups of plain flour, 1 cup of cornflour and the yeast mixture

Leave for 1 hour – it should grow substantially, I use a glass bowl so I can see the side of the dough as its growing, you want lots of bubbles.

Dust surface with flour and roll out dough, cut into doughnut shapes

Leave cut out doughnuts for another 30 minutes

Fry at 175 Degrees C (use a fat fryer as its much easier than a pan and you get the best results), about a minute each side until golden brown on both sides.

Dip in the glaze and allow to cool.

Glaze:

  • 1/3 Cup butter
  • 2 cups icing sugar
  • 1 & 1/2 teaspoons of vanilla essence
  • 4-6 tablesppons of hot water.

Easy – add everything together except the water and mix thouroughly.

Add water 1 teaspoon at a time to get the right consistency (not too runny)

Plesk useful password related tips

Useful things to add to your aliases file to retrieve plesk passwords:

mailpwd()
{
if [ $# -eq 1 ]; then
MYSQLPWD=`cat /etc/psa/.psa.shadow`
DOMAIN=$1;
#query mysql db for domain name
QUERY="SELECT CONCAT_WS('@',mail.mail_name,domains.name),accounts.password FROM domains,mail,accounts WHERE domains.id=mail.dom_id AND accounts.id=mail.account_id AND domains.name = '$DOMAIN';";
mysql -B -uadmin -p`echo $MYSQLPWD` -D psa -e"$QUERY";
else
echo "Function mailpwd requires 1 argument - a domain name"
fi
return;
}

ftppwd()
{
if [ $# -eq 1 ]; then
MYSQLPWD=`cat /etc/psa/.psa.shadow`
DOMAIN="/var/www/vhosts/"$1;
#query mysql db for domain name
QUERY="SELECT REPLACE(sys_users.home,'/home/httpd/vhosts/','') AS domain, sys_users.login,accounts.password FROM sys_users LEFT JOIN accounts on sys_users.account_id=accounts.id WHERE sys_users.home = '$DOMAIN';";
mysql -B -uadmin -p`echo $MYSQLPWD` -D psa -e"$QUERY";
else
echo "Function ftppwd requires 1 argument - a domain name"
fi
return;
}

dbpwd()
{
if [ $# -eq 1 ]; then
MYSQLPWD=`cat /etc/psa/.psa.shadow`
DOMAIN=$1;
#query mysql db for domain name
QUERY="SELECT domains.name AS domain_name,data_bases.name AS database_name, db_users.login, accounts.password FROM data_bases, db_users, domains, accounts WHERE data_bases.dom_id = domains.id AND db_users.db_id = data_bases.id AND db_users.account_id = accounts.id AND domains.name = '$DOMAIN';";
mysql -B -uadmin -p`echo $MYSQLPWD` -D psa -e"$QUERY";
else
echo "Function dbpwd requires 1 argument - a domain name"
fi
return;
}

alias qstat='/var/qmail/bin/qmail-qstat'
alias qread='/var/qmail/bin/qmail-qread | less'

From a shell script usage is as follows:

mailpwd domainname.com – This will get you all the usernames & passwords for all the mail accounts under a domain.

ftppwd domainname.com – This will get you all the ftp usernames & passwords for all the ftp accounts under a domain.

dbpwd domainname.com – This will get you all the database usernames & passwords for all the db accounts under a domain.

Hope its useful.

WHMCS and opensrs API

We use WHMCS at work, its a fantastic piece of software and comes with lots of built in modules for integrating with various registrars, normally you only need your reseller username and password to enable integration with a registrar from WHMCS but in the case of opensrs things are a little different, every domain name has its own username and password rendering the opensrs module in whmcs useless for entering in legacy domains – its great for new domains but for entering old ones no integration is possible with the whmcs opensrs module.

If you are an opensrs reseller you can request from them the ability to view each domains username and password in the opensrs admin control panel (you have to sign an additional agreement).

I have written a module which integrates with opensrs for existing domains – you have to put the domain username and password in the subscription field in whmcs (I do not use this field).

The following actions are supported:

  • Get / save Nameservers
  • Get / save Registrar lock
  • Get / save Contact details
  • Get EPP Code
  • Renew

Features not supported:

  • Register – you should use the normal opensrs module for new domains
  • All the DNS / Email Forwarding functionality
  • Transfer

Download the existing opensrs module

I accept no responsibility for any damanage caused by this module, as with everything – BACKUP FIRST!