Support

Admin Tools

#16742 Auto add DynDNS to administrator white-list

Posted in ‘Admin Tools for Joomla! 4 & 5’
This is a public ticket

Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.

Environment Information

Joomla! version
n/a
PHP version
n/a
Admin Tools version
n/a

Latest post by nicholas on Friday, 12 July 2013 08:42 CDT

user77196
Mandatory information about my setup:

Have I read the related troubleshooter articles above before posting (which pages?)? Yes
Have I searched the tickets before posting? Yes, found ticket 11948, but still have questions/remarks
Have I read the documentation before posting (which pages?)? Yes
Joomla! version: 2.5.11
PHP version: 5.3.22
MySQL version: 5.5.14
Host: www.kensoor.nl
Admin Tools version: 2.5.11

Description of my issue:
Within Admin Tools I can list several IP addresses that may access the administrator part of Joomla. Problem I have is that the people that needs to have access have a dynamic IP.

I already saw ticket 11948 about this and your response. But I was wondering if you can't still enhance Admin Tools with this feature? What I did now is that I have a PHP file that keeps my .htaccess updated in the /administrator/ folder. This PHP file is added in a cron.

It would be nice to have such kind of a feature for DynDNS people. Could you reconsider building this in Admin Tools?

Example of the PHP file that updates my .htaccess:
<?php
// Rewrites the entire htaccess file. When a line starts with '# Allow from myaccount.dyndns.org' the
// very next line will be replaced with the actual ip associated with myaccount.dyndns.org
$htaccessFile = "/home/webroot/public_html/administrator/.htaccess";
$handle = fopen($htaccessFile, "r");
if ($handle) {
	$previous_line = $content = '';
	while (!feof($handle)) {
		$current_line = fgets($handle);
		if(stripos($previous_line,'# Allow from myaccount.dyndns.org') !== FALSE) {
			$output = gethostbyname('myaccount.dyndns.org');
			$content .= 'Allow from '.$output."\n";
		} elseif(stripos($previous_line,'# Allow from myaccountsecond.dyndns.org') !== FALSE) {
			$output = gethostbyname('myaccountsecond.dyndns.org');
			$content .= 'Allow from '.$output."\n";
		}else{
			$content .= $current_line;
		}
		$previous_line = $current_line;
	}
	fclose($handle);
	$tempFile = tempnam('/tmp','allow_');
	$fp = fopen($tempFile, 'w');
	fwrite($fp, $content);
	fclose($fp);
	rename($tempFile,$htaccessFile);
	chown($htaccessFile,'myuser');
	chmod($htaccessFile,0644);
}
?>

nicholas
Akeeba Staff
Manager
I will tell you the downsides of allowing domain names (instead of IPs) in the whitelist. I'm saying "domain names" because this is what the DynDNS is producing.

Right now Admin Tools gets the visitor's IP address from the web server. It will then load up the whitelist database table and do a quick comparison to see if the visitor's IP is in any range described in this table's entries. This is very fast and the execution stays inside the server. It only takes 5 msec. This happens on every single request.

If you want to allow domain names we will have to first parse that list for domain names, i.e. anything that doesn't look like an IP. That's fast. The problem is that when we get a domain name we have to resolve it. This takes at least 100 msec per domain name. This means that we're making Admin Tools slower by more than an order of magnitude. For every request.

We could, of course, cache the resolved IPs. But where? Another table? A file? It's still too slow.

From my point of view, your PHP script is a much better solution.

Nicholas K. Dionysopoulos

Lead Developer and Director

πŸ‡¬πŸ‡·Greek: native πŸ‡¬πŸ‡§English: excellent πŸ‡«πŸ‡·French: basic β€’ πŸ• My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

user77196
Nicholas,

That explains a lot why the integration within Admin Tools is not that usefull. Thanks for answering.

Regards,

Mark

P.S.: Thanks for the great components you build!

nicholas
Akeeba Staff
Manager
You're welcome and thank you for your kind words!

Nicholas K. Dionysopoulos

Lead Developer and Director

πŸ‡¬πŸ‡·Greek: native πŸ‡¬πŸ‡§English: excellent πŸ‡«πŸ‡·French: basic β€’ πŸ• My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

Support Information

Working hours: We are open Monday to Friday, 9am to 7pm Cyprus timezone (EET / EEST). Support is provided by the same developers writing the software, all of which live in Europe. You can still file tickets outside of our working hours, but we cannot respond to them until we're back at the office.

Support policy: We would like to kindly inform you that when using our support you have already agreed to the Support Policy which is part of our Terms of Service. Thank you for your understanding and for helping us help you!