Thursday, March 6, 2008

Why do I get the error "Directory Listing Denied" when attempting to view my webpage?

If you get the following error, Default Documents needs to be configured, or Directory Browsing needs to be enabled for the directory.

Directory Listing Denied
This Virtual Directory does not allow contents to be listed.
Your main (index) page should usually be named "index.htm", "index.html", or "default.htm". If one of these files exists, and you're still getting the error, check the following:
Open Internet Information Services (IIS) Manager.
Expand the respective web site.
Right-click on the directory that is giving this error (if it's the main URL, just right-click on the web site), select Properties.
Select the Documents tab, check the box for "Enable default content page"
Click the Add button, and add the index page that you're trying to browse to.

Why is my browser showing "Page not found" when loading my ASP pages?

If your browser is showing "Page Not Found" when trying to load your .asp pages, you may need to ensure that .asp extenstions are enabled.

To do this, open the IIS applet (Administrative Tools -> Internet Information Services (IIS) Manager)
Right-click on Active Server Pages, and select "Allow"

Why do I keep getting asked to install the Windows Update ActiveX Control?

It some cases, after installing Patch 896688, when browsing windowsupdate.microsoft.com the server is reported as not having the Windows Update ActiveX control installed.
Additionally, you are not prompted to install the ActiveX control no matter what the ActiveX settings are within IE.
Step 1: BACKUP THE REGISTRY
Step 2: Create the file OLE_fix.reg with the following contents:
Code:
REGEDIT4
[HKEY_CLASSES_ROOT\CLSID\{0000031A-0000-0000-C000-000000000046}]@="ClassMoniker"
[HKEY_CLASSES_ROOT\CLSID\{0000031A-0000-0000-C000-000000000046}\InprocServer32]@="ole32.dll"
[HKEY_CLASSES_ROOT\CLSID\{0000031A-0000-0000-C000-000000000046}\ProgID]@="clsid"
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\CLSID]@="{0000031A-0000-0000-C000-000000000046}"
Step 3: Merge OLE_fix.reg into the registry (double click or Right Click->Merge)

What are some tools that I can use to troubleshoot mail delivery issues with Exim on my linux / BSD / unix server?

This article will highlight some of the utilities included with the standard exim installation that assist in troubleshooting mail delivery issues.

Exigrep

Exigrep is very useful when you need to search for specific strings in the exim logfile. The reason for this is that it will look for the search string you specify, match that to a message-ID, and then display all the lines pertaining to that message.

Usage: exigrep /path/to/exim/logfile

Examples:

root@cpdemo [~]# exigrep 1BbLM3-0007fA-0v /var/log/exim_mainlog2004-06-18 10:32:35 1BbLM3-0007fA-0v <= root@cpdemo.example.com U=root P=local S=1037

2004-06-18 10:32:37 1BbLM3-0007fA-0v => /dev/null R=system_aliases T=**bypassed**2004-06-18 10:32:37 1BbLM3-0007fA-0v Completed

Exiwhat

The 'exiwhat' command displays what each running exim process is doing at that given moment. This can be helpful in tracking down the cause for hanging exim processes or monitoring exim processes while they perform certain functions during testing.

Example

:root@cpdemo [~]# exiwhat

2118 daemon: -q1h, listening for SMTP on port 25 (IPv4)

2130 daemon: no queue runs, listening for SMTPS on port 465 (IPv4)

31640 handling incoming connection from [67.19.0.37]

Exim -bh

This section describes another usage of the exim mail server binary with special arguments that allow you to simulate a mail delivery from an external IP as the sender from the local server with the exim installation. This can be very useful when you need to recreate the mail delivery issue and you don't have access to the sender's machine to do so(ex. mail relaying, blacklists, etc.).

Usage: exim -bh

This will create a fake SMTP session which appears to be from . Not only that, but it also displays what exim is doing behind the scenes, and also what it would normally log. Now, bear in mind that this will not actually inject a message into the queue, nor will it actually log anything. This does however require knowledge of SMTP commands, but they are fairly easy. I have highlighted them in bold below for easier reading.

Example:

root@cpdemo [/var/spool/exim/input]# exim -bh 216.87.129.155

**** SMTP testing session as if from host 216.87.129.155

**** but without any ident (RFC 1413) callback.

**** This is not for real!

>>> host in host_lookup? no (option unset)

