Fixed: Switch shared/dedicated IP: Verification if Global DNS Records contains
an IP address. In that case raise an error. System admin has to replace teh IP addresses for the [ip] alias
This commit is contained in:
parent
af958f94a8
commit
23ff0c4751
4 changed files with 31 additions and 2 deletions
|
@ -171,6 +171,16 @@ namespace WebsitePanel.EnterpriseServer
|
|||
return AddWebSite(packageId, hostName, domainId, ipAddressId, false, true);
|
||||
}
|
||||
|
||||
private static Regex regIP = new Regex(
|
||||
@"(?<First>2[0-4]\d|25[0-5]|[01]?\d\d?)\.(?<Second>2[0-4]\d|25"
|
||||
+ @"[0-5]|[01]?\d\d?)\.(?<Third>2[0-4]\d|25[0-5]|[01]?\d\d?)\.(?"
|
||||
+ @"<Fourth>2[0-4]\d|25[0-5]|[01]?\d\d?)",
|
||||
RegexOptions.IgnoreCase
|
||||
| RegexOptions.CultureInvariant
|
||||
| RegexOptions.IgnorePatternWhitespace
|
||||
| RegexOptions.Compiled
|
||||
);
|
||||
|
||||
public static int AddWebSite(int packageId, string hostName, int domainId, int packageAddressId,
|
||||
bool addInstantAlias, bool ignoreGlobalDNSRecords)
|
||||
{
|
||||
|
@ -257,6 +267,14 @@ namespace WebsitePanel.EnterpriseServer
|
|||
// load web DNS records
|
||||
List<GlobalDnsRecord> dnsRecords = ServerController.GetDnsRecordsByService(serviceId);
|
||||
|
||||
if (dedicatedIp)
|
||||
{
|
||||
foreach (GlobalDnsRecord d in dnsRecords)
|
||||
{
|
||||
if (regIP.IsMatch(d.ExternalIP)) return BusinessErrorCodes.ERROR_GLOBALDNS_FOR_DEDICATEDIP;
|
||||
}
|
||||
}
|
||||
|
||||
// prepare site bindings
|
||||
List<ServerBinding> bindings = new List<ServerBinding>();
|
||||
|
||||
|
@ -631,6 +649,13 @@ namespace WebsitePanel.EnterpriseServer
|
|||
}
|
||||
|
||||
|
||||
List<GlobalDnsRecord> dnsRecords = ServerController.GetDnsRecordsByService(siteItem.ServiceId);
|
||||
|
||||
foreach (GlobalDnsRecord d in dnsRecords)
|
||||
{
|
||||
if (regIP.IsMatch(d.ExternalIP)) return BusinessErrorCodes.ERROR_GLOBALDNS_FOR_DEDICATEDIP;
|
||||
}
|
||||
|
||||
// place log record
|
||||
TaskManager.StartTask("WEB_SITE", "SWITCH_TO_DEDICATED_IP", siteItem.Name);
|
||||
TaskManager.ItemId = siteItemId;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue