diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Common/BusinessErrorCodes.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Common/BusinessErrorCodes.cs index 0b32925f..f6f8dfd8 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Common/BusinessErrorCodes.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Common/BusinessErrorCodes.cs @@ -114,6 +114,7 @@ namespace WebsitePanel.EnterpriseServer public const int ERROR_WEB_SITE_IP_ADDRESS_NOT_SPECIFIED = -607; public const int ERROR_WEB_SITE_SHARED_IP_ADDRESS_NOT_SPECIFIED = -608; public const int ERROR_WEB_SHARED_SSL_QUOTA_LIMIT = -609; + public const int ERROR_GLOBALDNS_FOR_DEDICATEDIP = -610; #endregion #region Mail diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/WebServers/WebServerController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/WebServers/WebServerController.cs index 84403264..84d173f3 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/WebServers/WebServerController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/WebServers/WebServerController.cs @@ -171,6 +171,16 @@ namespace WebsitePanel.EnterpriseServer return AddWebSite(packageId, hostName, domainId, ipAddressId, false, true); } + private static Regex regIP = new Regex( + @"(?2[0-4]\d|25[0-5]|[01]?\d\d?)\.(?2[0-4]\d|25" + + @"[0-5]|[01]?\d\d?)\.(?2[0-4]\d|25[0-5]|[01]?\d\d?)\.(?" + + @"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 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 bindings = new List(); @@ -631,6 +649,13 @@ namespace WebsitePanel.EnterpriseServer } + List 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; diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Web.config b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Web.config index 1a1ba86c..57a9efa3 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Web.config +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Web.config @@ -10,7 +10,7 @@ --> - + @@ -19,7 +19,7 @@ --> - + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx index 8d392525..7bc1ffaa 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx @@ -1056,6 +1056,9 @@ Web Site meta-item IP address is not specified + + Invalid Global DNS entries in platform server configuration for dedicated IP address usage. Contact you platform administrator + Specified mail domain already exists on the service