protect wp-login.php and wp-admin using htaccess on a dynamic IP

by WanderingTechy January 2, 2013

Please note, I did this using a linux client on a linux server.  My desktop is linux mint and the server is Centos.  You can do it on Windows and OS/X but I can’t advise sorry.  This is quick and dirty tutorial aimed at those familiar with command lines and server operation.   You need SSH access to the server you are running your blog from.

The Problem:

My wordpress blog is getting blitzed with attempts on my wp-login.php file and wp-admin folder.  I want to block all access to these areas unless it is coming from my computer.

I tried a number of methods,  including but not limited to logging all attempts and adding them to my firewall or htaccess file.  This is an ongoing task and not suitable for long term use.

I am on a dynamic IP that changes each time I log into the computer.  So blocking by IP was not practical.  However….

I now use a combination of SSH to create a proxy, foxyproxy to only use this proxy when navigating to my wordpress install and htaccess to block all ip’s except the servers IP.

The Solution:

Read the rest of this entry »

Quick manual install of WordPress on Linux Mint.

by WanderingTechy December 24, 2012

This is just a quick run through.  I assume you have configured any vhosts and know your way around the command line.  It is written for a local install on Linux Mint.

cd to your working directory.
wget http://wordpress.org/latest.tar.gz
tar xvzf latest.tar.gz
mv wordpress/* .

The file ownerships are likely to be wrong so.
chown username.groupname * -R

Now setup the database;

mysql -p
create database wordpress
GRANT ALL PRIVILEGES ON wordpress.* TO “wordpressuser”@”localhost” IDENTIFIED BY “Uvh786sAx$”;
FLUSH PRIVILEGES;

Obviously change the directory, databasename, username and password to your own settings.

now go to the vhost/folder in your browser where you have saved your wordpress install to and click on create a configuration file.  fill in the details as per the mysql setup. Copy and paste the generated file into wp-config.php.

Follow the rest of the wizard.  That’s it.

Deleting emails from the postfix mailq by email address

by WanderingTechy July 6, 2012

To clean out some spam from the postfix mailq

mailq | tail -n +2 | gawk 'BEGIN { RS = "" } /email@domain.com/ { print $1 }' | tr -d '*!' | postsuper -d -

Centos 6.2 eth0 stops responding, ADDRCONF(NETDEV_UP): eth0: link is not ready.

by WanderingTechy June 12, 2012

This is becoming a Saga.  One of my new server went offline 2 days ago.  I logged in through a serial session and everything was fine apart from the networking not working.

/etc/rc.d/init.d/network restart

Failed…  Telling the cable wasn’t connected.   It was and the link was live.

A hard reboot brought it back up and I kept my fingers crossed it was a one off.  I knew at the back of my mind it wasn’t but I kept my fingers crossed anyway.

After much searching of the net I found this is a known problem across a lot of Redhat based distributions and affects the e1000e driver.

Last night the server went down again.  I found that the EPEL repo has an allegedly fixed driver.  I installed this and watched it for 2 hours.

rpm --import http://elrepo.org/RPM-GPG-KEY-elrepo.org
rpm -Uvh http://elrepo.org/elrepo-release-6-4.el6.elrepo.noarch.rpm
yum update
yum install kmod-e1000e
/sbin/shutdown -r now

I then went to bed at around 2AM this morning.  I was woken by the klaxon alarm on my BB telling me a server was down.  Yup the fix didn’t fix it.

Further research led me to add this line to my kernel options line in /boot/grub/grub.conf

pcie_aspm=off

It has been running all day.  I am not holding my breath at this time.  I have a feeling I may have to move to a different server at more expense if this doesn’t work.

Sorry for the disjointed nature of this post I am in a rush but wanted to get it posted today while it is fresh in my mind.

Rackspace cloud server using Arch Linux and pdns with sqlite 3 backend

by WanderingTechy June 2, 2012

Wow that title was a mouthful.

I need a tertiary DNS server that is remote from any of my current networks.  Doing this using a dedicated server is expensive so I am testing out Rackspace’s cloud service.

I decided to go with Arch, pdns and sqlite as this would allow me to have a minimal server.  I am attempting this on a 256Mb server but can upgrade if necessary.

As I have not used Arch Linux in anger as a server, I haven’t used Sqlite ever and I have only installed pdns once before and that install was 4 years ago and is still running this should be an interesting side project.

Read the rest of this entry »

More plesk mysql commands

by WanderingTechy May 9, 2012

To extract all the email information you need to recreate all mail accounts.

SELECT mail.mail_name,domains.name,accounts.password, mail.postbox, mail.redirect, mail.redir_addr, mail.mail_group,mail.autoresponder, mail.mbox_quota
FROM domains,mail,accounts
WHERE domains.id=mail.dom_id
AND accounts.id=mail.account_id
ORDER BY domains.name ASC,mail.mail_name ASC;

To extract all aliases

SELECT mail.mail_name, domains.name, mail_aliases.alias
 FROM mail, domains, mail_aliases
 WHERE mail.dom_id = domains.id
 AND mail.id = mail_aliases.mn_id;

List all plesk email accounts with password

by WanderingTechy May 9, 2012

If you need to view all the mailboxes and their passwords in plesk use this command via SSH.

/usr/local/psa/admin/bin/mail_auth_view

plesk qmail bounce problems

by WanderingTechy March 23, 2012

If you are getting double bounces clogging up your mail queue

Create the following file

/var/qmail/control/doublebounceto

And put a single #

You can replace the addresses in

/var/qmail/alias/.qmail-postmaster and /var/qmail/alias/.qmail-anonymous as well with a single #

How to force qmail to process the outbound queue

by WanderingTechy February 2, 2012

If/When you get a DNS problem or other network issue that causes the queue to fail it will fill up at a fair speed.  Use the following to tell qmail to make another attempt at sending.
/var/qmail/bin/qmail-tcpok

Or you can do this.

Run ps axl and find the process id (PID) for qmail-send
Run kill -s ALRM pid
To find out if there are any messages in the queue use

qmail-qstat or qmail-qread

Remove DRWeb from plesk

by WanderingTechy February 1, 2012

DRWeb has been causing lots of problems on 3 servers.  Here is how to remove it completely

rpm -qa | grep "drweb" | xargs rpm -e

If you then get any error messages in your log files do this.

</pre>
/usr/local/psa/admin/sbin/mailmng --stop-service
mkdir /root/bup-handlers
cp -a /usr/local/psa/handlers/before* /root/bup-handlers/
cp -a /usr/local/psa/handlers/info /root/bup-handlers/
rm -rf /usr/local/psa/handlers/before-*/*
rm -rf /usr/local/psa/handlers/info/*
/usr/local/psa/admin/sbin/mchk --with-spam

/usr/local/psa/admin/sbin/mailmng --start-service
<pre>