Koozali.org: home of the SME Server
Legacy Forums => General Discussion (Legacy) => Topic started by: Dave Boccabella on July 04, 2001, 03:44:40 PM
-
I had a problem where I was getting a dynamic IP from my provider, and then needing to propogate it across to all of my Virtual Domains.
Sadly the current version of E-Smith will only handle this on Primary site.
So.. Looking at the code I noticed that all of the virtual domains are listed in a 'domains' file - like the configuration file. As I don't have anything BUT virtual domains (Dan- your input here please is there anything else listed in this?) I decided to modify
/etc/e-smith/events/actions/update-dns
to loop throught this file and automatically update the new IP's on the virtual domains on DynDNS.Org
Anyway.. here is the script.. make a backup of the old one and copy this snippet as the new file. Remember to change the permissions
#!/usr/bin/perl -w
#----------------------------------------------------------------------
# copyright (C) 1999, 2000 e-smith, inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# Technical support for this program is available from e-smith, inc.
# Please visit our web site www.e-smith.com for details.
#----------------------------------------------------------------------
package esmith;
use strict;
use Errno;
use esmith::config;
use esmith::util;
my %conf;
tie %conf, 'esmith::config';
#------------------------------------------------------------
# If using Dynamic DNS service, notify them of new IP address.
#------------------------------------------------------------
my $event = $ARGV
my $ipaddress = $ARGV [1];
my $service = $conf {'DynDnsService'};
if ($service ne 'off')
{
# Wait five seconds then try to update dynamic DNS server.
esmith::util::backgroundCommand (5, "/sbin/e-smith/dynamic-dns/$service",
$ipaddress, $conf {'DynDnsAccount'},
$conf {'DynDnsPassword'}, $conf {'DomainName'});
#-----------------------------------------------------------
# Get the Virtual domains for initialisation
#-----------------------------------------------------------
my %domains;
tie %domains, 'esmith::config', '/home/e-smith/domains';
my $key;
my $value;
my @virtualDomains = ();
while (($key,$value) = each %domains)
{
my ($type, %properties) = split (/\|/, $value, -1);
if ($type eq 'domain')
{
# Wait five seconds then try to update dynamic DNS server.
esmith::util::backgroundCommand (5, "/sbin/e-smith/dynamic-dns/$service",
$ipaddress, $conf {'DynDnsAccount'},
$conf {'DynDnsPassword'}, $key);
}
}
}
exit (0);
#------END---------------
Ok.. its a little crude, but it works for me.
After this I did a reboot, popped onto DynDNS.Org.. and all of my Virtuals are updates .
Have fun folks
Dave
-
Hi,
Another solution, is to use YourDomain.com as data for your virtual domains.
IE :
host : YourDomain.com
IP : 123.123.123.123
CNAMES :
mail.YourDomain.com data : YourDomain.com instead of 123.123.123.123 !
ftp.YourDomain.com data : YourDomain.com
...
-
I think CNAMES will only work on Static IP's.
My problem is that I have a Dynamic IP (from my provider)
Still - interesting possibilty with teh Virtual Domain set up page on E-Smith is to choose to update the DNS provider on IP changes, and possibly even connect to multiple DNS providers.
It would need a couple of changes to the Domain file - adding 'Update IP flag' and 'Provider, Username, Password' fields.
But once that was done it would be easy to extract them and update.
Q.. Has anyone had any experiance with changing the E-Smith Webpage Interfaces??.. I'd be interested to chat.compare notes for a few idea's.
Dave
-
No, it's perfectly legitimate to use a CNAME to a dynamic IP. For example, you could set up myhost.dyndns.org, and have that update automatically. Then, you could create mydomain.com, and set it as a CNAME to myhost.dyndns.org. You'd also need to create mydomain.com as a virtual domain on your e-smith server.
-
Ah.. CNAMES are only supported by the $30 donation to DynDNS. I'm
waiting on that until I get my own domain name.
But that does seem to be another way of doing it.
Thanks for the info Dan