New unofficial plugin: Domain Mapping Autopark in cPanel

Hi there everyone!

A much anticipated feature which has never been realized before is finally here!

I would like to announce a small plugin I made today which could be quite useful for many of you out there using cPanel and Domain Mapping!

Why do you need this?
1. You want to make life easier for your customers/clients
2. It's free!
3. You don't have to manually park every domain anymore
4. You want to take things into your own hands
5. You will only need to give the nameservers to your users
6. You don't have to give IP instructions anymore for your users
7. Your users can edit their mail-servers on your website (in a future plugin!)
8. Easily allows your users to use your mailserver (in a future plugin!)

What do I need?
1. Domain Mapping fully set up
2. WHM root access
3. Optional: Your own DNS server in WHM

What are the extra benefits?
1. Once a domain is parked, you can use another API + plugin to add e-mail accounts for your Pro users :wink:
2. The upcoming plugin will have a user interface
3. It's super easy, both for you and your customers!

Drawbacks?
1. Adding a domain in domain mapping isn't instant anymore, depending on your server speed this might add 4 to 7 seconds of "mapping" time. Luckily a wheel will be spinning so your user knows something is happening.
2. I haven't added an unparking feature. Do not intend to add it either. DNS servers are mostly able to take thousands, maybe even millions of domains without stressing your server. Unparking will lead to e-mail losses too. You will need a decent DNS server though (I recommend myDNS).
3. Security, be sure you do not make your .PHP files readable. Before, they could only access your database if they were able to hack you (and steal users passwords) through wp-config.php; with this plugin and the right hacker they might even break into your server. USE AT OWN RISK.

I do want to stress that you need to extract this plugin in your plugins directory and Network activate it. But before you do that:

You will need to manually update the 3 (or 4) variables.

Those are:
1. Your hosting IP
2. (optional) root user login name
3. cPanel username
4. Access Hash from WHM -> Remote Access Key

What you need at hand:
1. Domain Mapping installed
2. Your cPanel username where you want to park accounts (most likely your mail server or main server)
3. Root account's login (most likely 'root')
4. Root account's Access hash.
5. Some basic knowledge of any codestyle (be it html, php, etc.)
6. Notepad++ or notepad.exe or texteditor, just something to edit code

YOU MUST EDIT autoparkdomain.php - all other files must be kept unchanged
READ ==USEAGE== IN THE FILE CAREFULLY

I highly suggest that WPMUdev makes this into an included feature in their highly sophisticated Domain Mapping Plugin.

Any questions? Ask them here!

Enjoy!

EDIT -- It seems that I can not upload .zip
So here it is:
https://hostmijnpagina.nl/hmp/plugins/autoparkdomain.zip

  • Sybre Waaijer
    • The Incredible Code Injector

    I do want to add that if you want to use your own nameserver, you will need to Edit the Zone Template in "WHM -> DNS Functions -> Edit Zone Templates -> Standard" to the following.

    Note: Change the following terms:
    your.mainblog.ip.address
    mail.yourmailserver.com.

    ; cPanel %cpversion%
    ; Zone file for %domain%
    $TTL %ttl%
    @      %nsttl%	IN      SOA     %nameserver%. %rpemail%. (
    		%serial%	; serial, todays date+todays
    		86400		; refresh, seconds
    		7200		; retry, seconds
    		3600000		; expire, seconds
    		86400 )		; minimum, seconds
    
    %domain%. %nsttl% IN NS %nameserver%.
    %domain%. %nsttl% IN NS %nameserver2%.
    %domain%. %nsttl% IN NS %nameserver3%.
    %domain%. %nsttl% IN NS %nameserver4%.
    
    %nameserverentry%. IN A %nameservera%
    %nameserverentry2%. IN A %nameservera2%
    %nameserverentry3%. IN A %nameservera3%
    %nameserverentry4%. IN A %nameservera4%
    
    %domain%. IN A your.mainblog.ip.address
    %domain%. IN AAAA %ipv6%
    localhost.%domain%. IN A 127.0.0.1
    localhost.%domain%. IN AAAA ::1
    
    %domain%. IN MX 1 mail.yourmainserver.com.
    
    mail IN CNAME mail.yourmailserver.com.
    smtp IN CNAME mail.yourmailserver.com.
    www IN CNAME %domain%.
    ww IN CNAME %domain%.

    NOTE: If your user adds a domain that is registered on another server it will give a "invalid" call. For example if they add facebook.com the parked domain will get facebook.com's nameservers. This is a feature and not a bug. It is however unwanted in your WPMU so I suggest that if you wish to use your own nameservers that you change %nameserver%, %nameserver2%, etc. to your nameserver address without the % symbols (and with the . at the end). Example: ns1.hostmijnpagina.nl.

  • Ivan
    • HummingBird

    Hey Sybre,

    Thanks for this. It seems that the plugin is more than awesome, and brings some very cool additions to Domain Mapping.

    You are awesome - thanks again for this.

    Thanks,
    Ivan

    P.S. Not sure why you weren't able to upload it, so I attached it to my post/

  • Sybre Waaijer
    • The Incredible Code Injector

    @Ivan Denkov Thanks for uploading :smiley: I am not allowed as a non-staff member to upload anything but .png, .jpg, .gif and the like...

    Also, I left an unchanged comment in == USEAGE ==, this is 6. I updated the file as of now.

    For people whom downloaded this file from Ivan Denkov's comment, this is the updated line (21):
    6. edit the following lines: $hostip, $root_user, $cpanel_user, $whmhash

  • Sybre Waaijer
    • The Incredible Code Injector

    For extra security measurements I suggest everyone to make autoparkdomain.php's CHMOD (File Permission) the following, this can be done through FTP:

    AT MOST:
    644 or rw-r--r--

    AT LEAST (what I've tested):
    640 or rw-rw----

    Have a great week everyone!

  • Sybre Waaijer
    • The Incredible Code Injector

    Important security update! Read carefully

    As mentioned before, the super admin can read the plugin's contents. If a hacker were to compromise any super-admin account on your installation, he could also read AND edit the plugin's files and compromise your server through WordPress.

    TO PREVENT THIS, I've transformed the plugin into a mu-plugins module.
    This is a highly recommended update. With this update, a hacker can't read the contents of your plugin through WordPress - he would have to hack your FTP server for that (and that's much less likely than hacking a WordPress site).

    Instructions are the same as any above from my posts, however the hierarchy has changed a bit.

    IF YOU HAVE ALREADY INSTALLED THIS PLUGIN:
    1. Network deactivate the current plugin
    2. Backup the plugin on your computer and remove the plugin from wp-content
    3. Replace the autoparkdomain.php file with your edited one in /autoparkdomain/
    4. Upload the contents of the zip file in /wp-content/mu-plugins/

    If you don't have the folder /wp-content/mu-plugins/ - now is the time to make it. Plugins inside /wp-content/mu-plugins/ cannot be read through WordPress and can not be deactivated.

    FIRST TIME INSTALLATION
    1. Extract all the files into a random folder on your computer
    2. Read the readmefirst-autoparkdomain.txt file carefully

    Here's the updated download link (same as the first post):
    https://hostmijnpagina.nl/hmp/plugins/autoparkdomain.zip

    Enjoy!

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.