Blogs

Drupal 5.11 upgrade fixes

With the upgrade to drupal-5.11 the caching feature seemed to have broken SecurePages and the GlobalRedirect modules.

Error:

Fatal error: Call to undefined function: drupal_get_path_alias() in /path/to/includes/common.inc on line 1196

Solution:
Added the below code to the beginning of the securepages_init function in "securepages.module" so paths get loaded if cache is enabled.

  // If cache is enabled we need to load the path system
  if (variable_get('cache', CACHE_DISABLED) != CACHE_DISABLED) {
    drupal_bootstrap(DRUPAL_BOOTSTRAP_PATH);
  }

Reference:
http://drupal.org/node/119009

Error:

Fatal error: Call to undefined function: _menu_item_is_accessible() in /path/to/sites/all/modules/globalredirect/globalredirect.module on line 37

Solution:
Add "function_exists('_menu_item_is_accessible') &&" check in "globalredirect.module":

  if (function_exists('drupal_get_path_alias') &&
      function_exists('_menu_item_is_accessible') &&
      _menu_item_is_accessible(menu_get_active_item()) &&
      isset($_REQUEST['q']) &&
      empty($_POST)) {

Reference:
http://drupal.org/node/301844

Sender Policy Framework (SPF)

Sender Policy Framework (SPF) is an extension to the Simple Mail Transfer Protocol (SMTP). SPF allows software to identify and reject forged addresses in the SMTP MAIL FROM (Return-Path), a typical nuisance in e-mail spam.

The two direct benefits of SPF I found are:

  1. ensuring a spammer/virus/trojan cannot send emails using your email address in the FROM field of the email.
  2. get legitimate emails to go through hotmail (and others of course) junk filter, and not be detected as spam.

Setting up a SPF record

Here is an SPF record template for strict checking. For softfail, use "~all" instead.

v=spf1 a mx ptr ip4:<DomainIP> -all

Where 'DomainIP' is replaced with the IP address for what you're setting this record up for. It can also include a range in CIDR format.
You can read more about other SPF Record Syntax at OpenSPF.org .

So now when people receiving emails from your domain have their SPF checking rule to deny all emails that don't match with this SPF record they should only receive genuine emails from your domain.

If you are a Plesk user, "Switch on SPF spam protection" and next to 'SPF checking mode' select 'Reject mails when SPF resolves to "fail" (deny)'.

To check the SPF record for a particular domain:

$ dig domain.tld txt

Learning Bash Scripting

I thought of learning bash scripting. I do not know how tough is it gonna be. I have not looked at the whole complicated script at all.
I am gonna begin with a simple bash script.

First I need to locate where my bash interpreter is located.
In my case its located in /usr/local/bin/bash

(manoj@linuxweblog.com)
(~) - which bash
/usr/local/bin/bash
Now I am making a simple bash script that would echo(print a string on my scren)
(manoj@linuxweblog.com)touch first_bash.sh
(manoj@linuxweblog.com)vi first_bash.sh

analog filesize limit

I had some trouble with analog monthly stats not showing up for the last week and figured out that analog refuses to parse huge log files. I had one sitting at 3GB without being rotated and analog would error out with:

/usr/bin/analog: Warning F: Failed to open logfile
  /var/log/httpd/access_log: ignoring it

After running gzip on the log file, analog was then able to produce the reports. I think I read somewhere that the limit may be 2GB but have not tested this.

Restoring Plesk server

I have recently had to restore plesk from an offsite filesystem backup due to disk drive failure and loss of data. Below are notes for reference and the corresponding list of important folder/files to be backed up for a successful restore.

It helps if you are restoring sites to the same version of OS and Plesk Control Panel, so reload the OS and version of Plesk as was running prior to the data loss.

SYSTEM:

1. Merge "/etc/passwd", "/etc/group" and "/etc/shadow" for domain user accounts.
2. Bring up all IP aliases:

ifconfig eth0:0 xxx.xxx.xxx.xxx

Note: Keep backup of "/etc".

MYSQL:

1. Reset Plesk "admin" user password to old one.
2. Copy over "/etc/mysql/debian.conf".
3. Import all mysql databases:

Export:

mysqldump --opt --all-databases | gzip > all_db.sql.gz

Import:

gunzip < all_db.sql.gz | mysql -u admin -p

4. Restart mysql.

Note: Keep backup of "/var/lib/mysql" and "/var/log/mysql" (if incase database is corrupted and need to be restored using binary log files).

PLESK:

1. Reload ssl certificates from "/opt/psa/var/certificates/" or reinstall the certs via the control panel.
2. Restore/Merge phpmyadmin config "/opt/psa/admin/htdocs/domains/databases/phpMyAdmin/libraries/config.default.php", the below variables in particular:

$cfg['Servers'][$i]['controluser']
$cfg['Servers'][$i]['controlpass']
$cfg['Servers'][$i]['pmadb']

Note: Keep backup of "/opt/psa".

WEB:

1. Restore "conf.d/zz010_psa_httpd.conf".
2. Sync "/var/www/vhosts".
3. Check for psaserv and psacln folder permissions on "/var/www/vhosts/domains".

chgrp psaserv /var/www/vhosts/<domain>/httpdocs
chgrp -R psacln /var/www/vhosts/<domain>/httpdocs/*

Note: Keep backup of "/var/www/vhosts".

DNS:
1. Copy over "/var/named/run-root/etc/named.conf".
2. Copy over "/var/named/run-root/var".
3. Set the permissions correct:

chown bind /var/named/run-root/var
chgrp bind /var/named/run-root/var/run

Note: Keep backup of "/var/named".

MAIL:

1. Sync "/var/qmail".

Note: Keep backup of "/var/qmail".

Creating graph of Trac workflow

Here is how, I was able to generate graph of the workflow being used in Trac. This helps quite a bit when trying to visualize the workflow that is being setup.

The packages required were ghostscript (ps2pdf conversion) and graphviz (graph creation).

Graphviz is available in DAGs/rpmforge repository, so do an install via:

# yum --enablerepo=rpmforge install ghostscript graphviz graphviz-python

Once graphviz is installed generate config files:

# dot -c

Download the corresponding contrib files from the trac svn:

$ wget http://svn.edgewall.com/repos/trac/tags/trac-0.11/contrib/workflow/showworkflow
$ wget http://svn.edgewall.com/repos/trac/tags/trac-0.11/contrib/workflow/workflow_parser.py

Make the files executable and run:

./showworkflow /path/to/trac.ini

This should generate a pdf file in the same directory as trac.ini file.

Note: If doing this on a server xpdf will fail, so move the pdf to a web accessible directory to view it.

Bridge Networking On OpenVZ Containers Using VETH Devices

1. Host will be open on LAN and guests on WAN. Additionally, there is a bridged LAN for guests.
2. We will be using bridge networking for protecting the Host Network and saving IP addresses, also giving flexibility with the guest network setup.
3. Configure LAN Eth1 port to 192.168.1.2
4. WAN Eth0 port is not assigned any IP address.
6. Install the required bridge-utils package via:

yum install bridge-utils

* Network:

# cat /etc/sysconfig/network
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=<host.domain.tld>
GATEWAY=192.168.1.1
GATEWAYDEV="eth1"

* WAN Bridge device br0:

# cat /etc/sysconfig/network-scripts/ifcfg-br0
DEVICE=br0
BROADCAST=xxx.xxx.xxx.xxx
NETMASK=255.255.255.24
NETWORK=xxx.xxx.xxx.xxx
ONBOOT=yes
GATEWAY=xxx.xxx.xxx.xxx
TYPE=Bridge

* WAN eth0 device:

# cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
HWADDR=00:30:48:65:12:b4
ONBOOT=yes
TYPE=Ethernet
BRIDGE=br0

* LAN Bridge device br1:

# cat /etc/sysconfig/network-scripts/ifcfg-br1
DEVICE=br1
ONBOOT=yes
TYPE=Bridge
IPADDR=192.168.1.2
NETMASK=255.255.255.0
GATEWAY=192.168.1.1

* LAN eth1 device:

# cat /etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=eth1
HWADDR=00:30:48:65:12:b5
ONBOOT=yes
TYPE=Ethernet
BRIDGE=br1

MySQL Server Performance Tuning

Get under the hood of MySQL to find out how you can speed up your database applications.
Jeremy Zawodny

In the open source world, truly great software starts in the hands of enthusiasts and hobbyists. Given time, it matures and develops a more robust community. Then, before most of us realize what is happening, it gains critical mass and moves into the broader industry. Companies that were using expensive commercial software just a year ago are suddenly using a free product — one of the rising stars from the world of Open Source.

How to install & configure Xen Virtualization in openSUSE 11.0

Virtualization cannot be that simpler than in openSUSE 11.0. In openSUSE 11.0, Xen Virtualization ins pre-built and all it takes is a few clicks away from up and running with Virtualization in no time. Xen is a virtual machine monitor for x86 that supports execution of multiple guest operating systems with unprecedented levels of performance and resource isolation.
More

Google Desktop Gadgets in openSUSE

Google Gadgets for Linux is a free opensource (licensed under Apache License) platform for running desktop gadgets under Linux, catering to the unique needs of Linux users.

Find how to install configure and use Google Gadgets in openSUSE here

Syndicate content
Comment