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:
robvde 2012-10-10 15:16:25 +04:00
parent af958f94a8
commit 23ff0c4751
4 changed files with 31 additions and 2 deletions

View file

@ -114,6 +114,7 @@ namespace WebsitePanel.EnterpriseServer
public const int ERROR_WEB_SITE_IP_ADDRESS_NOT_SPECIFIED = -607; 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_SITE_SHARED_IP_ADDRESS_NOT_SPECIFIED = -608;
public const int ERROR_WEB_SHARED_SSL_QUOTA_LIMIT = -609; public const int ERROR_WEB_SHARED_SSL_QUOTA_LIMIT = -609;
public const int ERROR_GLOBALDNS_FOR_DEDICATEDIP = -610;
#endregion #endregion
#region Mail #region Mail

View file

@ -171,6 +171,16 @@ namespace WebsitePanel.EnterpriseServer
return AddWebSite(packageId, hostName, domainId, ipAddressId, false, true); 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, public static int AddWebSite(int packageId, string hostName, int domainId, int packageAddressId,
bool addInstantAlias, bool ignoreGlobalDNSRecords) bool addInstantAlias, bool ignoreGlobalDNSRecords)
{ {
@ -257,6 +267,14 @@ namespace WebsitePanel.EnterpriseServer
// load web DNS records // load web DNS records
List<GlobalDnsRecord> dnsRecords = ServerController.GetDnsRecordsByService(serviceId); 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 // prepare site bindings
List<ServerBinding> bindings = new List<ServerBinding>(); 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 // place log record
TaskManager.StartTask("WEB_SITE", "SWITCH_TO_DEDICATED_IP", siteItem.Name); TaskManager.StartTask("WEB_SITE", "SWITCH_TO_DEDICATED_IP", siteItem.Name);
TaskManager.ItemId = siteItemId; TaskManager.ItemId = siteItemId;

View file

@ -10,7 +10,7 @@
<add name="EnterpriseServer" connectionString="server=HSTWSP01;database=WebsitePanelMerge;uid=WebsitePanel;pwd=pserxfbnlc6hwmdedbp0;" providerName="System.Data.SqlClient" /> <add name="EnterpriseServer" connectionString="server=HSTWSP01;database=WebsitePanelMerge;uid=WebsitePanel;pwd=pserxfbnlc6hwmdedbp0;" providerName="System.Data.SqlClient" />
--> -->
<add name="EnterpriseServer" connectionString="server=HSTPROV01;database=WebsitePanelMerge;uid=WebsitePanel;pwd=aj7ep6fyhmw3b5qeth7c;" /> <add name="EnterpriseServer" connectionString="server=HSTWSP01;database=WebsitePanelMerge;uid=WebsitePanel;pwd=pserxfbnlc6hwmdedbp0;" providerName="System.Data.SqlClient" />
</connectionStrings> </connectionStrings>
<appSettings> <appSettings>
@ -19,7 +19,7 @@
<add key="WebsitePanel.CryptoKey" value="3x7eqt7zabc5n5afs6dg" /> <add key="WebsitePanel.CryptoKey" value="3x7eqt7zabc5n5afs6dg" />
<add key="WebsitePanel.CryptoKey" value="fr2ym4wn2gmbrj7dz336" /> <add key="WebsitePanel.CryptoKey" value="fr2ym4wn2gmbrj7dz336" />
--> -->
<add key="WebsitePanel.CryptoKey" value="3x7eqt7zabc5n5afs6dg" /> <add key="WebsitePanel.CryptoKey" value="fr2ym4wn2gmbrj7dz336" />
<!-- A1D4KDHUE83NKHddF --> <!-- A1D4KDHUE83NKHddF -->
<add key="WebsitePanel.EncryptionEnabled" value="true" /> <add key="WebsitePanel.EncryptionEnabled" value="true" />
<!-- Web Applications --> <!-- Web Applications -->

View file

@ -1056,6 +1056,9 @@
<data name="Error.607" xml:space="preserve"> <data name="Error.607" xml:space="preserve">
<value>Web Site meta-item IP address is not specified</value> <value>Web Site meta-item IP address is not specified</value>
</data> </data>
<data name="Error.610" xml:space="preserve">
<value>Invalid Global DNS entries in platform server configuration for dedicated IP address usage. Contact you platform administrator</value>
</data>
<data name="Error.700" xml:space="preserve"> <data name="Error.700" xml:space="preserve">
<value>Specified mail domain already exists on the service</value> <value>Specified mail domain already exists on the service</value>
</data> </data>