How TO | Multiple server. login page

Eris

New member
Joined
Dec 24, 2004
Messages
3
There are a lot of hosters who have several servers running for their company. And if they want a option to get their costumers in their control pannel is this a simple way.

Everybody know that costumers don't knew there server name (Except me than)

How to fix it?

Just create filename.whatever
Code:
<html>
<head>
<title>DirectAdmin Login</title>
<style>
*{ FONT-SIZE: 8pt; FONT-FAMILY: verdana; } 
b { FONT-WEIGHT: bold; } 
.listtitle { BACKGROUND: #425984;
 COLOR: #EEEEEE; 
white-space: nowrap; } td.list { BACKGROUND: #EEEEEE; white-space: nowrap; } </style>
</head>
<body onLoad="document.form.username.focus();">
<script type='text/javascript'>
function changeAction()
{
var x=document.forms.form
var t=x.domain.value
//if you are using SSL its 
//hasn't been tested (My provider is running under [url]http://[/url]
[url]https://www.[/url]"+ t + ":2222/CMD_LOGIN"
var p="http://www."+ t + ":2222/CMD_LOGIN"
x.action=p
}
</script>
<center><br><br><br><br>
<h1>DirectAdmin Login Page</h1>
<table cellspacing=1 cellpadding=5>
<tr>
<td class=listtitle colspan=2>
Please enter your Username and Password</td>
</tr>
<form action="" method="POST" name="form" onsubmit="changeAction()">
<input type=hidden name=referer value="/">

<tr><td class=list align=right>Username:</td>
<td class=list><input type=text name=username></td></tr>
<tr><td class=list align=right>Password:</td>
<td class=list><input type=password name=password></td></tr>
<tr><td class=list align=right>Domain:</td>
<td class=list><input type=text name=domain></td></tr>
<tr><td class=listtitle align=right colspan=2><input type=submit value='Login'></td></tr>
</form>
</table>
</center>
</body>
</html>

To our mods ;) If it belongs to somewhere else please move it. Could be usefull for other users ;)

Edit: I forgot to remove a line that show me alert for testing. It is done ;)
 
Last edited:
Looks good at first glance (I haven't tried it), and it belongs right here, where you posted it.

My only concern is that for those of us using SSL logins to our servers (and I hope all of us are), when clients go to their own domain name to login they'll get a name-mismatch popup from the secure cert.

If that's acceptable, then this works.

Jeff
 
Looks good, we've run something similar for a couple of months now although some of our boxes are secure login only which throws a bit of a spanner in the works.

One minor point/enhancement, don't forget you can add the fail and logout tokens..

<input name="FAIL_URL" type="hidden"value="INSERT_YOUR_URL_HERE">
<input name="LOGOUT_URL" type="hidden"value="INSERT_YOUR_URL_HERE">

Rob
 
Last edited:
Finally, Eris, you come out this useful script. i'm looking for this one quite a long time.

Thanks.

EDIT
How do i disable the javascript pop up
 
useful multiserver login script

I was faced with problem with many DA servers (2 or more) and user logins on it. So, I wrote small perl cgi script and solve my problem in that way.

Remark: user names must not be the same on any server you wish to login to.

---------------------------
#!/usr/bin/perl -w

use strict;

# Server list (I use IP addresses instead of domain names)
my @da_servers = qw(
217.20.163.33
217.20.163.192
);

# My login/logout page
my $logout = "http://somewhere.com/login.html";

use HTTP::Request::Common qw(POST GET);
use LWP::UserAgent;
use CGI;

my $query = new CGI;

my $user = $query->param('username') || 0;
my $pass = $query->param('password') || 0;

my $browser = LWP::UserAgent->new();

$browser->agent('LWP::UserAgent (Mozilla/4.0 compatible)');
$browser->cookie_jar({});

push @{ $browser->requests_redirectable }, 'POST';

foreach my $url (@da_servers) {
$url = 'http://'.$url.':2222/CMD_LOGIN';
my $response = $browser->post( $url, [ referer => '/', username => "$user", password => "$pass" ] );

if($response->is_success) {
print $query->header(
-status => "307",
-location => "$url?username=$user&password=$pass&LOGOUT_URL=$logout"
);
exit;
}
}

print $query->header(-status => "200 OK");
print "Error! Go back and try again.\n";
exit;
---------------------------

index.html just contains login form, which code same to DA login page with parameters passed to this script. This script can be easyly modified for login to other hosting control panels.
 
[..]My only concern is that for those of us using SSL logins to our servers (and I hope all of us are), when clients go to their own domain name to login they'll get a name-mismatch popup from the secure cert.

If that's acceptable, then this works.

Well, I have just tested "Eris" log in form, and it works great. Also, if you instruct your users to type the server hostname in the form instead of their own domain name, it should not be a problem with the SSL?

I tested the form and it works great when using the server hostname/domain.

I am only a little unsure, because I don't yet use a SSL on DirectAdmin, and I only have one server for the time being. But I am planning to install SSL on DirectAdmin tomorrow, I have to investigate more on this, and would be thankful for any links to information (I have installed SSL sertificate in DirectAdmin before, but have not yet installed it on the control panel itself). I would believe the SSL sertificate then should be installed on the server hostname/domain (https://host.name.tld)? If so, then there should be no problem using this log in form! :)

If you do not install the server wide SSL sertificate on the server hostname, please let me know and explain why and how to me. Thanks!
 
Last edited:
DirectAdmin logins are not on port 80, are not managed by Apache, and so need a special installation of your Secure Certificate.

Instructions are here. You'll also have to change SSL=1 in your directadmin.conf file, and then restart DirectAdmin.

Jeff
 
DirectAdmin logins are not on port 80, are not managed by Apache, and so need a special installation of your Secure Certificate.

Instructions are here. You'll also have to change SSL=1 in your directadmin.conf file, and then restart DirectAdmin.

I have finished the job, and are using SSL in the panel now. I did not have problems finding the information you posted above my self. The problem is that this information is insufficient, and it took a hole lot of work to figure out how to do the things that is missing in the knowledgebase.

But as I said, I have finished the job, and it went well. If anybody is interested, I can post a how to in a new thread.
 
You don't say how the information was insufficient, and I've never had a problem using it, so I'm not sure what you may have had a problem with. Please feel free to post your How-To.

Jeff
 
You don't say how the information was insufficient, and I've never had a problem using it, so I'm not sure what you may have had a problem with. Please feel free to post your How-To.

Yes, I don't. Sorry for that, but I did not want to do double work explaining in case I should post my how-to.

Well, I will write a how-to, then. Then you can see what information I felt was missing from the knowledgebase.

I hope I can have it ready in about two hours.
 
You don't say how the information was insufficient, and I've never had a problem using it, so I'm not sure what you may have had a problem with. Please feel free to post your How-To.

I have now posted my How-To: http://directadmin.com/forum/showthread.php?p=182385

I hope this will be helpfull for someone. Also, please note that I have a question asking for help at the end of the How-To. Thanks.
 
We also ended up coding our own login script using php.

It would be nice to see Directadmin do something like this out of the box in a future version ?

thanks
 
Back
Top