Archive for the tag 'check'

Using find Command for security check

The ‘find’ command is usually used to find filenames which have specific patterns. However, we can also use it to find the files modified/accessed within a specific time period.

For example we can find all files in /etc owned by root that have been modified within the last 2 days:

find /etc -user root -mtime -2

The options we can use here are:

-atime: when the file was last accessed
-ctime: when the file’s permissions were last changed
-mtime: when the file’s data was last modified

You may have noticed that we have a minus sign in front of ‘2′ in the last example. The ‘time’ options for the find command are expressed in 24-hour increments, and the sign in front of the number can indicate ‘less than’ or ‘greater than’. Thus ‘-2′ means we want to find files which were modified within the last two days. If we wanted to find files that were modified more than 2 days ago, we would need to put a plus sign in front of the 2:

find /etc -user root -mtime +2

There are also versions of the atime, ctime, and mtime arguments that measure time in minutes:

-amin: when (in minutes) the file was last accessed
-cmin: when (in minutes) the file’s permissions were last changed
-mmin: when (in minutes) the file’s data was last modified

To match -atime +1, a file has to have been accessed at least two days ago. More example in the find man pages.

How to check if Python script engine is enabled

We can check using the default Parallels Plesk Panel domain page content (http://domain.tld/index.html) - then by the “Python” item.

The test looks successful if a page with a list of environment variables is shown.

Test can be done using a simple script like this.

#!/usr/bin/env python
# -*- coding: UTF-8 -*-

# enable debugging
import cgitb
cgitb.enable()

print “Content-Type: text/plain;charset=utf-8″
print

print “Hello World!”

It is necessary to put the content into a text file and save in the domain web-accessible folder (like $HTTPD_VHOSTS_D/domain.tld/httpdocs) on the server with .py extension (test.py for example). Then try to open the file via browser by the http://domain.tld/test.py URL.

The test looks successful if a page shows the “Hello World!” string. If an error or full script listing is visible, it means that Python engine is not configured for the domain properly.

Reference: http://parallels.com/

Changing Spamassassin to check emails larger than 250KB

Spamassassin by default will not check emails larger than 250 KB. This is limited to prevent spamassassin from generating a large load on the server.

If you would like to change this setting to a higher value you can edit the following file:

vi /usr/local/psa/bin/psa-spamc

and change this line to a higher value:

MAX_SIZE=256000 # max letter size to filter

Spamassassin will use the new value immediately with no need to restart any services.

Reference: http://parallels.com

fsck - check and repair a Linux file system

fsck - check and repair a Linux file system

fsck is used to check and optionally repair one or more Linux file systems. filesys can be a device name (e.g. /dev/hdc1, /dev/sdb2), a mount point (e.g. /, /usr, /home), or an ext2 label or UUID specifier (e.g. UUID=8868abf6-88c5-4a83-98b8-bfc24057f7bd or LABEL=root). Normally, the fsck program will try to handle filesystems on different physical disk drives in parallel to reduce the total amount of time needed to check all of the filesystems.

If no filesystems are specified on the command line, and the -A option is not specified, fsck will default to checking filesystems in /etc/fstab serially.

This is equivalent to the -As options.

The exit code returned by fsck is the sum of the following conditions:

0 - No errors
1 - File system errors corrected
2 - System should be rebooted
4 - File system errors left uncorrected
8 - Operational error
16 - Usage or syntax error
32 - Fsck canceled by user request
128 - Shared library error

The exit code returned when multiple file systems are checked is the bit-wise OR of the exit codes for each file system that is checked.

1. Create a file with the following content:

<?php
phpinfo();
?>

and then save it into the $HTTPD_VHOSTS_D/domain.tld/httpdocs folder as 1.php (the name may be different, only .php should be existed)

2. Open the file via browser:

http://your-domain.com/1.php

Note! The PHP support should be enabled for the domain.

On the page the standard PHP diagnostic table should be existed.

« Prev - Next »