>>> host in host_reject_connection? no (option unset)

>>> host in sender_unqualified_hosts? no (option unset)

>>> host in recipient_unqualified_hosts? no (option unset)

>>> host in helo_verify_hosts? no (option unset)

>>> host in helo_try_verify_hosts? no (option unset)

>>> host in helo_accept_junk_hosts? yes (matched "*")

220-cpdemo.domain.com ESMTP Exim 4.34 #1 Fri, 18 Jun 2004 16:05:31 -0500

220-We do not authorize the use of this system to transport unsolicited,

220 and/or bulk e-mail.helo bbozo-2.example.com>>> bbozo-2.example.com in helo_lookup_domains? no (end of list)250 cpdemo.domain.com Hello bbozo-2.example.com [216.87.129.155]mail from: ken@bbozo-2.example.com

250 OK

How do I enable reverse DNS lookup in Exim?

To enable reverse DNS lookups in Exim, you would edit your exim configuration file (usually /etc/exim.conf) and add the following towards the top of the file:
host_lookup = 0.0.0.0/0
This will perform a reverse lookup for all incoming connections. Be sure that this is placed toward the top of the file in the "Main" section, and not lower down in one of the ACL, Router, or Transport sections.
If you are running cpanel, you cannot edit exim.conf manually, as it will be overwritten. To enable this function, log into WHM and go to the advanced exim configuration editor. In this editor, the first box is where you will put the above configuration directive.

My ISP blocks access to port 25. How do I run exim on a different port?

Log into WHM, and click on "Service Manager" under the Service Configuration grouping. Put a checkmark next to "exim on another port" (the default is port 26). After that, click "Save", and you should be able to connect to the mailserver.

Why am I not able to receive email on mydomain.com when I am able to send emails?

If you are able to send email out, but unable to receive mail for a particular domain, there are several things to check.

The first would be to verify that your mail client (ie. Outlook, Outlook Express, Thunderbird, etc ...) is set to check the proper incoming mailserver (also referred to as the POP server). The next thing to check, is that the MX record for your domain is set to the proper value. An MX record is a DNS record that specifies which server incoming email should be delivered to. If this is set to an incorrect value, then mail might be being delivered to a different server than you expect.
Another reason for this behavior might be because the server you are using to send mail out from, might be incorrectly configured to accept mail for mydomain.com. When you send mail out through this server, it thinks that this mail is a local delivery and does not bother to check the MX record.

What do I do if /var partition is constantly running out of space?

Make sure your log rotation scripts are configured and working properly. If you've disabled crond for some reason it's likely that none of the log files in /var/log are being compressed and periodically deleted. Another commonly filled directory is /var/spool/mail. If you seldom or never check mail on your server this could consume considerable amounts of space. Make sure you either forward that mail to an address you'll read or read it from the server directly. In either case you will have to delete files before any compression can take place. Be aware that large files may not fit into temporary space so keeping /var tidy can be critically important.

How do I create an SPF record for my domain?

SPF stands for Sender Policy Framework, and is a method by which the administrator of a domain explicitly specifies which mailservers are allowed to send mail for his domain. As this is just a TXT record that is put into the domains DNS zone file, the setup is fairly straightforward. A very basic SPF for mydomain.com might look like this:
mydomain.com IN TXT "v=spf1 a mx ~all"
The above specifes that this is an SPF record for mydomain.com:
v=spf1 - a required header that indicates this is an spf record
a - the A record for mydomain.com is allowed to send email
mx - the MX record for mydomain.com is allowed to send email
~all - all other mailservers trying to send mail will return a code of "softfail". The mail will still go through, however it will be a suspect message
If you wished to allow another server to send mail through that had the hostname of mail2.mydomain.com, you would modify the record thusly:
mydomain.com IN TXT "v=spf1 a mx a:mail2.mydomain.com ~all"
Also, if you wish to give a hard fail, and only allow those servers to send mail, the record would look like:
mydomain.com IN TXT "v=spf1 a mx a:mail2.mydomain.com -all"

How can I test to make sure that my mailserver is not an open relay?

If you are testing a Linux/BSD/UNIX server, you can ssh into the box and issue the following command:telnet relay-test.mail-abuse.org

If you are on a Windows server, you will have to register at http://www.abuse.net/ in order to run these tests/

How do I view what exim is doing?

Exim comes with a utility called 'exiwhat' which will display what each instance of exim is currently involved with. The output will look similar to this:

