Finding out why a hard drive, member of software RAID 1, failed

Today we've received the following message from mdadm monitoring on one of our servers:

This is an automatically generated mail message from mdadm running on host.website.tld

A Fail event had been detected on md device /dev/md126.

It could be related to component device /dev/sda.

Faithfully yours, etc.

P.S. The /proc/mdstat file currently contains the following:

Personalities : [raid1]
md126 : active raid1 sda[1](F) sdb[0]
1953511424 blocks super external:/md0/0 [2/1] [_U]

md0 : inactive sda[1](S) sdb[0](S)
6056 blocks super external:imsm

Tags:

Recovering a hacked Drupal system

In order to check if your Drupal 7 website has been hacked, install the following modules:

drush dl site_audit
drush dl drupalgeddon

clear drush cache and run:

drush cache-clear drush
drush asec

Some attack does two things: firstly, in creates NEW php files scattered throughout your directory structure. The files are all 494 bytes long, and end in "php" so they are easy to find. Run the following command to see if you have any:


find . -size 494c -name "*.php"

...and then run this command to delete them:

Resetting or updating passwords for Drupal users in command line

The


drush user-login username

command or it's alias


drush uli username

will display a one-time login URL to login the specified account. The output is a URL like:


http:///user/reset/1/1358351267/WvqBsED_WKGeThnoY67SCRddVfpGymDaA1w1GP7ZTtP

After logging in using this URL, the user it NOT required to change the password.

To generate one time login for user #1 fire up just


drush uli

Running


drush sqlq "SELECT name, pass FROM users WHERE uid = 1;"

Impending Drupal Site Launch? Use the List

After months of site development, code, more code, and long hours, launch day arrives. A site launch can come as a relief, create a bittersweet moment, or one filled with pride and a sense of accomplishment, not unlike a parent sending a child off to their first day of kindergarten.

Tags:

Syncing Two Drupal Sites

The drush module for Drupal has a new “sync” option to synchronize two Drupal sites, but it is undocumented and looking at the source code all it does is sync the files, not the mysql database. I haven’t seen any other public solutions that do completely sync 2 drupal sites including the databases.

Tags:

How to disable and enable Drupal 7 blocks programmatically

Sometimes you need to enable and place a Drupal 7 block in a seen region like header, content, footer, etc., and other times you need to disable it programmatically in a custom module. So to do it you just need to create two functions:

function _start_refreshing() {

db_update('block')
->fields(array(
'status' => 1,
'weight' => -10,
'region' => 'footer',
))
->condition('module', 'mymodule')
->condition('delta', 'mymodule_delta')
->execute();

}

and

function _stop_refreshing() {

Tags:

How to delegate a subdomain to another nameserver

In order to delegate a sub-domain's DNS management to another server, perform the following steps:

1. Set NS records for your subdomain and in DATA field put a nameserver:


sub.domain.com NS ns1.nameserver.tld
sub.domain.com NS ns2.nameserver.tld

2. Then create a new nameserver
sub.domain.com

3. Now you can start adding A records for your new subdomain, like:


sub.sub.domain.com

Tags:

If delivered mail doesn't show in user inbox

One of our Ubuntu servers stopped to show properly delivered messages in user inboxes after the last kernel update (Ubuntu precise (12.04.4 LTS)). Because for some reasons DEFAULT= and ORGMAIL= in /etc/procmailrc got replaced by

DEFAULT=/var/mail/$LOGNAME
ORGMAIL=/var/mail/$LOGNAME

so we had to change it back to:

DEFAULT=$HOME/Maildir/
ORGMAIL=$HOME/Maildir/

Now everything is working fine with the following settings for procmail:

root@quiethost:/etc# cat procmailrc
LOGFILE=/var/log/procmail.log

Tags:

Disable Named in chroot and remove chroot partition

The recent versions of bind recommends the chroot environment for better security. When considering the most used popular Linux distribution ‘Red Hat’, they ship a package called ‘bind-chroot’ for the chrooting of bind. By default the bind or named daemon runs in a chroot environment.

But users who want to run ‘named’ in the old fashion may do so by disabling the ‘chroot’ environment. The ‘chroot’ing feature can be disabled by commenting out the directive ‘ROOTDIR=/var/named/chroot’ in the file ‘/etc/sysconfig/named’ and then restarting the ‘named’ service.

df -h

Tags:

Pages

Subscribe to Front page feed