Customizing Resellers

Limiting the number of users a reseller can create

As of DirectAdmin version 1.59, the number of users a reseller can create is controlled in the reseller packagesopen in new window.

How resellers could customize the default web page and suspended pages

Starting from DirectAdmin version 1.51, additional directories exist in the reseller home directory (as well in the admin home directory), like:
/home/res1x/domains/default/
and
/home/res1x/domains/suspended/

Which contain the default files from /usr/local/directadmin/data/templates/suspended. These could be customized after copying to /usr/local/directadmin/data/templates/custom/suspended. The same is true for the default/ directory.

It will also now include an .htaccess file to prevent any caching of the html/htm/js/css files, so that the moment a domain is unsuspended, the client's browser won't cache the suspended page.

I want a shared IP among many resellers

Before the global IP typeopen in new window, only the server IP could be shared among many Resellers, and shared IPs could only "officially" exist in one Reseller at a time. This is no longer the case with the implementation of global IPs.

Global IPs

One may allow multiple resellers to use a shared secondary IP with DirectAdmin now via the shared IP option global=yes.
This will be set by the Admin in the Admin Level -> IP Manager for a given "shared" IP. Once an IP is global, it can then be assigned to multiple Resellers, and will be treated as a shared IP. Accessing the IP directly should go to the Admin's shared area, rather than the Reseller's shared area.

This feature replaces the following guide:
https://help.directadmin.com/item.php?id=538open in new window

The Reseller Level -> IP Manager will always hide the User count for global shared IPs.

The "Remove from Reseller" button will remove any global shared IP from all Reseller/Admin ip.list files, but as before, does require the value to be 0 prior to DA allowing removal.

Setting a status=free IP to be global from the details page will automatically assign this IP to the current Admin, and convert the status to shared.

Note that, with the implementation of this feature, you can now remove the server IP from a Reseller! In Admin Level -> IP Manager, when you select the server IP checkbox, if you previously clicked "Free from Reseller", it would throw an error. This button is now allowed and DA will use the current drop-down Reseller selector to know which reseller to remove the server IP from.

CMD_* calls and JSON relating to the implementation of global IPs

To save changes, you can either use:

CMD_IP_MANAGER_DETAILS
method: POST
action=global
ip=1.2.3.4
global=yes|no  #ABSENCE of global=* counts as no, since it's a checkbox.

OR

CMD_IP_MANAGER
method: POST
action=select
set_global=<any text>
select0=1.2.3.4
(select1=1.2.3.5)
global=yes|no  #DIFFERENT FROM ABOVE in that absence of global implies yes.

You can pass global=no if you want to set it to no for the selected IPs. Enhanced does not do this.

When viewing the details of an IP:

CMD_IP_MANAGER_DETAILS?ip=1.2.3.4&json=yes

if set, there will be:

"global": "yes"

The global value might not be present, which can be assumed set to "no". If "yes", then there could be multiple Resellers/Admins managing this IP.

For all loads of the details of the IP, of any status, DA will scan all Reseller/Admin ip.list files to see who has this IP listed. This array will be shown as:

	"resellers_with_ip":
		[
			"admin"
		],

This is primarily for informational purposes, but can be handy in case the IP value is more than 0 and you're not sure who's on it (alternatively, one could check the Show All Users page).

Relative Skins

The admin/ip_manager_details.html file has the following form:

|?GLOBAL_CHECKED=|
|*if global="yes"|
|?GLOBAL_CHECKED=checked|
|*endif|
|?SHOW_GLBOAL=no|
|*if status="shared"|
|?SHOW_GLBOAL=yes|
|*endif|
|*if status="free"|
|?SHOW_GLBOAL=yes|
|*endif|
|*if SHOW_GLBOAL="yes"|
<tr><td class=list_alt>|LANG_GLOBAL|</td><td class=list_alt>
		<form class='mb0' action='CMD_IP_MANAGER_DETAILS' method='POST'>
			<input type='hidden' name='action' value='global'>
			<input type='hidden' name='ip' value='|ip|'>
			<input type='checkbox' name='global' value='yes' |GLOBAL_CHECKED|> When enabled, this IP can be used by multiple Resellers
			<input type='submit' value='|LANG_SAVE|' class='float_right'>
		</form>
		
		</td></tr>