root@server [~]# exiwhat

2118 daemon: -q1h, listening for SMTP on port 25 (IPv4)

2130 daemon: no queue runs, listening for SMTPS on port 465 (IPv4)

31640 handling incoming connection from [1.2.3.4]

Also, to monitor the exim log in realtime, you may use the tail command thusly:

tail -f /var/log/exim_mainlg

How do I track down the source of a script or user abusing a mail script to spam from a server as "nobody"?

mv /usr/sbin/sendmail /usr/sbin/sendmail.save
Create a new /usr/sbin/sendmail file with your favorite editor containing the following:
#!/usr/local/bin/perl
# use strict; use Env;
my $date = `date`;
chomp $date;
open (INFO, ">>/var/log/formmail.log") die "Failed to open file ::$!"; .
my $uid = $>;
my @info = getpwuid($uid);
if($REMOTE_ADDR) {
print INFO "$date - $REMOTE_ADDR ran $SCRIPT_NAME at $SERVER_NAME n";
}
else {
print INFO "$date - $PWD - @infon";
}
my $mailprog = '/usr/sbin/sendmail.real';
foreach (@ARGV) { $arg="$arg" . " $_";
}
open (MAIL,"$mailprog $arg") die "cannot open $mailprog: $!n";
while ( )
{
print MAIL; }
close (INFO);
close (MAIL);
Then run these commands:
chmod +x /usr/sbin/sendmail
touch /var/log/formmail.log
chmod 666 /var/log/formmail.log
This will now log the directory the script ran from (if its from php) and the user information. The log file is globally writable so this script should not be used for long periods of time and only while you can monitor the log file. Save the new sendmail script to another file name when you are done and rename the original sendmail binary.
mv /usr/sbin/sendmail /usr/sbin/sendmail.spam.check
mv /usr/sbin/sendmail.real /usr/sbin/sendmail
Use this script at your own risk.

Write Failed:Disk Quota Exceede while changing password for email account.

Hello,

Error

Webmail authentication Error, unable to login to webmail,write failed disk quota exceeded error

Fix

A recent bug has been found in the cpanel maildir update, the disk quota used by the mail accounts shows false usage on whole server eg. usage of bill@microsoft.com shows disk quota used 1253M where the quota set is 10M which isnt possible but the recent bug has made it possible heard that this will be fixed in next update, found a temporary solution to fix it.

Command :

/scripts/generate_maildirsize --force --allaccounts

OR

For single account remove the file "maildirsize" under the email account user directory.This command would fix the issue.

Remove the "maildirsize" file in /home/user/mail/emailaccount/ and try. This will fix the issue.

How do I enhance spamassassins detection of spam?

Out of the box, SpamAssaassin is not especially great at detecting what is spam, and what is ham (legitimate email). In order to drastically increase the detection levels, you must first collect email and sort it into spam and ham, with the bigger the collection the better. After this is done, in ssh you can run the sa-learn command to train spamassassin. The format of this command would be:

sa-learn --showdots --(ham or spam) --mbox -u username --sync /path/to/filename

Note: if you have a Maildir setup, then do not use the --mbox flag

After this, you can monitor your spamassassin log to see if the detection rates have gone up.

How can I test that Spamassassin is properly recognizing spam?

To verify that spamassassin is indeed tagging messages as spam, send an email with the following in the body. This should be put all on one line without out any whitespace or page breaks:XJS*C4JDBQADN1.NSBN3*2IDNEN*GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL*C.34XThis should be marked with a spam score of 1000.

How can I stop our Spamassassin from marking all internal emails as spam (sent from a domain on the server to another domain on the server)?

The easiest way to do this, would be to modify /etc/mail/spamassassin and set the trusted_networks setting. You should include localhost, and either your servers IP, or the entire range of IP's that are on your server. If your servers IP address was 1.2.3.4, an example would be:trusted_neteworks 127.0.0.1 1.2.3.4

How can I install a Perl Module ?

On a server with CPanel, you can log into the WHM and install it there. If that for some reason doesn't work for you, you can log into the shell as root and install it via the command line. Once logged in, from any directory, type: echo "HTML::Template" /usr/local/cpanel/whostmgr/bin/perlmod -i (in this case, the module we want to install is HTML::Template).

