Archive for March, 2010

No Such User / Sender Verify error when sending via main account

March 28th, 2010

When using your cpanelusername@domain.tld account, the account needs to be able to receive mail, as well as send. If you login to your main account via webmail, and see the following errors posted, you’ll want to confirm that the address is permitted to receive mail.

Horde shows:
There was an error sending your message: Failed to add recipient: recipient@targetrecipient.com [SMTP: Invalid response code received from server (code: 550, response: Verification failed for No Such User Here" Sender verify failed)]

/var/log/exim_mainlog shows:
2010-03-28 18:47:46 H=localhost (userdomain.com) [127.0.0.1] sender verify fail for : No Such User Here"
2010-03-28 18:47:46 H=localhost (userdomain.com) [127.0.0.1] F= rejected RCPT : Sender verify failed

99.99999% of the time, you’ll see this issue when the Default Address is set to “fail”, making it unrouteable. In cPanel > Default Account, set the catch-all account to forward to another email address, and you’ll be all set.

# cat /etc/valiases/userdomain.com
*: ":fail: No Such User Here"

Such a setting would tell the server that the account doesn’t exist, causing the Sender Verify error.

Share

OpenVZ: Set VE timezone

March 23rd, 2010

From within the container, run the following, changing the location data to match your timezone of choice:

#mv /etc/localtime /etc/localtime.old
#ln -s /usr/share/zoneinfo/America/Chicago /etc/localtime

Share

OpenVZ: CSF csftest.pl Failed

March 23rd, 2010

ERROR: RESULT: csf will not function on this server due to FATAL errors from missing modules [4]

CSF will work well in VZ containers, but needs specific iptables modules enabled. Below you’ll see how to enable these modules for use for all containers.

root@server [/csf]# perl csftest.pl
Testing ip_tables/iptable_filter...OK
Testing ipt_LOG...FAILED [FATAL Error: iptables: Unknown error 18446744073709551615] - Required for csf to function
Testing ipt_multiport/xt_multiport...FAILED [FATAL Error: iptables: Unknown error 18446744073709551615] - Required for csf to function
Testing ipt_REJECT...OK
Testing ipt_state/xt_state...FAILED [FATAL Error: iptables: Unknown error 18446744073709551615] - Required for csf to function
Testing ipt_limit/xt_limit...FAILED [FATAL Error: iptables: Unknown error 18446744073709551615] - Required for csf to function
Testing ipt_recent...FAILED [Error: iptables: Unknown error 18446744073709551615] - Required for PORTFLOOD feature
Testing ipt_owner...FAILED [Error: iptables: Unknown error 18446744073709551615] - Required for SMTP_BLOCK and UID/GID blocking features
Testing iptable_nat/ipt_REDIRECT...FAILED [Error: iptables v1.3.5: can't initialize iptables table `nat': Table does not exist (do you need to insmod?)] - Required for MESSENGER feature

RESULT: csf will not function on this server due to FATAL errors from missing modules [4]

SOLUTION

Edit /etc/vz/vz.conf, and comment out the line starting with IPTABLES. Then, insert the following:

IPTABLES="ipt_REDIRECT ipt_owner ipt_recent iptable_filter iptable_mangle ipt_limit ipt_multiport ipt_tos ipt_TOS ipt_REJECT ipt_TCPMSS ipt_tcpmss ipt_ttl ipt_LOG ipt_length ip_conntrack ip_conntrack_ftp ip_conntrack_irc ipt_conntrack ipt_state ipt_helper iptable_nat ip_nat_ftp ip_nat_irc"

Be sure that the entire IPTABLES string is on a single line, and you’re all set.

Share

Automated Time Sync Script

March 23rd, 2010

#!/bin/sh

#invoke ntpdate to set time from system clock
if [ -x /usr/sbin/ntpdate ]; then
/usr/sbin/ntpdate -s -t 5 date.cpanel.net
/sbin/hwclock --systohc
fi

Share

Automating ClamAV updates, scans, and email alerts

March 23rd, 2010

http://code.google.com/p/clamav-cron/

Download clamav-cron somewhere like /usr/local/bin/ and give it execute permission:

# wget http://clamav-cron.googlecode.com/files/clamav-cron-0.6 -O /usr/local/bin/clamav-cron
# chmod 755 /usr/local/bin/clamav-cron

Open the clamav-cron script with your editor and edit the “User configuration” section following the instructions.

Schedule the task using crond. Run crontab -e from the command-line and schedule your run of the task.

45 23 * * 6 /usr/local/bin/clamav-cron /home

Share

Log MySQL Queries Not Using Indexes

March 23rd, 2010

First, create the log file location and give mysql ownership:

# touch /var/log/mysql-indexes.log
#chown mysql:mysql var/log/mysql-indexes.log

Edit /etc/my.cnf, and insert:

log-queries-not-using-indexes = /var/log/mysql-indexes.log

Share

What type of RAM is installed?

March 23rd, 2010

If you’re lacking notes on what motherboard or RAM you’ve got, and don’t want to take your server offline to check, dmidecode comes to the rescue!

root@gamma [~]# dmidecode
# dmidecode 2.10
SMBIOS version fixup (2.31 -> 2.3).
SMBIOS 2.3 present.

Handle 0x0012, DMI type 16, 15 bytes
Physical Memory Array
Location: System Board Or Motherboard
Use: System Memory
Error Correction Type: Single-bit ECC
Maximum Capacity: 512 MB
Error Information Handle: Not Provided
Number Of Devices: 6

Handle 0x0013, DMI type 17, 27 bytes
Memory Device
Array Handle: 0x0012
Error Information Handle: No Error
Total Width: 72 bits
Data Width: 64 bits
Size: 1024 MB
Form Factor: DIMM
Set: 1
Locator: DIMM#1A
Bank Locator: BANK1
Type: DDR
Type Detail: Synchronous
Speed: 266 MHz
Manufacturer: Not Specified
Serial Number: Not Specified
Asset Tag: Not Specified
Part Number: Not Specified

Handle 0x0014, DMI type 17, 27 bytes
Memory Device
Array Handle: 0x0012
Error Information Handle: No Error
Total Width: 72 bits
Data Width: 64 bits
Size: 1024 MB
Form Factor: DIMM
Set: 1
Locator: DIMM#1B
Bank Locator: BANK1
Type: DDR
Type Detail: Synchronous
Speed: 266 MHz
Manufacturer: Not Specified
Serial Number: Not Specified
Asset Tag: Not Specified
Part Number: Not Specified

Share

One Liner: Find Large (or small) files

March 23rd, 2010

To find files larger than 20M:

#find . -type f -size +200000k -exec ls -lh {} \; | awk ‘{ print $9 “: ” $5 }’

Share

One Liner: Find Broken Symlinks

March 23rd, 2010

One-liner to find broken symlinks in the filesystem:

#find -L . -type l

Share

OpenVZ – Multiple Subnets on a Single Interface

March 23rd, 2010

This post written by Robert Shady, posted at http://www.robertshady.com/sysadmin/sysadmin-virtualization/sysadmin-virtualization-openvz/5.html Reposting here as sort of a personal bookmark.

You have multiple subnets allocated to you (Ie: Let’s say 2 Class C IP4 address blocks – 10.10.10.1/24 and 10.10.20.1/24), and you want to be able to create containers that utilize IP addresses on either block.

Problem:
You can’t simply install OpenVZ and configure your containers to use IP addresses on either block. By default, OpenVZ will not broadcast ARP packets for IP blocks that it doesn’t have a venet interface for – even though you may be bridging your containers to your ethernet device.

Solution:
The solution is actually very easy, simply edit your /etc/vz/vz.conf file and change the ‘NEIGHBOUR_DEVS=detect’ to ‘NEIGHBOUR_DEVS=all’, save and reboot and everything should work beautifully.

Share

cPanel Web Site Hosting by IntraHost