|*endif|

Creation of Users now lists global IPs. Instead of shared, they'll show as:

1.2.3.4 - Shared - Global
Global - randomly selected

which will assume the Reseller has a global IP assigned in their account.

The randomly selected value will be:

ip=global_random

The same values will be listed in the Admin Backup -> Restore area (CMD_ADMIN_BACKUP).

The call to CMD_IP_CONFIG?json=yes will also include have_global=yes if there are global IPs.

Keep in mind, a global IP address is a sub-set of a shared IP. So having a global IP address by default means you have at least one shared.

The CMD_IP_CONFIG?json=yes also includes a Select box array as:

"ip_list" { "0": { ... } }

in the standard select-box format DA provides in other areas.

OLD METHOD

The following is retained for troubleshooting purposes and for those that may require this functionality but be using an older version of DirectAdmin that doesn't support the Global IP feature.

There might be a case where you don't want to give your Resellers the server IP, and only let them all share 1 "shared IP" between them.

Assumptions:
1.2.3.4 - Server IP
1.2.3.5 - Shared IP

  1. Ensure the shared IP has been created in the Admin Level -> IP Manager. Assign it to the "admin" account on that page, then go to: Admin -> Reseller Level -> IP Manager and ensure the 1.2.3.5 IP is set as "shared".

  2. Now we want all newly created Resellers to have the server IP swapped with this shared IP upon their creation. To do this, create the /usr/local/directadmin/scripts/custom/user_create_post_confirmed.sh script and add the code:

#!/bin/sh
       IPL=/usr/local/directadmin/data/users/$username/ip.list
       SERVER=1.2.3.4
       SHARED=1.2.3.5
       if [ -s ${IPL} ]; then
               STR="perl -pi -e \'s/^${SERVER}\\$/${SHARED}/\' ${IPL}"
               eval ${STR}

               echo "Swapped server IP ${SERVER} with shared IP ${SHARED} for $username";
       fi
       exit 0;
  1. Make it executable:
chmod 755 /usr/local/directadmin/scripts/custom/user_create_post_confirmed.sh
  1. Lastly, when you create your Reseller, just make sure you assign them to the server IP, and it will be swapped with the shared IP for their control.

NOTE: Their User Level domain will still be set to the server IP. More perl regex calls would be needed to accomplish that (user.conf, user.ip_list, httpd.conf, domains/domain.com.conf, domains/domain.com.ip_list, /var/named/domain.com.db).

How to add your own headers in welcome messages and lost password messages

If you want to set a header in the welcome message, example:

Content-Type: text/plain; charset=windows-1251

you would add:

|?HEADER=Content-Type: text/plain; charset=windows-1251|

to your welcome message.

Note: you can already add:

<html>

to the very top of your welcome message, to get DA to add:

MIME-Version: 1.0
Content-Type: text/html

Also, no "creative" headers are allowed. DA does strict character checking to make sure you headers are sane.

For international messages that need UTF-8 encoding, add this line:

|?HEADER=Content-Type: text/plain; charset=utf-8|

Extra headers can now be used. Their token names will be:

HEADER2
HEADER3
HEADER4

in addition to the already existing token value HEADER .

E.g.,

|?HEADER=MIME-Version: 1.0|
|?HEADER2=Content-Type: text/plain; charset=utf8|

This does not apply to the HEADER value used in tickets, only welcome emails.

Related keywords/files:
u_welcome.txt
r_welcome.txt
a_welcome.txt
lost_password_email.txt

Last Updated: