Sunday 26 December 2010

WHMCS 4.41 and the Plesk server module

WHMCS version 4.41 has split the Plesk server automation module out into three separate versions; plesk8, plesk9 and plesk10, but the upgrade script doesn’t handle changing the automation module settings for either your servers or your products/services. As a result of this short sightedness on the developer’s part you will loose all automation of your Plesk servers (account creation, suspension, termination, statistics updates etc.) and start experiencing fatal PHP errors in both the admin and client areas of WHMCS where the functions provided by the old “plesk” module are used (which is basically any area using products/services or servers defined with the “plesk” module) unless you retain the generic “plesk” module from your previous WHMCS 4.31 install. As copying over the “modules/servers/plesk” folder from WHMCS v4.31 or symlinking the appropriate folder of one of the new modules to “modules/servers/plesk” seems like a massive dirty hack to me, instead I decided to do what the WHMCS 4.41 installer should have done in the first place and fix the database to use the correct version of the new Plesk server module. For me the new “plesk9? module is the one to use, but you can adjust the following SQL appropriately to suit your needs (remember to backup your database however you see fit before you begin!):


As usual with WHMCS, there are no mention of any changes to the Plesk module in the release notes for version 4.41.

Friday 24 December 2010

How to Install Mod_Security on Direct Admin

What is mod_security or modsecurity?

ModSecurity is an open source intrusion detection and prevention engine for web applications. It operates embedded into the web server, acting as a powerful umbrella - shielding applications from attacks. ModSecurity supports both branches of the Apache web server.
This HOW-TO is for Apache 2.X only.

cd /usr/local/src

mkdir modsecurity2

cd modsecurity2

wget http://www.serverbuddies.com/files/modsecurity-apache_2.5.9.tar.gz

perl -pi -e ’s/ServerTokens Major/ServerTokens Full/’ /etc/httpd/conf/extra/httpd-default.conf

perl -pi -e ’s/ServerSignature Off/ServerSignature On/’ /etc/httpd/conf/extra/httpd-default.conf

perl -pi -e ’s/ServerSignature EMail/ServerSignature On/’ /etc/httpd/conf/extra/httpd-default.conf

tar xzf modsecurity-apache_2.5.9.tar.gz

cd modsecurity-apache_2.5.9

cd apache2

./configure

make

make test

make install

Now we download a pre-defined mod_sec ruleset,
cd /etc/modsecurity2/

wget http://www.serverbuddies.com/files/modsec.v2.rules.conf

Add the new compiled mod_security module into the apache configuration,
vi /etc/httpd/conf/httpd.conf

After:

LoadModule php5_module /usr/lib/apache/libphp5.so
Add:

For 32bit -

LoadFile /usr/lib/libxml2.so

LoadModule security2_module     /usr/lib/apache/mod_security2.so



For 64bit -

LoadFile /usr/lib64/libxml2.so

LoadModule security2_module    /usr/lib/apache/mod_security2.so
At the botton of the httpd.conf config file we add the following,

# ModSecurity2 config file.

Include /etc/modsecurity2/modsec.v2.rules.conf

Restart the webserver.

service httpd restart


Installation should be completed and mod_sec should be now loaded on your Apache webserver.

Thursday 23 December 2010

Disable and Uninstall APF Firewall Script

You can easily disable and uninstall APF firewall script under any Linux distributions. Simply type the following command as root user.

Linux Remove APF firewall


# service iptables stop
# chkconfig apf off
# /bin/rm -rfv /etc/apf
# /bin/rm -fv /etc/cron.daily/fw
# /bin/rm -fv /etc/init.d/apf
# iptables -L -n

WARNING! These examples open your computer to everyone on the internet by disabling iptables firewall protection if executed.

Wednesday 22 December 2010

Using remote desktop over SSH on a Linksys router

One of the easiest methods to allow remote access to your home PC involves opening and forwarding port 3389 on your router to your PC’s internal IP address. This works in most situations, but not always. This article describes how to run an SSH server on your home router (Linksys, Buffalo, Broadcom-based routers) to tunnel the windows remote desktop client (RDP) through the SSH tunnel to bypass firewall restrictions and to secure the RDP session. Not only can you use this to gain access to your home computer remotely, but you’ll have a full-fledged proxy that doesn’t require you to keep your home computer powered on, only your router. The proxy is great for browsing the web on public WIFI or untrusted networks. When I travel, especially in places like China where it’s well known that the government harvests usernames and passwords, I ONLY access the internet through my remote machine tunneled through SSH.

Sunday 19 December 2010

Problem Adding Addon Domains

Error from park wrapper: Using nameservers with the following IPs: 77.74.196.121,77.74.196.120 Sorry, the domain is already pointed to an IP address that does not appear to use DNS servers associated with this server. Please transfer the domain to this servers nameservers or have your administrator add one of its nameservers to /etc/ips.remotedns and make the proper A entries on that remote nameserver.

Try to find the following option in your WHM -> Tweak Settings:

Allow Creation of Parked/Addon Domains that resolve to other servers (i.e. domain transfers) [This can be a major security problem. If you must have it enabled, be sure to not allow users to park common internet domains.]

and enable it. Your problem can be solved.

Saturday 18 December 2010

How do I generate a CSR on Microsoft IIS 7.0

Resolution




To generate a CSR for Microsoft IIS 7.0, perform the following steps:

1. Choose Start > Administrative Tools > Internet Information Services (IIS) Manager
2. In the IIS Manager, choose your server name
3. In the Features pane (the middle pane), double-click the Server Certificates option (Figure A) located under the Security heading.



4. You will notice two default certificates already installed on this server. To begin the process of requesting a new certificate, from the Actions pane, choose the Create Certificate Request option as shown below in Figure B.



5. The first screen of the wizard asks for details regarding the new site. The common name should match the fully-qualified domain name for the site. Otherwise, provide information about your site, making sure to spell out the name of your state and locality. (Figure C)



6. Click Next to continue.
7. The next screen of the wizard asks you to choose cryptography options. The default, Microsoft RSA SChannel Cryptography Provider is fine. A key length of 1,024 bits is the default option and is fine as well. (Figure D)



8. Click Next to continue.
9. Finally, provide a filename to which to save the certificate request. You will need the contents of this file in the next step, so make sure you know where to find it. (Figure E)



Wednesday 15 December 2010

#2002 – The server is not responding (or the local MySQL server’s socket is not correctly configured”

#2002 – The server is not responding (or the local MySQL server’ssocket is not correctly configured”

Here is what worked for me
pico /usr/local/cpanel/base/3rdparty/phpMyAdmin/config.inc.php

find
$cfg['Servers'][$i]['socket'] = ”;
change to
$cfg['Servers'][$i]['socket'] = ‘/var/lib/mysql/mysql.sock’;

next line
$cfg['Servers'][$i]['connect_type'] = ‘tcp’;

change to
$cfg['Servers'][$i]['connect_type'] = ‘socket’;

like i said worked for me

Create a test instance of a Magento store

Once I have a new Magento site up and running, I always like to create a freshly copied test or development instance of the site.  I use the development site to test out any new code, style, or configuration changes before applying them to the production server. Better safe than sorry, right?

