FAQforge provides answers for frequently asked questions for the Linux-, MAC and Windows operating systems.

How to prevent the automatic restart after a Windows update?

Monday, September 14, 2009 - posted by Till

One solution is to stop the windows update service to prevent that Windows XP restarts the computer after an update. The update service will be started again after the next boot.

Click on "Start" > "Run" and enter the command:

net stop wuauserv

pure-ftpd does not show more then 2000 files on Debian and Ubuntu

Friday, September 4, 2009 - posted by admin

The pure-ftp daemon by default has a recursion limit of 2000 files, this prevents the server from showing more then 2000 files when you browse a directory with a FTP client. To expand this Limit to e.g 5000 files, create or edit the file /etc/pure-ftpd/conf/LimitRecursion and add a line "5000 500":

echo "5000 500" > /etc/pure-ftpd/conf/LimitRecursion

and then restart pureftpd:

/etc/init.d/pure-ftpd-mysql restart

How to enable DKIM email signatures in amavisd-new and ISPConfig 3

Thursday, September 3, 2009 - posted by admin

DKIM is a system to verify the sender and integrity of emails. ISPConfig 3 uses amavisd-new as content filter for spam and virus scanning and amavisd-new is also able to sign messages with DKIM. The next steps explain how to configure amavisd-new to sign messages for a domain named "example.com" with DKIM. The steps below should work with any amavisd-new setup even if you do not use ISPConfig.

1) Create the domain key:

mkdir /var/db/dkim/
amavisd genrsa /var/db/dkim/example-foo.key.pem

2) Configure amavisd to use this key for the domain example.com. Edit the amavisd configuration file

vi /etc/amavisd/amavisd.conf

and add the following lines:

$enable_dkim_verification = 1;
$enable_dkim_signing = 1;
dkim_key('example.com', 'foo', '/var/db/dkim/example-foo.key.pem');
@dkim_signature_options_bysender_maps = (
{ '.' => { ttl => 21*24*3600, c => 'relaxed/simple' } } );
@mynetworks = qw(0.0.0.0/8 127.0.0.0/8 10.0.0.0/8 172.16.0.0/12
192.168.0.0/16);  # list your internal networks

3) Run the command:

amavisd showkeys

to get the public key that has to be added as TXT record in the DNS server of the example.com DNS server.

4) Thest the setup with the command:

amavisd testkeys

and if it works properly, restart amavisd:

/etc/init.d/amavis restart

Here is a more detailed description in the amavisd-new manual on how to setup DKIM in amavisd-new:

http://www.ijs.si/software/amavisd/amavisd-new-docs.html#dkim

How to convert filenames or text to lowercase on the shell

Wednesday, September 2, 2009 - posted by admin

There is no simple tolower command on the bash, but with a little shell script you can convert uppercase characters to lowercase. The script uses the tr command internally for converting the chars.

Create a shell script with the name tolower:

vi /usr/local/bin/tolower

and enter the following content:

#!/bin/sh
echo $1 | tr '[:upper:]' '[:lower:]'

Then make the script executable:

chmod +x /usr/local/bin/tolower

An test it by executing this command on the shell:

tolower "Thats a Test"

will convert the string to lowercase and show the result on the shell:

thats a test

Blocking .exe attachments with postfix or amavisd-new and ISPConfig 3

Wednesday, September 2, 2009 - posted by admin

If you use postfix and / or amavisd-new on the mail server, you can use the following recipes to block emails with executable (exe, bat, scr) attachments.

Block the attachments with a postfix header filter

In ISPConfig, click on "Email in the upper menu, then on "Content filter" in the left menu and click on the "Add new content filter" button. Enter the following details:

Filter:

MIME-Header Filter

Regexp. Pattern:

/^Content-(Disposition|Type).*name\s*=\s*"?(.*\.(bat|exe|scr))(\?=)?"?\s*(;|$)/x

Data:

File extension is blacklisted on this server

Action:

DISCARD

Use amavisd-new to block the emails with executable attachments.

Edit the amavisd configuration file (/etc/amavisd.conf or /etc/amavisd/amavisd.conf)

vi /etc/amavisd/amavisd.conf

and add the following lines:

$banned_filename_re = new_RE(
qr'.\.(bat|exe|scr)$'i,
qr'^\.(exe|zip|lha|tnef)$'i,
);

then restart amavisd-new:

/etc/init.d/amavis restart

How to access a namebased website without a DNS record

Monday, August 31, 2009 - posted by admin

If you want to access a namebased website that you created e.g. in ISPConfig before the DNS records are setup, edit the hosts file on your workstation computer and add a line like this:

192.168.0.100        www.mydomain.com

Replace the IP address with the IP of your server and www.mydomain.com with the domain name of the website.

The hosts file on linux and MAC systems is /etc/hosts, on Windows systems the hosts file is C:\Windows\system32\drivers\etc\hosts

The above trick also works if you want to run a website in your internal network (intranet) without having a DNS server availalble for local dns resolving.

A copy of a incoming email can be sent to a second email address by adding a cc command to the "Custom Rules" field of the mailbox in ISPConfig.

ISPConfig supports sieve as well as maildrop filter rules. The rule language depends on the LDA / POP3 / IMAP-Daemon that you use on your server. If you use courier, then the filter language is maildrop. When dovecot is installed, then the filter language is ieve.

Example in maildrop syntax:

To send a copy to the email address info@example.tld, add the following code at the beginning of the custom rules field.

cc '!info@example.tld'

Example in sieve syntax:

redirect 'info@example.tld';
keep;

If you get the following error message in Ubuntu when you use PHP based shell scripts:

PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20060613+lfs/htscanner.so' - /usr/lib/php5/20060613+lfs/htscanner.so: cannot open shared object file: No such file or directory in Unknown on line 0

Then edit the file /etc/php5/cli/php.ini:

vi /etc/php5/cli/php.ini

and remove the lines:

[htscanner]
Extension = "htscanner.so"
config_file = ".htaccess"
default_docroot = "/var/www"

As the htscanner module works only for scripts within webservers but not for commandline scripts.

ISPConfig 2: External mailserver setting does not work

Friday, August 21, 2009 - posted by admin

Problem: I have set the website to external mailserver in ISPConfig but emails get still delivered to the local server.

Solution: Set all co-domains of this website to external mailserver too. You find the external mailserver setting on the options tab of every co-domain.

Postfix: “queue file write error”

Friday, August 21, 2009 - posted by admin

If you get an error like:

Aug 21 12:41:03 webb4 postfix/sendmail[11234]: fatal: web1_user(12967): queue file write error

in your mail log, then the vale for message_size_limit in postfix main.cf is too low. Edit postfix main.cf:

vi /etc/postfix/main.cf

and set the message size limit to a higher value. E.g.

mesage_size_limit = 900000000

and restart postfix:

/etc/init.d/postfix restart

If there is no message_size_limit set in main.cf, just add the line.