On a RedHat server, you can install it with up2date if you know the name of the RPM. If you don't know it you can run 'up2date --showall grep -i perl'. Then select the RPM you want and install it via up2date.

If the module you want still isn't present you can install it manually via CPAN. Note that these modules are completely unsupported. If you wish to procede with the installation you can run 'perl -MCPAN -e shell' and interactively install the module. For example if you wanted to install Time::HiRes you would type 'install Time::HiRes' on the CPAN prompt.

What do I do if my server is returning emails with the error: unrouteable mail domain for any valid mail-routable domain?

Server is returning emails with the error: "unrouteable mail domain" for any valid mail-routable domain
From shell, type: (yahoo.com as example) exim -bt info@yahoo.com
Ifthis returns unrouteable mail domain "yahoo.com", then the problem iswith the local config of the server itself. Check to make sure that thehostname has an A record, is resolvable globally, and that MX recordsdo indeed exist. (A record and MX record entries should ALWAYS existfor the hostname of the server.)
If this returns you a list of the domain's mail servers, do a:

cat /var/log/exim_mainlog grep "failed to expand condition"
If you see this error persistantly in exim_mainlog: "failedto expand condition" "${perl{checkspam}}" for lookuphost router: Gid XXis not permitted to relay mail at /etc/exim.pl line 365.
Make sure that you have WHM > Change System Mail Preferences > nobody's mail set to a valid email address. Also,uncheck "Track the origin of messages sent though the mail server byadding the X-Source headers (exim 4.34+ required)" in WHM.
If you see this error in exim_mainlog: "failedto expand condition "${perl{checkspam}}" for literal router: Domaincableforum.co.uk has exceeded the max emails per hour. Messagediscarded."
The domain has exceeded their max emails per hour set within WHM > tweak settings > Max emails per hour.
Ifthe domain is hosted on the server, check and make sure that the domainresolves, has a correct MX record, and exists in /etc/localdomains.

How do I install Fantastico on my cPanel server?

Ideally your server will already have Fantastico installed. If that is not the case, the installation is rather simple. From an ssh session, preform the following steps:

cd /usr/local/cpanel/whostmgr/docroot/cgi
wget -N
http://files.betaservant.com/files/free/fantastico_whm_admin.tgz
tar -xzpf fantastico_whm_admin.tgz
rm -rf fantastico_whm_admin.tgz


Now go to WHM, login as root and follow the link: Fantastico De Luxe WHM Admin (scroll down the left menu to find it). Upon loading, Fantastico De Luxe WHM Admin will auto-update. After the install you will need to click on the Settings link, and follow the on-screen directions.

How do I enable the GD PHP Module in Cpanel?

Log into your server via WHM/cPanel via url like 'http://10.20.30.40:2086/'

Selecte 'Update Apache' under the 'Software' section of WHM on the left side near the bottom.

Next put a check beside 'GD' on the right side of WHM and selected 'Start Build'.

Once it's finished rebuilding Apache, you're done!

Why does cpanel alert me about SSL certificate warnings when trying to login securely?

This is generally because the hostname for the server is not avalid and/or resolvable. If need be, change the hostname and make surethat it is a valid DNS record defined. After that, log into WHM, andclick on "Reset cPanel/WHM Certificate" under the SSL/TLS grouping.

What do I do if my quotas show 0 in WHM?

ssh into the server then issue:

/sbin/quotaoff -av
/sbin/quotacheck -augvm
/sbin/quotaon -av

Where can I view service status in WHM?

Main >> Server Status >> Service Status

This page will display the status of any service that is being monitored plus load,disk space, and memory.

How to update the WHM/CPANEL security certificate which shows expired?

Navigate to Reset Cpanel/WHM Certificate in the left side bar in WHM.

Main >> SSL/TLS >> Reset cPanel/WHM Certificate

This will regenerate and install a self-signed certificate for cpanel/whm/webmail ssl access.

What does 'register nameserver IP's at registrar' mean?

There is a step that must take place before you point your domain at your nameservers; the nameserver names themselves must be registered at the parent servers. What this means is that you must look for a link similar to "Register Nameserver" within your registrar's web interface. This step is necessary because the parent nameservers need to know the IP address of your nameservers before they'll be able to direct DNS traffic at them; since your computer will be handling the DNS traffic for your domain, the only way requests can be directed is if the nameserver IP's for that domain exist at the parent servers. This is why it must be done at your registrar.