I used to create the test instance as a subdomain on the production server.  However, that approach can lead to easy mistakes, at least in my experience.  When the paths are so close, it is easy to accidently wind up in the magento root rather than in the subdirectory.  So, my preferred approach these days is to have a separate domain, say mytestserver.us, and have all of my dev servers on it.  So, I may have one magento instance under mytestserver.us/site1 and another under mytestserver.us/site2.  In my case, the production domain (let's call it myprodserver.com, for example) and the dev server reside on the same VPS, so it is easy to copy files as needed via SSH.

When the production site is in a state that is ready to copy, here are the steps I take:

  1. Decide on the location for the development instance files.  In my case, I have a separate domain, mytestserver.us, and a subdirectory for each test instance.  So, I login to my VPS via SSH and create a new subdirectory.
    cd /home/mytestserver/public_html/

    mkdir newtestsite


  2. Copy the production server Magento files to the new test server subdirectory.
    cp -r /home/myprodserver/public_html/* /home/mytestserver/public_html/newtestsite/

    cp /home/myprodserver/public_html/.htaccess /home/mytestserver/public_html/newtestsite/


  3. Create a new empty database on the testserver.

  4. Create a data dump from the production database.  The mySQL command is noted below.  Replace the all caps items with your information.
    mysqldump -h DBHOST -u DBUSER -pDBPASS DBNAME > /home/backup/data.sql


  5. Import the data dump previously created into the empty database on the test server.  Replace the all caps items with the credentials for your new test server database.
    mysql -h DBHOST -u DBUSER -pDBPASS DBNAME < /home/backup/data.sql


  6. Next you'll need to make some edits.  In the test database, go to the core_config_data table and change the values of web/unsecure/base_url and web/secure/base_url to the test server url.  E.g.  http://mytestserver.us/newtestsite/.  I do not use an SSL certificate on my development servers, so the value for the unsecure and secure urls are the same.  I make the edits using phpMyAdmin.  Below is example SQL for the updates.
    UPDATE core_config_data SET value="http://mytestserver.us/newtestsite/" WHERE path=’web/unsecure/host’;

    UPDATE core_config_data SET value="http://mytestserver.us/newtestsite/" WHERE path=’web/secure/host’;


  7. Clear cache files that were copied over from the production site.
    cd /home/mytestserver/public_html/newtestsite

    rm -rf var/*


  8. Edit the local.xml file (app/etc/local.xml).  Change the database values to point to the new test database host, database name, user, and password.  If you are using a php cache such as apc, also remove or comment out the lines that use it.  It is preferable not to have caching turned on in a development environment so all changes are reflected immediately.

  9. You should now be able to navigate to the new test instance's frontend and backend.

  10. Go to the backend to make some further changes to the settings (e.g. http://mytestserver.us/newtestsite/admin/).  The login is the same as the production instance. Below are some of the items you may want to set differently for the development version of the site.

    • Turn on the store demo notice.  System > Configuration > Design > HTML Head > Display Demo Store Notice.

    • Change email addresses used.  For testing, you probably want emails to go to you or other developer, rather than the store owner. System > Configuration > Store Email Addresses and Sales Emails.

    • Turn off production payment methods.  For example, you may want to either disable Paypal entirely, or put it in Sandbox mode.  Likewise, you may want to turn on Check / Money Order, or other quick and easy payment method for testing order functionality.

    • Turn off SSL.  Turn off Javascript file merging.  System > Configuration > General > Web > Secure > Use Secure URLs in Frontend.

    • Turn off Google Analytics.  System > Configuration > Google API > Google Analytics.

    • Turn off Javascript file merging.  System > Configuration > Advanced > Developer > Javascript Settings.  Also turn off CSS file merging if it was used.

    • Turn off Caching.  System > Cache > Select All, then Disable.  Also Flush Javascript/CSS Cache.

    • Rebuild indices.  System > Index Management > Select all, then Rebuild.

    • You may also want to change the admin login or other accounts.  System > Permissions > Users.



  11. Also check your .htaccess file on the test instance to make sure that any production-only rewrite rules are removed or commented out.  I also like to password protect the directory so that only allowed users have access.  Below is an example of the code to add to your .htaccess file after you have set up the password (this is usually an option in your hosting control panel).
    AuthName "Protected Area"
    AuthType Basic
    AuthUserFile /home/mytestserver/.htpasswds/public_html/newtestsite/passwd
    Require valid-user


  12. Edit your robots.txt file to keep search engine robots away.
    User-agent: *
    Disallow: /


  13. That's it!  You now have a copy of your production Magento store ready for development and testing.

Monday 13 December 2010

Change admin password - Plesk

Contents
  • Change admin password in Plesk

  • Broken database PSA in MySQL

  • Change admin password in Plesk

    Friday 10 December 2010

    ions today How to Install Clam AntiVirus (ClamAV) in RHEL/CentOS 4

    To install Clam AntiVirus (ClamAV), we are going to use the precompiled binaries from Dag Wieers RPM packages for Red Hat, RHEL, CentOS and Fedora. To do this, we are going to configure Yum to look for the ClamAV packages in Dag’s repository.

    Adding Dag Wieers RPM Repository to Yum


    1. Click Applications, select System Tools and click Terminal. This will launch the Terminal window. Type in the command cd /etc/yum.repos.d and press Enter. This will bring us to the Yum repository configuration directory.

    Sunday 5 December 2010

    Run ASP on Your Own PC

    Your Windows PC as a Web Server

    Your own PC can act as a web server if you install IIS or PWS
    IIS or PWS turns your computer into a web server
    Microsoft IIS and PWS are free web server components
    IIS - Internet Information Server

    IIS is a set of Internet-based services for servers created by Microsoft for use with Microsoft Windows.

    IIS comes with Windows 2000, XP, and Vista. It is also available for Windows NT.

    IIS is easy to install and ideal for developing and testing web applications.


    PWS - Personal Web Server

    PWS is for older Windows system like Windows 95, 98, and NT.

    PWS is easy to install and can be used for developing and testing web applications including ASP.

    We don't recommend running PWS for anything else than training. It is outdated and has security issues.

    Windows Web Server Versions

    Windows Vista Business, Enterprise and Ultimate come with IIS 7
    Windows Vista Home Premium comes with IIS 7
    Windows Vista Home Edition does not support PWS or IIS
    Windows XP Professional comes with IIS 5.1
    Windows XP Home Edition does not support IIS or PWS
    Windows 2000 Professional comes with IIS 5.0
    Windows NT Professional comes with IIS 3 and also supports IIS 4
    Windows NT Workstation supports PWS and IIS 3
    Windows ME does not support PWS or IIS
    Windows 98 comes with PWS
    Windows 95 supports PWS
    How to Install IIS on Windows Vista

    Follow these steps to install IIS on Windows Vista:

    Open the Control Panel from the Start menu
    Double-click Programs and Features
    Click "Turn Windows features on or off" (a link to the left)
    Select the check box for Internet Information Services (IIS), and click OK
    After you have installed IIS, make sure you install all patches for bugs and security problems. (Run Windows Update).

    How to Install IIS on Windows XP and Windows 2000

    Follow these steps to install IIS on Windows XP and Windows 2000:

    On the Start menu, click Settings and select Control Panel
    Double-click Add or Remove Programs
    Click Add/Remove Windows Components
    Click Internet Information Services (IIS)
    Click Details
    Select the check box for World Wide Web Service, and click OK
    In Windows Component selection, click Next to install IIS
    After you have installed IIS, make sure you install all patches for bugs and security problems. (Run Windows Update).

    How to Install IIS on Windows XP and Windows 2000

    Follow these steps to install IIS on Windows XP and Windows 2000:

    On the Start menu, click Settings and select Control Panel
    Double-click Add or Remove Programs
    Click Add/Remove Windows Components
    Click Internet Information Services (IIS)
    Click Details
    Select the check box for World Wide Web Service, and click OK
    In Windows Component selection, click Next to install IIS
    After you have installed IIS, make sure you install all patches for bugs and security problems. (Run Windows Update).

    Test Your Web
    After you have installed IIS or PWS follow these steps:

    Look for a new folder called Inetpub on your hard drive
    Open the Inetpub folder, and find a folder named wwwroot
    Create a new folder, like "MyWeb", under wwwroot
    Write some ASP code and save the file as "test1.asp" in the new folder
    Make sure your Web server is running (see below)
    Open your browser and type "http://localhost/MyWeb/test1.asp", to view your first web page
    Note: Look for the IIS (or PWS) symbol in your start menu or task bar. The program has functions for starting and stopping the web server, disable and enable ASP, and much more.

    Sending Email with ASP and CDOSYS

    How convert .htaccess file to web.config

    I have a requirement to re-define the apache re-write rule to IIS knowing language using web.xml on Windows 2008 server. There is one easy trick to achieve this.

    Basic operations are,

    1. Install Mod Rewrite component on II7
    2. Create a website on IIS and import the .httaccess file

    1. Installing Mod Rewrite Module

    Download and install Mod Rewrite module from the following url according to your OS architecture.
    http://learn.iis.net/page.aspx/460/using-the-url-rewrite-module/. Then Close the IIS MMC and reopen it. Now you see that module is present as shown below

    Then Click on ” import rules” label showing on the right side of the window tree. Find the .htaccess file and import and t hen click to apply. It will create/update the web.config file in the document root directory.

    Here is the sample code which I used for re-writing Codeigniter frame work

    It’s file name is “web.config”

















    Wednesday 1 December 2010

    Cannot send emails- RoundCube just shows "Sending Message"

    I found a problem with Roundcube, it shows sending message and hangs up there and actually it doesn't send message anymore. I found the following solution here.


    Problem with Roundcube, installed when updated to newest CURRENT release. - Page 3 - cPanel Forums:


    vi /usr/local/cpanel/base/3rdparty/roundcube/config/main.inc.php

    and changed

    $rcmail_config['smtp_user'] = '%u';
    to
    $rcmail_config['smtp_user'] = '';

    FIXED....