This commit is contained in:
feodor_fitsner 2012-01-19 10:31:25 -08:00
commit c07c84a750
47 changed files with 1216 additions and 1134 deletions

View file

@ -12,3 +12,30 @@ BEGIN
END
GO
-- registering MySQL 5.5 provider
IF NOT EXISTS (SELECT * FROM [dbo].[Providers] WHERE [DisplayName] = 'MySQL Server 5.5')
BEGIN
-- provider
INSERT [dbo].[Providers] ([ProviderID], [GroupID], [ProviderName], [DisplayName], [ProviderType], [EditorControl], [DisableAutoDiscovery]) VALUES (301, 11, N'MySQL', N'MySQL Server 5.5', N'WebsitePanel.Providers.Database.MySqlServer55, WebsitePanel.Providers.Database.MySQL', N'MySQL', NULL)
-- properties
INSERT [dbo].[ServiceDefaultProperties] ([ProviderID], [PropertyName], [PropertyValue]) VALUES (301, N'ExternalAddress', N'localhost')
INSERT [dbo].[ServiceDefaultProperties] ([ProviderID], [PropertyName], [PropertyValue]) VALUES (301, N'InstallFolder', N'%PROGRAMFILES%\MySQL\MySQL Server 5.5')
INSERT [dbo].[ServiceDefaultProperties] ([ProviderID], [PropertyName], [PropertyValue]) VALUES (301, N'InternalAddress', N'localhost,3306')
INSERT [dbo].[ServiceDefaultProperties] ([ProviderID], [PropertyName], [PropertyValue]) VALUES (301, N'RootLogin', N'root')
INSERT [dbo].[ServiceDefaultProperties] ([ProviderID], [PropertyName], [PropertyValue]) VALUES (301, N'RootPassword', N'')
END
GO
-- registering SmarterMail 9.x provider
IF NOT EXISTS (SELECT * FROM [dbo].[Providers] WHERE [DisplayName] = 'SmarterMail 9.x')
BEGIN
-- provider
INSERT [dbo].[Providers] ([ProviderID], [GroupID], [ProviderName], [DisplayName], [ProviderType], [EditorControl], [DisableAutoDiscovery]) VALUES (65, 4, N'SmarterMail', N'SmarterMail 9.x', N'WebsitePanel.Providers.Mail.SmarterMail9, WebsitePanel.Providers.Mail.SmarterMail9', N'SmarterMail60', NULL)
-- properties
INSERT [dbo].[ServiceDefaultProperties] ([ProviderID], [PropertyName], [PropertyValue]) VALUES (65, N'AdminPassword', N'')
INSERT [dbo].[ServiceDefaultProperties] ([ProviderID], [PropertyName], [PropertyValue]) VALUES (65, N'AdminUsername', N'admin')
INSERT [dbo].[ServiceDefaultProperties] ([ProviderID], [PropertyName], [PropertyValue]) VALUES (65, N'DomainsPath', N'%SYSTEMDRIVE%\SmarterMail')
INSERT [dbo].[ServiceDefaultProperties] ([ProviderID], [PropertyName], [PropertyValue]) VALUES (65, N'ServerIPAddress', N'127.0.0.1;127.0.0.1')
INSERT [dbo].[ServiceDefaultProperties] ([ProviderID], [PropertyName], [PropertyValue]) VALUES (65, N'ServiceUrl', N'http://localhost:9998/services/')
END
GO

View file

@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.235
// Runtime Version:4.0.30319.239
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.

View file

@ -1,7 +1,7 @@
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:4.0.30319.235
' Runtime Version:4.0.30319.239
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.

View file

@ -29,8 +29,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebsitePanel.Products.Hosti
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebsitePanel.Products.HostingPlan", "WebsitePanel.Products.HostingPlan\WebsitePanel.Products.HostingPlan.csproj", "{65FEDD1B-379C-413D-84D8-20E6C29C645D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebsitePanel.Plugins.Directi", "WebsitePanel.Registrars.Directi\WebsitePanel.Plugins.Directi.csproj", "{823D6FA5-F84F-4E50-9091-040C256955A5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebsitePanel.Plugins.Enom", "WebsitePanel.Registrars.Enom\WebsitePanel.Plugins.Enom.csproj", "{39A6F585-4A27-4AAA-A43F-858FC32ADF98}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebsitePanel.Common.Utils", "WebsitePanel.Common.Utils\WebsitePanel.Common.Utils.csproj", "{53D22D35-4013-415F-BA09-F67A0DBBB0C1}"
@ -81,10 +79,6 @@ Global
{338F816B-BEB4-4F18-9EA1-2EFD35DBA65B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{65FEDD1B-379C-413D-84D8-20E6C29C645D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{65FEDD1B-379C-413D-84D8-20E6C29C645D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{823D6FA5-F84F-4E50-9091-040C256955A5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{823D6FA5-F84F-4E50-9091-040C256955A5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{823D6FA5-F84F-4E50-9091-040C256955A5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{823D6FA5-F84F-4E50-9091-040C256955A5}.Release|Any CPU.Build.0 = Release|Any CPU
{39A6F585-4A27-4AAA-A43F-858FC32ADF98}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{39A6F585-4A27-4AAA-A43F-858FC32ADF98}.Debug|Any CPU.Build.0 = Debug|Any CPU
{39A6F585-4A27-4AAA-A43F-858FC32ADF98}.Release|Any CPU.ActiveCfg = Release|Any CPU

View file

@ -5,11 +5,11 @@
</configSections>
<!-- Connection strings -->
<connectionStrings>
<add name="EnterpriseServer" connectionString="${installer.connectionstring}" providerName="System.Data.SqlClient"/>
<add name="EnterpriseServer" connectionString="Server=(local)\SQLExpress;Database=WebsitePanel;uid=WebsitePanel;pwd=Password12" providerName="System.Data.SqlClient"/>
</connectionStrings>
<appSettings>
<!-- Encryption util settings -->
<add key="WebsitePanel.CryptoKey" value="${installer.cryptokey}"/>
<add key="WebsitePanel.CryptoKey" value="1234567890"/>
<!-- A1D4KDHUE83NKHddF -->
<add key="WebsitePanel.EncryptionEnabled" value="true"/>
<!-- Web Applications -->

View file

@ -47,7 +47,6 @@ namespace WebsitePanel.Providers.Web
private string siteId;
private string siteIPAddress;
private int siteIPAddressId;
private string logsPath;
private string dataPath;
private ServerBinding[] bindings;
private bool frontPageAvailable;

View file

@ -56,7 +56,7 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="SDNSAPI">
<HintPath>..\..\..\..\..\WebsitePanel.bak\WebsitePanel\Branches\1.2.0\Lib\References\SimpleDNS\SDNSAPI.dll</HintPath>
<HintPath>..\..\Lib\References\SimpleDNS\SDNSAPI.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />

View file

@ -1,4 +1,4 @@
// Copyright (c) 2010, SMB SAAS Systems Inc.
// Copyright (c) 2011, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
@ -11,7 +11,7 @@
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the SMB SAAS Systems Inc. nor the names of its
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//

View file

@ -80,31 +80,31 @@
</Reference>
<Reference Include="Microsoft.Exchange.Common, Version=8.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\WebsitePanel.bak\WebsitePanel\Branches\1.2.0\Lib\References\Microsoft\Microsoft.Exchange.Common.dll</HintPath>
<HintPath>..\..\Lib\References\Microsoft\Microsoft.Exchange.Common.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Exchange.Data, Version=8.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\WebsitePanel.bak\WebsitePanel\Branches\1.2.0\Lib\References\Microsoft\Microsoft.Exchange.Data.dll</HintPath>
<HintPath>..\..\Lib\References\Microsoft\Microsoft.Exchange.Data.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Exchange.Data.Directory, Version=8.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\WebsitePanel.bak\WebsitePanel\Branches\1.2.0\Lib\References\Microsoft\Microsoft.Exchange.Data.Directory.dll</HintPath>
<HintPath>..\..\Lib\References\Microsoft\Microsoft.Exchange.Data.Directory.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Exchange.Data.Storage, Version=8.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\WebsitePanel.bak\WebsitePanel\Branches\1.2.0\Lib\References\Microsoft\Microsoft.Exchange.Data.Storage.dll</HintPath>
<HintPath>..\..\Lib\References\Microsoft\Microsoft.Exchange.Data.Storage.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Exchange.Diagnostics, Version=8.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\WebsitePanel.bak\WebsitePanel\Branches\1.2.0\Lib\References\Microsoft\Microsoft.Exchange.Diagnostics.dll</HintPath>
<HintPath>..\..\Lib\References\Microsoft\Microsoft.Exchange.Diagnostics.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Exchange.Extensibility.Internal, Version=8.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\WebsitePanel.bak\WebsitePanel\Branches\1.2.0\Lib\References\Microsoft\Microsoft.Exchange.Extensibility.Internal.dll</HintPath>
<HintPath>..\..\Lib\References\Microsoft\Microsoft.Exchange.Extensibility.Internal.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Exchange.Net, Version=8.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\WebsitePanel.bak\WebsitePanel\Branches\1.2.0\Lib\References\Microsoft\Microsoft.Exchange.Net.dll</HintPath>
<HintPath>..\..\Lib\References\Microsoft\Microsoft.Exchange.Net.dll</HintPath>
</Reference>
<Reference Include="Microsoft.SharePoint">
<HintPath>..\..\Lib\References\Microsoft\Microsoft.SharePoint.dll</HintPath>

View file

@ -1,4 +1,32 @@
using System;
// Copyright (c) 2011, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

View file

@ -1,4 +1,32 @@
using System;
// Copyright (c) 2011, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

View file

@ -1,4 +1,4 @@
// Copyright (c) 2010, SMB SAAS Systems Inc.
// Copyright (c) 2011, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
@ -11,7 +11,7 @@
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the SMB SAAS Systems Inc. nor the names of its
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//

View file

@ -908,7 +908,7 @@ namespace WebsitePanel.Providers.VirtualizationForPC
steps.AppendLine("VM created");
}
}
catch (System.TimeoutException ex)
catch (System.TimeoutException)
{
vmTemplate.ProvisioningStatus = VirtualMachineProvisioningStatus.InProgress;
}
@ -1064,8 +1064,6 @@ namespace WebsitePanel.Providers.VirtualizationForPC
{
List<Virtualization.VirtualNetworkInfo> result = new List<Virtualization.VirtualNetworkInfo>();
try
{
using (WSPVirtualMachineManagementServiceClient client = GetVMMSClient())
{
VirtualizationForPC.SVMMService.VirtualNetworkInfo[] networks = client.GetVirtualNetworkByHost(hostInfo);
@ -1092,10 +1090,6 @@ namespace WebsitePanel.Providers.VirtualizationForPC
});
}
}
}
catch (Exception ex)
{
}
return result.ToArray();
@ -1287,8 +1281,6 @@ namespace WebsitePanel.Providers.VirtualizationForPC
List<VirtualMachineSnapshot> ret = new List<VirtualMachineSnapshot>();
try
{
using (WSPVirtualMachineManagementServiceClient client = GetVMMSClient())
{
VMCheckpointInfo[] chkPtnList = client.GetVirtualMachineByName(vmId).VMCheckpoints;
@ -1312,10 +1304,6 @@ namespace WebsitePanel.Providers.VirtualizationForPC
}
}
}
}
catch (Exception e)
{
}
return ret;
}
@ -1338,7 +1326,7 @@ namespace WebsitePanel.Providers.VirtualizationForPC
client.NewVirtualMachineCheckpoint(vm.Id, String.Format("{0} - {1}", vm.Name, DateTime.Now), String.Empty);
}
}
catch (TimeoutException ext)
catch (TimeoutException)
{
ret.ReturnValue = ReturnCode.JobStarted;
}
@ -1368,7 +1356,7 @@ namespace WebsitePanel.Providers.VirtualizationForPC
client.RestoreVirtualMachineCheckpoint(snapshotId);
}
}
catch (TimeoutException ext)
catch (TimeoutException)
{
error = true;
ret.ReturnValue = ReturnCode.JobStarted;
@ -1856,8 +1844,7 @@ namespace WebsitePanel.Providers.VirtualizationForPC
public WSPVirtualMachineManagementServiceClient GetVMMSClient()
{
WSPVirtualMachineManagementServiceClient ret;
try
{
if (!String.IsNullOrWhiteSpace(SCVMMServer)
&& !String.IsNullOrWhiteSpace(SCVMMPrincipalName))
{
@ -1871,11 +1858,6 @@ namespace WebsitePanel.Providers.VirtualizationForPC
{
throw new Exception("SCVMMServer or SCVMMPrincipalName is empty");
}
}
catch (Exception ex)
{
throw;
}
return ret;
}
@ -1884,8 +1866,6 @@ namespace WebsitePanel.Providers.VirtualizationForPC
{
WSPMonitoringServiceClient ret;
try
{
if (!String.IsNullOrWhiteSpace(SCOMServer)
&& !String.IsNullOrWhiteSpace(SCOMPrincipalName))
{
@ -1897,11 +1877,6 @@ namespace WebsitePanel.Providers.VirtualizationForPC
{
throw new Exception("MonitoringServer or MonitoringPrincipalName is empty");
}
}
catch (Exception ex)
{
throw;
}
return ret;
}

View file

@ -41,9 +41,7 @@ namespace WebsitePanel.Providers.Web.Iis.Authentication
public const string UserNameAttribute = "userName";
public const string PasswordAttribute = "password";
public PropertyBag GetAuthenticationSettings(string siteId)
{
using (var srvman = GetServerManager())
public PropertyBag GetAuthenticationSettings(ServerManager srvman, string siteId)
{
var config = srvman.GetApplicationHostConfiguration();
//
@ -58,7 +56,6 @@ namespace WebsitePanel.Providers.Web.Iis.Authentication
//
return bag;
}
}
public void SetAuthenticationSettings(string virtualPath, string userName,
string password, bool enabled)

View file

@ -37,9 +37,7 @@ namespace WebsitePanel.Providers.Web.Iis.Authentication
{
public const string EnabledAttribute = "enabled";
public void GetAuthenticationSettings(WebVirtualDirectory virtualDir)
{
using (var srvman = GetServerManager())
public void GetAuthenticationSettings(ServerManager srvman, WebVirtualDirectory virtualDir)
{
var config = srvman.GetApplicationHostConfiguration();
//
@ -47,7 +45,6 @@ namespace WebsitePanel.Providers.Web.Iis.Authentication
//
virtualDir.EnableBasicAuthentication = Convert.ToBoolean(section.GetAttributeValue(EnabledAttribute));
}
}
public void SetAuthenticationSettings(WebVirtualDirectory virtualDir)
{

View file

@ -37,20 +37,15 @@ namespace WebsitePanel.Providers.Web.Iis.Authentication
{
public const string EnabledAttribute = "enabled";
public PropertyBag GetAuthenticationSettings(string siteId)
public PropertyBag GetAuthenticationSettings(ServerManager srvman, string siteId)
{
PropertyBag bag = new PropertyBag();
//
using (var srvman = GetServerManager())
{
var config = srvman.GetApplicationHostConfiguration();
//
var section = config.GetSection(Constants.WindowsAuthenticationSection, siteId);
//
bag[AuthenticationGlobals.IsLocked] = section.IsLocked;
bag[AuthenticationGlobals.Enabled] = Convert.ToBoolean(section.GetAttributeValue(EnabledAttribute));
}
//
return bag;
}

View file

@ -40,9 +40,7 @@ namespace WebsitePanel.Providers.Web.Iis.ClassicAsp
public const string SectionName = "system.webServer/asp";
public const string EnableParentPathsAttribute = "enableParentPaths";
public PropertyBag GetClassicAspSettings(string siteId)
{
using (var srvman = GetServerManager())
public PropertyBag GetClassicAspSettings(ServerManager srvman, string siteId)
{
var config = srvman.GetApplicationHostConfiguration();
//
@ -54,7 +52,6 @@ namespace WebsitePanel.Providers.Web.Iis.ClassicAsp
//
return bag;
}
}
public void SetClassicAspSettings(WebVirtualDirectory virtualDir)
{

View file

@ -31,12 +31,14 @@ namespace WebsitePanel.Providers.Web.Iis.Common
using System;
using System.Collections.Generic;
using System.Text;
using System.Web;
using Microsoft.Web.Administration;
using Microsoft.Web.Management.Server;
public abstract class ConfigurationModuleService
{
private const string ServerManagerContextKey = "ServerManagerContextKey";
/// <summary>
/// We'll use it in the future to implement management of web farm with shared configuration enabled
/// </summary>

View file

@ -43,9 +43,7 @@ namespace WebsitePanel.Providers.Web.Iis.DefaultDocuments
{
public const string ValueAttribute = "value";
public string GetDefaultDocumentSettings(string siteId)
{
using (var srvman = GetServerManager())
public string GetDefaultDocumentSettings(ServerManager srvman, string siteId)
{
// Load web site configuration
var config = srvman.GetWebConfiguration(siteId);
@ -68,7 +66,6 @@ namespace WebsitePanel.Providers.Web.Iis.DefaultDocuments
//
return String.Join(",", defaultDocs.ToArray());
}
}
public void SetDefaultDocumentsEnabled(string siteId, bool enabled)
{

View file

@ -35,9 +35,7 @@ namespace WebsitePanel.Providers.Web.Iis.DirectoryBrowse
internal sealed class DirectoryBrowseModuleService : ConfigurationModuleService
{
public PropertyBag GetDirectoryBrowseSettings(string siteId)
{
using (var srvman = GetServerManager())
public PropertyBag GetDirectoryBrowseSettings(ServerManager srvman, string siteId)
{
var config = srvman.GetWebConfiguration(siteId);
//
@ -49,7 +47,6 @@ namespace WebsitePanel.Providers.Web.Iis.DirectoryBrowse
bag[DirectoryBrowseGlobals.ReadOnly] = directoryBrowseSection.IsLocked;
return bag;
}
}
public void SetDirectoryBrowseEnabled(string siteId, bool enabled)
{

View file

@ -58,12 +58,10 @@ using System.Collections.Specialized;
{ Constants.AspNet40x64PathSetting, @"\Framework64\v4.0.30128\aspnet_isapi.dll" }
};
public SettingPair[] GetISAPIExtensionsInstalled()
public SettingPair[] GetISAPIExtensionsInstalled(ServerManager srvman)
{
List<SettingPair> settings = new List<SettingPair>();
//
using (var srvman = GetServerManager())
{
var config = srvman.GetApplicationHostConfiguration();
//
var section = config.GetSection(Constants.IsapiCgiRestrictionSection);
@ -90,7 +88,6 @@ using System.Collections.Specialized;
}
}
}
}
//
return settings.ToArray();
}

View file

@ -87,25 +87,16 @@ namespace WebsitePanel.Providers.Web.Handlers
}
}
public void SetHandlersAccessPolicy(string fqPath, HandlerAccessPolicy policy)
{
//
using (var srvman = GetServerManager())
public void SetHandlersAccessPolicy(ServerManager srvman, string fqPath, HandlerAccessPolicy policy)
{
var config = srvman.GetWebConfiguration(fqPath);
//
HandlersSection section = (HandlersSection)config.GetSection(Constants.HandlersSection, typeof(HandlersSection));
//
section.AccessPolicy = policy;
//
srvman.CommitChanges();
}
}
public HandlerAccessPolicy GetHandlersAccessPolicy(string fqPath)
{
//
using (var srvman = GetServerManager())
public HandlerAccessPolicy GetHandlersAccessPolicy(ServerManager srvman, string fqPath)
{
var config = srvman.GetWebConfiguration(fqPath);
//
@ -113,20 +104,6 @@ namespace WebsitePanel.Providers.Web.Handlers
//
return section.AccessPolicy;
}
}
internal ConfigurationElementCollection GetHandlers(WebVirtualDirectory virtualDir)
{
//
using (var srvman = GetServerManager())
{
var config = srvman.GetWebConfiguration(virtualDir.FullQualifiedPath);
//
var section = config.GetSection(Constants.HandlersSection);
//
return section.GetCollection();
}
}
/// <summary>
/// Adds non existent script maps.
@ -141,16 +118,16 @@ namespace WebsitePanel.Providers.Web.Handlers
if (String.IsNullOrEmpty(processor))
return;
// This section helps to overcome "legacy" issues
using (var srvman = GetServerManager())
{
var config = srvman.GetWebConfiguration(virtualDir.FullQualifiedPath);
//
var handlersSection = config.GetSection(Constants.HandlersSection);
// Do a complete section cleanup
handlersSection.RevertToParent();
//
srvman.CommitChanges();
}
//using (var srvman = GetServerManager())
//{
// var config = srvman.GetWebConfiguration(virtualDir.FullQualifiedPath);
// //
// var handlersSection = config.GetSection(Constants.HandlersSection);
// // Do a complete section cleanup
// handlersSection.RevertToParent();
// //
// srvman.CommitChanges();
//}
//
using (var srvman = GetServerManager())
{

View file

@ -44,9 +44,7 @@ namespace WebsitePanel.Providers.Web.HttpRedirect
public const string DestinationAttribute = "destination";
public const string HttpResponseStatusAttribute = "httpResponseStatus";
public void LoadHttpRedirectSettings(WebVirtualDirectory virtualDir)
{
using (var srvman = GetServerManager())
public void GetHttpRedirectSettings(ServerManager srvman, WebVirtualDirectory virtualDir)
{
// Load web site configuration
var config = srvman.GetWebConfiguration(virtualDir.FullQualifiedPath);
@ -61,7 +59,6 @@ namespace WebsitePanel.Providers.Web.HttpRedirect
virtualDir.HttpRedirect = Convert.ToString(section.GetAttributeValue(DestinationAttribute));
virtualDir.RedirectPermanent = String.Equals("301", Convert.ToString(section.GetAttributeValue(HttpResponseStatusAttribute)));
}
}
public void SetHttpRedirectSettings(WebVirtualDirectory virtualDir)
{

View file

@ -598,31 +598,31 @@ namespace WebsitePanel.Providers.Web
}
}
private void FillVirtualDirectoryFromIISObject(WebVirtualDirectory virtualDir)
private void FillVirtualDirectoryFromIISObject(ServerManager srvman, WebVirtualDirectory virtualDir)
{
// Set physical path.
virtualDir.ContentPath = webObjectsSvc.GetPhysicalPath(virtualDir);
virtualDir.ContentPath = webObjectsSvc.GetPhysicalPath(srvman, virtualDir);
// load iisDirObject browse
PropertyBag bag = dirBrowseSvc.GetDirectoryBrowseSettings(virtualDir.FullQualifiedPath);
PropertyBag bag = dirBrowseSvc.GetDirectoryBrowseSettings(srvman, virtualDir.FullQualifiedPath);
virtualDir.EnableDirectoryBrowsing = (bool)bag[DirectoryBrowseGlobals.Enabled];
// load anonym auth
bag = anonymAuthSvc.GetAuthenticationSettings(virtualDir.FullQualifiedPath);
bag = anonymAuthSvc.GetAuthenticationSettings(srvman, virtualDir.FullQualifiedPath);
virtualDir.AnonymousUsername = (string)bag[AuthenticationGlobals.AnonymousAuthenticationUserName];
virtualDir.AnonymousUserPassword = (string)bag[AuthenticationGlobals.AnonymousAuthenticationPassword];
virtualDir.EnableAnonymousAccess = (bool)bag[AuthenticationGlobals.Enabled];
// load windows auth
bag = winAuthSvc.GetAuthenticationSettings(virtualDir.FullQualifiedPath);
bag = winAuthSvc.GetAuthenticationSettings(srvman, virtualDir.FullQualifiedPath);
virtualDir.EnableWindowsAuthentication = (bool)bag[AuthenticationGlobals.Enabled];
// load basic auth
basicAuthSvc.GetAuthenticationSettings(virtualDir);
basicAuthSvc.GetAuthenticationSettings(srvman, virtualDir);
// load default docs
virtualDir.DefaultDocs = defaultDocSvc.GetDefaultDocumentSettings(virtualDir.FullQualifiedPath);
virtualDir.DefaultDocs = defaultDocSvc.GetDefaultDocumentSettings(srvman, virtualDir.FullQualifiedPath);
// load classic asp
bag = classicAspSvc.GetClassicAspSettings(virtualDir.FullQualifiedPath);
bag = classicAspSvc.GetClassicAspSettings(srvman, virtualDir.FullQualifiedPath);
virtualDir.EnableParentPaths = (bool)bag[ClassicAspGlobals.EnableParentPaths];
//
virtualDir.IIs7 = true;
@ -643,24 +643,23 @@ namespace WebsitePanel.Providers.Web
classicAspSvc.SetClassicAspSettings(virtualDir);
}
private void FillVirtualDirectoryRestFromIISObject(WebVirtualDirectory virtualDir)
private void FillVirtualDirectoryRestFromIISObject(ServerManager srvman, WebVirtualDirectory virtualDir)
{
// HTTP REDIRECT
httpRedirectSvc.LoadHttpRedirectSettings(virtualDir);
httpRedirectSvc.GetHttpRedirectSettings(srvman, virtualDir);
// HTTP HEADERS
customHeadersSvc.GetCustomHttpHeaders(virtualDir);
customHeadersSvc.GetCustomHttpHeaders(srvman, virtualDir);
// HTTP ERRORS
customErrorsSvc.GetCustomErrors(virtualDir);
customErrorsSvc.GetCustomErrors(srvman, virtualDir);
// MIME MAPPINGS
mimeTypesSvc.GetMimeMaps(virtualDir);
mimeTypesSvc.GetMimeMaps(srvman, virtualDir);
// SCRIPT MAPS
// Load installed script maps.
using (var srvman = handlersSvc.GetServerManager())
{
virtualDir.AspInstalled = false; // not installed
virtualDir.PhpInstalled = ""; // none
virtualDir.PerlInstalled = false; // not installed
@ -699,7 +698,7 @@ namespace WebsitePanel.Providers.Web
if (!String.IsNullOrEmpty(PerlPath) && String.Equals(PerlPath, processor, StringComparison.InvariantCultureIgnoreCase))
virtualDir.PerlInstalled = true;
}
}
//
string fqPath = virtualDir.FullQualifiedPath;
if (!fqPath.EndsWith(@"/"))
@ -707,23 +706,20 @@ namespace WebsitePanel.Providers.Web
//
fqPath += CGI_BIN_FOLDER;
//
HandlerAccessPolicy policy = handlersSvc.GetHandlersAccessPolicy(fqPath);
HandlerAccessPolicy policy = handlersSvc.GetHandlersAccessPolicy(srvman, fqPath);
virtualDir.CgiBinInstalled = (policy & HandlerAccessPolicy.Execute) > 0;
// ASP.NET
FillAspNetSettingsFromIISObject(virtualDir);
FillAspNetSettingsFromIISObject(srvman, virtualDir);
}
private void FillAspNetSettingsFromIISObject(WebVirtualDirectory vdir)
private void FillAspNetSettingsFromIISObject(ServerManager srvman, WebVirtualDirectory vdir)
{
// Read ASP.NET settings
if (String.IsNullOrEmpty(vdir.ApplicationPool))
return;
//
try
{
//
using (var srvman = webObjectsSvc.GetServerManager())
{
var appool = srvman.ApplicationPools[vdir.ApplicationPool];
//
@ -763,7 +759,6 @@ namespace WebsitePanel.Providers.Web
// Assign the result of assesement
vdir.AspNetInstalled = aspNetVersion;
}
}
catch (Exception ex)
{
Log.WriteError(String.Format("Failed to read ASP.NET settings from {0}.", vdir.Name), ex);
@ -780,12 +775,12 @@ namespace WebsitePanel.Providers.Web
//
var dedicatedPools = Array.FindAll<WebAppPool>(aphl.SupportedAppPools.ToArray(),
x => aphl.isolation(x.Mode) == SiteAppPoolMode.Dedicated);
// cleanup app pools
foreach (var item in dedicatedPools)
{
using (var srvman = webObjectsSvc.GetServerManager())
{
//
foreach (var item in dedicatedPools)
{
string poolName = WSHelper.InferAppPoolName(item.Name, siteName, item.Mode);
//
ApplicationPool pool = srvman.ApplicationPools[poolName];
@ -793,9 +788,10 @@ namespace WebsitePanel.Providers.Web
continue;
//
srvman.ApplicationPools.Remove(pool);
//
srvman.CommitChanges();
}
// save changes
srvman.CommitChanges();
}
}
catch (Exception ex)
@ -820,7 +816,7 @@ namespace WebsitePanel.Providers.Web
mimeTypesSvc.SetMimeMaps(virtualDir);
// Revert script mappings to the parent to simplify script mappings cleanup
handlersSvc.InheritScriptMapsFromParent(virtualDir.FullQualifiedPath);
//handlersSvc.InheritScriptMapsFromParent(virtualDir.FullQualifiedPath);
// TO-DO: SCRIPT MAPS
#region ASP script mappings
@ -936,8 +932,11 @@ namespace WebsitePanel.Providers.Web
//
fqPath += CGI_BIN_FOLDER;
string cgiBinPath = Path.Combine(virtualDir.ContentPath, CGI_BIN_FOLDER);
using (ServerManager srvman = webObjectsSvc.GetServerManager())
{
//
HandlerAccessPolicy policy = handlersSvc.GetHandlersAccessPolicy(fqPath);
HandlerAccessPolicy policy = handlersSvc.GetHandlersAccessPolicy(srvman, fqPath);
policy &= ~HandlerAccessPolicy.Execute;
//
if (virtualDir.CgiBinInstalled)
@ -948,9 +947,14 @@ namespace WebsitePanel.Providers.Web
//
policy |= HandlerAccessPolicy.Execute;
}
//
if (FileUtils.DirectoryExists(cgiBinPath))
handlersSvc.SetHandlersAccessPolicy(fqPath, policy);
handlersSvc.SetHandlersAccessPolicy(srvman, fqPath, policy);
// save
srvman.CommitChanges();
}
}
/// <summary>
@ -1025,13 +1029,13 @@ namespace WebsitePanel.Providers.Web
site.ApplicationPool = WSHelper.InferAppPoolName(siteAppPool.Name, site.Name, siteAppPool.Mode);
}
private void CheckEnableWritePermissions(WebVirtualDirectory virtualDir)
private void CheckEnableWritePermissions(ServerManager srvman, WebVirtualDirectory virtualDir)
{
string anonymousUsername = virtualDir.AnonymousUsername;
//
if (virtualDir.DedicatedApplicationPool)
{
ApplicationPool appPool = webObjectsSvc.GetApplicationPool(virtualDir);
ApplicationPool appPool = webObjectsSvc.GetApplicationPool(srvman, virtualDir);
//
if (appPool != null)
anonymousUsername = appPool.ProcessModel.UserName;
@ -1053,39 +1057,59 @@ namespace WebsitePanel.Providers.Web
public override ServerState GetSiteState(string siteId)
{
return webObjectsSvc.GetSiteState(siteId);
using (ServerManager srvman = webObjectsSvc.GetServerManager())
{
return GetSiteState(srvman, siteId);
}
}
public ServerState GetSiteState(ServerManager srvman, string siteId)
{
return webObjectsSvc.GetSiteState(srvman, siteId);
}
public override bool SiteExists(string siteId)
{
return webObjectsSvc.SiteExists(siteId);
using (ServerManager srvman = webObjectsSvc.GetServerManager())
{
return webObjectsSvc.SiteExists(srvman, siteId);
}
}
public override string[] GetSites()
{
return webObjectsSvc.GetSites();
using (ServerManager srvman = webObjectsSvc.GetServerManager())
{
return webObjectsSvc.GetSites(srvman);
}
}
public new string GetSiteId(string siteName)
{
return webObjectsSvc.GetWebSiteNameFromIIS(siteName);
using (ServerManager srvman = webObjectsSvc.GetServerManager())
{
return webObjectsSvc.GetWebSiteNameFromIIS(srvman, siteName);
}
}
public override WebSite GetSite(string siteId)
{
WebSite site = null;
using (ServerManager srvman = webObjectsSvc.GetServerManager())
{
WebAppPoolHelper aphl = new WebAppPoolHelper(ProviderSettings);
//
WebSite site = webObjectsSvc.GetWebSiteFromIIS(siteId);
site = webObjectsSvc.GetWebSiteFromIIS(srvman, siteId);
//
site.Bindings = webObjectsSvc.GetSiteBindings(siteId);
site.Bindings = webObjectsSvc.GetSiteBindings(srvman, siteId);
//
FillVirtualDirectoryFromIISObject(site);
FillVirtualDirectoryFromIISObject(srvman, site);
//
FillVirtualDirectoryRestFromIISObject(site);
FillVirtualDirectoryRestFromIISObject(srvman, site);
// check frontpage
site.FrontPageAvailable = IsFrontPageSystemInstalled();
site.FrontPageInstalled = IsFrontPageInstalled(siteId);
site.FrontPageInstalled = IsFrontPageInstalled(srvman, siteId);
//check ColdFusion
if (IsColdFusionSystemInstalled())
@ -1115,7 +1139,7 @@ namespace WebsitePanel.Providers.Web
site.ColdFusionAvailable = false;
}
site.CreateCFVirtualDirectories = ColdFusionDirectoriesAdded(siteId);
site.CreateCFVirtualDirectories = ColdFusionDirectoriesAdded(srvman, siteId);
//site.ColdFusionInstalled = IsColdFusionEnabledOnSite(GetSiteId(site.Name));
@ -1124,51 +1148,57 @@ namespace WebsitePanel.Providers.Web
//
site.DedicatedApplicationPool = !aphl.is_shared_pool(site.ApplicationPool);
//
CheckEnableWritePermissions(site);
CheckEnableWritePermissions(srvman, site);
//
ReadWebManagementAccessDetails(site);
ReadWebManagementAccessDetails(srvman, site);
//
ReadWebDeployPublishingAccessDetails(site);
//
site.SecuredFoldersInstalled = IsSecuredFoldersInstalled(siteId);
site.SecuredFoldersInstalled = IsSecuredFoldersInstalled(srvman, siteId);
// check Helicon Ape
HeliconApeStatus heliconApeStatus = GetHeliconApeStatus(siteId);
HeliconApeStatus heliconApeStatus = GetHeliconApeStatus(srvman, siteId);
site.HeliconApeInstalled = heliconApeStatus.IsInstalled;
site.HeliconApeEnabled = heliconApeStatus.IsEnabled;
//
site.SiteState = GetSiteState(siteId);
site.SiteState = GetSiteState(srvman, siteId);
//
site.SecuredFoldersInstalled = IsSecuredFoldersInstalled(siteId);
site.SecuredFoldersInstalled = IsSecuredFoldersInstalled(srvman, siteId);
//
site.SiteState = GetSiteState(siteId);
site.SiteState = GetSiteState(srvman, siteId);
//
}
return site;
}
public new string[] GetSitesAccounts(string[] siteIds)
{
List<string> accounts = new List<string>();
//
using (ServerManager srvman = webObjectsSvc.GetServerManager())
{
for (int i = 0; i < siteIds.Length; i++)
{
try
{
accounts.Add((string)anonymAuthSvc.GetAuthenticationSettings(siteIds[i])[AuthenticationGlobals.AnonymousAuthenticationUserName]);
accounts.Add((string)anonymAuthSvc.GetAuthenticationSettings(srvman, siteIds[i])[AuthenticationGlobals.AnonymousAuthenticationUserName]);
}
catch (Exception ex)
{
Log.WriteError(String.Format("Web site {0} is either deleted or doesn't exist", siteIds[i]), ex);
}
}
//
}
return accounts.ToArray();
}
public override ServerBinding[] GetSiteBindings(string siteId)
{
return webObjectsSvc.GetSiteBindings(siteId);
using (ServerManager srvman = webObjectsSvc.GetServerManager())
{
return webObjectsSvc.GetSiteBindings(srvman, siteId);
}
}
public override string CreateSite(WebSite site)
@ -1316,7 +1346,9 @@ namespace WebsitePanel.Providers.Web
}
#region ColdFusion Virtual Directories
if (ColdFusionDirectoriesAdded(site.SiteId))
using (ServerManager srvman = webObjectsSvc.GetServerManager())
{
if (ColdFusionDirectoriesAdded(srvman, site.SiteId))
{
if (!site.CreateCFVirtualDirectories)
{
@ -1331,6 +1363,7 @@ namespace WebsitePanel.Providers.Web
CreateCFVirtualDirectories(site.SiteId);
site.CreateCFVirtualDirectories = true;
}
}
}
#endregion
@ -1428,9 +1461,17 @@ namespace WebsitePanel.Providers.Web
/// <param name="siteId">Site's id to get virtual directories for.</param>
/// <returns>virtual directories that belong to site with supplied id.</returns>
public override WebVirtualDirectory[] GetVirtualDirectories(string siteId)
{
using (ServerManager srvman = webObjectsSvc.GetServerManager())
{
return GetVirtualDirectories(srvman, siteId);
}
}
private WebVirtualDirectory[] GetVirtualDirectories(ServerManager srvman, string siteId)
{
// get all virt dirs
WebVirtualDirectory[] virtDirs = webObjectsSvc.GetVirtualDirectories(siteId);
WebVirtualDirectory[] virtDirs = webObjectsSvc.GetVirtualDirectories(srvman, siteId);
// filter
string sharedToolsFolder = GetMicrosoftSharedFolderPath();
@ -1453,23 +1494,26 @@ namespace WebsitePanel.Providers.Web
/// <param name="directoryName">Directory's name to get description for.</param>
/// <returns>virtual iisDirObject description that belongs to site with supplied id and has specified name.</returns>
public override WebVirtualDirectory GetVirtualDirectory(string siteId, string directoryName)
{
using (ServerManager srvman = webObjectsSvc.GetServerManager())
{
WebAppPoolHelper aphl = new WebAppPoolHelper(ProviderSettings);
//
WebVirtualDirectory webVirtualDirectory = webObjectsSvc.GetVirtualDirectory(siteId, directoryName);
//
this.FillVirtualDirectoryFromIISObject(webVirtualDirectory);
this.FillVirtualDirectoryRestFromIISObject(webVirtualDirectory);
this.FillVirtualDirectoryFromIISObject(srvman, webVirtualDirectory);
this.FillVirtualDirectoryRestFromIISObject(srvman, webVirtualDirectory);
//
webVirtualDirectory.DedicatedApplicationPool = !aphl.is_shared_pool(webVirtualDirectory.ApplicationPool);
//
CheckEnableWritePermissions(webVirtualDirectory);
CheckEnableWritePermissions(srvman, webVirtualDirectory);
//
ReadWebManagementAccessDetails(webVirtualDirectory);
ReadWebManagementAccessDetails(srvman, webVirtualDirectory);
//
ReadWebDeployPublishingAccessDetails(webVirtualDirectory);
//
return webVirtualDirectory;
}
}
/// <summary>
@ -1492,13 +1536,16 @@ namespace WebsitePanel.Providers.Web
directory.ApplicationPool = webSite.ApplicationPool;
// Create record in IIS's configuration.
webObjectsSvc.CreateVirtualDirectory(siteId, directory.VirtualPath, directory.ContentPath);
//
PropertyBag bag = anonymAuthSvc.GetAuthenticationSettings(siteId);
using (ServerManager srvman = webObjectsSvc.GetServerManager())
{
PropertyBag bag = anonymAuthSvc.GetAuthenticationSettings(srvman, siteId);
directory.AnonymousUsername = (string)bag[AuthenticationGlobals.AnonymousAuthenticationUserName];
directory.AnonymousUserPassword = (string)bag[AuthenticationGlobals.AnonymousAuthenticationPassword];
directory.EnableAnonymousAccess = (bool)bag[AuthenticationGlobals.Enabled];
// Update virtual iisDirObject.
this.UpdateVirtualDirectory(siteId, directory);
}
}
/// <summary>
@ -1508,8 +1555,16 @@ namespace WebsitePanel.Providers.Web
/// <param name="iisDirObject">Web iisDirObject that needs to be updated.</param>
public override void UpdateVirtualDirectory(string siteId, WebVirtualDirectory directory)
{
if (this.webObjectsSvc.SiteExists(siteId))
string origPath = null;
using (ServerManager srvman = webObjectsSvc.GetServerManager())
{
if (!this.webObjectsSvc.SiteExists(srvman, siteId))
return;
// get original path
origPath = webObjectsSvc.GetPhysicalPath(srvman, directory);
}
WebAppPoolHelper aphl = new WebAppPoolHelper(ProviderSettings);
//
bool dedicatedPool = !aphl.is_shared_pool(directory.ApplicationPool);
@ -1517,8 +1572,7 @@ namespace WebsitePanel.Providers.Web
SiteAppPoolMode sisMode = dedicatedPool ? SiteAppPoolMode.Dedicated : SiteAppPoolMode.Shared;
//
directory.ParentSiteName = siteId;
//
string origPath = webObjectsSvc.GetPhysicalPath(directory);
// remove unnecessary permissions
// if original folder has been changed
if (String.Compare(origPath, directory.ContentPath, true) != 0)
@ -1537,7 +1591,6 @@ namespace WebsitePanel.Providers.Web
this.FillIISObjectFromVirtualDirectory(directory);
this.FillIISObjectFromVirtualDirectoryRest(directory);
}
}
/// <summary>
/// Deletes virtual iisDirObject within specified site.
@ -1569,7 +1622,12 @@ namespace WebsitePanel.Providers.Web
{
using (var srvman = webObjectsSvc.GetServerManager())
{
//
return IsSecuredFoldersInstalled(srvman, siteId);
}
}
private bool IsSecuredFoldersInstalled(ServerManager srvman, string siteId)
{
var appConfig = srvman.GetApplicationHostConfiguration();
//
var modulesSection = appConfig.GetSection(Constants.ModulesSection, siteId);
@ -1581,17 +1639,24 @@ namespace WebsitePanel.Providers.Web
if (String.Equals(moduleEntry["name"].ToString(), Constants.WEBSITEPANEL_IISMODULES, StringComparison.InvariantCultureIgnoreCase))
return true;
}
}
//
return false;
}
protected override string GetSiteContentPath(string siteId)
{
var webSite = webObjectsSvc.GetWebSiteFromIIS(siteId);
using (var srvman = webObjectsSvc.GetServerManager())
{
return GetSiteContentPath(srvman, siteId);
}
}
protected string GetSiteContentPath(ServerManager srvman, string siteId)
{
var webSite = webObjectsSvc.GetWebSiteFromIIS(srvman, siteId);
//
if (webSite != null)
return webObjectsSvc.GetPhysicalPath(webSite);
return webObjectsSvc.GetPhysicalPath(srvman, webSite);
//
return String.Empty;
}
@ -1603,6 +1668,8 @@ namespace WebsitePanel.Providers.Web
/// <exception cref="System.ApplicationException" />
/// <param name="siteId"></param>
public override void InstallSecuredFolders(string siteId)
{
using (var srvman = webObjectsSvc.GetServerManager())
{
//
if (String.IsNullOrEmpty(siteId))
@ -1610,14 +1677,14 @@ namespace WebsitePanel.Providers.Web
// WebsitePanel.IIsModules works for apps working in Integrated Pipeline mode
#region Switch automatically to the app pool with Integrated Pipeline enabled
var webSite = webObjectsSvc.GetWebSiteFromIIS(siteId);
var webSite = webObjectsSvc.GetWebSiteFromIIS(srvman, siteId);
//
if (webSite == null)
throw new ApplicationException(String.Format("Could not find a web site with the following identifier: {0}.", siteId));
//
var aphl = new WebAppPoolHelper(ProviderSettings);
// Fill ASP.NET settings
FillAspNetSettingsFromIISObject(webSite);
FillAspNetSettingsFromIISObject(srvman, webSite);
//
var currentPool = aphl.match_webapp_pool(webSite);
var dotNetVersion = aphl.dotNetVersion(currentPool.Mode);
@ -1637,8 +1704,7 @@ namespace WebsitePanel.Providers.Web
//
SetWebSiteApplicationPool(webSite, false);
//
using (var srvman = webObjectsSvc.GetServerManager())
{
var iisSiteObject = srvman.Sites[siteId];
iisSiteObject.Applications["/"].ApplicationPoolName = webSite.ApplicationPool;
//
@ -1648,13 +1714,14 @@ namespace WebsitePanel.Providers.Web
#endregion
#region Disable automatically Integrated Windows Authentication
PropertyBag winAuthBag = winAuthSvc.GetAuthenticationSettings(siteId);
//
if ((bool)winAuthBag[AuthenticationGlobals.Enabled])
{
//
using (var srvman = webObjectsSvc.GetServerManager())
{
PropertyBag winAuthBag = winAuthSvc.GetAuthenticationSettings(srvman, siteId);
//
if ((bool)winAuthBag[AuthenticationGlobals.Enabled])
{
Configuration config = srvman.GetApplicationHostConfiguration();
ConfigurationSection windowsAuthenticationSection = config.GetSection(
@ -1731,23 +1798,30 @@ namespace WebsitePanel.Providers.Web
#region Helicon Ape
public override HeliconApeStatus GetHeliconApeStatus(string siteId)
{
using (ServerManager srvman = webObjectsSvc.GetServerManager())
{
return GetHeliconApeStatus(srvman, siteId);
}
}
private HeliconApeStatus GetHeliconApeStatus(ServerManager srvman, string siteId)
{
string installDir = GetHeliconApeInstallDir(siteId);
string registrationInfo = GetRegistrationInfo(siteId, installDir);
return new HeliconApeStatus {
IsEnabled = IsHeliconApeEnabled(siteId),
return new HeliconApeStatus
{
IsEnabled = IsHeliconApeEnabled(srvman, siteId),
InstallDir = installDir,
IsInstalled = IsHeliconApeInstalled(siteId, installDir),
IsInstalled = IsHeliconApeInstalled(srvman, siteId, installDir),
Version = GetHeliconApeVersion(siteId, installDir),
IsRegistered = IsHeliconApeRegistered(siteId, registrationInfo),
RegistrationInfo = registrationInfo
};
}
private bool IsHeliconApeEnabled(string siteId)
{
using (var srvman = webObjectsSvc.GetServerManager())
private bool IsHeliconApeEnabled(ServerManager srvman, string siteId)
{
var appConfig = srvman.GetApplicationHostConfiguration();
var modulesSection = appConfig.GetSection(Constants.ModulesSection, siteId);
@ -1758,7 +1832,6 @@ namespace WebsitePanel.Providers.Web
if (String.Equals(moduleEntry["name"].ToString(), Constants.HeliconApeModule, StringComparison.InvariantCultureIgnoreCase))
return true;
}
}
//
return false;
@ -1794,10 +1867,14 @@ namespace WebsitePanel.Providers.Web
private void RemoveDelegationRulesRestrictions(string siteName, string accountName)
{
WebSite webSite = null;
using (ServerManager srvman = webObjectsSvc.GetServerManager())
{
webSite = webObjectsSvc.GetWebSiteFromIIS(srvman, siteName);
}
var moduleService = new DelegationRulesModuleService();
// Adjust web publishing permissions to the user accordingly to deny some rules for shared app pools
var webSite = webObjectsSvc.GetWebSiteFromIIS(siteName);
//
var fqUsername = GetFullQualifiedAccountName(accountName);
// Instantiate application pool helper to retrieve the app pool mode web site is running in
WebAppPoolHelper aphl = new WebAppPoolHelper(ProviderSettings);
@ -1814,10 +1891,14 @@ namespace WebsitePanel.Providers.Web
public void EnforceDelegationRulesRestrictions(string siteName, string accountName)
{
WebSite webSite = null;
using (ServerManager srvman = webObjectsSvc.GetServerManager())
{
webSite = webObjectsSvc.GetWebSiteFromIIS(srvman, siteName);
}
var moduleService = new DelegationRulesModuleService();
// Adjust web publishing permissions to the user accordingly to deny some rules for shared app pools
var webSite = webObjectsSvc.GetWebSiteFromIIS(siteName);
//
var fqUsername = GetFullQualifiedAccountName(accountName);
// Instantiate application pool helper to retrieve the app pool mode web site is running in
WebAppPoolHelper aphl = new WebAppPoolHelper(ProviderSettings);
@ -1843,7 +1924,7 @@ namespace WebsitePanel.Providers.Web
return Registry.GetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\Helicon\\Ape", "InstallDir", string.Empty) as string;
}
private bool IsHeliconApeInstalled(string siteId, string installDir)
private bool IsHeliconApeInstalled(ServerManager srvman, string siteId, string installDir)
{
//Check global registration
bool result = !string.IsNullOrEmpty(installDir);
@ -1851,7 +1932,7 @@ namespace WebsitePanel.Providers.Web
if (!result && !string.IsNullOrEmpty(siteId))
{
//Check per-site installation
string sitepath = GetSiteContentPath(siteId);
string sitepath = GetSiteContentPath(srvman, siteId);
string dllPath = Path.Combine(sitepath, "Bin\\Helicon.Ape.dll");
result = File.Exists(dllPath);
@ -1981,22 +2062,27 @@ namespace WebsitePanel.Providers.Web
}
public override void EnableHeliconApe(string siteId)
{
WebSite webSite = null;
using (ServerManager srvman = webObjectsSvc.GetServerManager())
{
//
if (String.IsNullOrEmpty(siteId))
throw new ArgumentNullException("siteId");
// Helicon.Ape.ApeModule works for apps working in Integrated Pipeline mode
#region Switch automatically to the app pool with Integrated Pipeline enabled
var webSite = webObjectsSvc.GetWebSiteFromIIS(siteId);
// Switch automatically to the app pool with Integrated Pipeline enabled
webSite = webObjectsSvc.GetWebSiteFromIIS(srvman, siteId);
//
if (webSite == null)
throw new ApplicationException(String.Format("Could not find a web site with the following identifier: {0}.", siteId));
// Fill ASP.NET settings
FillAspNetSettingsFromIISObject(srvman, webSite);
}
//
var aphl = new WebAppPoolHelper(ProviderSettings);
// Fill ASP.NET settings
FillAspNetSettingsFromIISObject(webSite);
//
var currentPool = aphl.match_webapp_pool(webSite);
var dotNetVersion = aphl.dotNetVersion(currentPool.Mode);
var sisMode = aphl.isolation(currentPool.Mode);
@ -2023,15 +2109,13 @@ namespace WebsitePanel.Providers.Web
srvman.CommitChanges();
}
}
#endregion
#region Disable automatically Integrated Windows Authentication
PropertyBag winAuthBag = winAuthSvc.GetAuthenticationSettings(siteId);
using (var srvman = webObjectsSvc.GetServerManager())
{
PropertyBag winAuthBag = winAuthSvc.GetAuthenticationSettings(srvman, siteId);
//
if ((bool)winAuthBag[AuthenticationGlobals.Enabled])
{
//
using (var srvman = webObjectsSvc.GetServerManager())
{
Configuration config = srvman.GetApplicationHostConfiguration();
@ -2255,7 +2339,7 @@ namespace WebsitePanel.Providers.Web
return string.Format("{0}:{1}", user.Realm, PasswdHelper.DigestEncode(user.Name, user.Password, user.Realm));
}
public List<HtaccessUser> GetHeliconApeUsers(string siteId)
public override List<HtaccessUser> GetHeliconApeUsers(string siteId)
{
string rootPath = GetSiteContentPath(siteId);
List<HtaccessUser> users = new List<HtaccessUser>();
@ -2284,7 +2368,7 @@ namespace WebsitePanel.Providers.Web
return users;
}
public HtaccessUser GetHeliconApeUser(string siteId, string userName)
public override HtaccessUser GetHeliconApeUser(string siteId, string userName)
{
// load users file
string rootPath = GetSiteContentPath(siteId);
@ -2348,7 +2432,7 @@ namespace WebsitePanel.Providers.Web
return user;
}
public void UpdateHeliconApeUser(string siteId, HtaccessUser user)
public override void UpdateHeliconApeUser(string siteId, HtaccessUser user)
{
UpdateHeliconApeUser(siteId, user, false);
}
@ -2462,7 +2546,7 @@ namespace WebsitePanel.Providers.Web
HtaccessFolder.WriteLinesFile(groupsPath, groupLines);
}
public void DeleteHeliconApeUser(string siteId, string userName)
public override void DeleteHeliconApeUser(string siteId, string userName)
{
string rootPath = GetSiteContentPath(siteId);
HtaccessUser user = new HtaccessUser();
@ -2477,7 +2561,7 @@ namespace WebsitePanel.Providers.Web
#endregion
#region Secured Helicon Ape Groups
public List<WebGroup> GetHeliconApeGroups(string siteId)
public override List<WebGroup> GetHeliconApeGroups(string siteId)
{
string rootPath = GetSiteContentPath(siteId);
List<WebGroup> groups = new List<WebGroup>();
@ -2502,7 +2586,7 @@ namespace WebsitePanel.Providers.Web
return groups;
}
public WebGroup GetHeliconApeGroup(string siteId, string groupName)
public override WebGroup GetHeliconApeGroup(string siteId, string groupName)
{
string rootPath = GetSiteContentPath(siteId);
// open groups file
@ -2531,7 +2615,7 @@ namespace WebsitePanel.Providers.Web
return group;
}
public void UpdateHeliconApeGroup(string siteId, WebGroup group)
public override void UpdateHeliconApeGroup(string siteId, WebGroup group)
{
UpdateHeliconApeGroup(siteId, group, false);
}
@ -2581,7 +2665,7 @@ namespace WebsitePanel.Providers.Web
HtaccessFolder.WriteLinesFile(groupsPath, updatedGroups);
}
public void DeleteHeliconApeGroup(string siteId, string groupName)
public override void DeleteHeliconApeGroup(string siteId, string groupName)
{
string rootPath = GetSiteContentPath(siteId);
@ -2599,9 +2683,17 @@ namespace WebsitePanel.Providers.Web
#region FrontPage
public override bool IsFrontPageInstalled(string siteId)
{
using (ServerManager srvman = webObjectsSvc.GetServerManager())
{
return IsFrontPageInstalled(srvman, siteId);
}
}
private bool IsFrontPageInstalled(ServerManager srvman, string siteId)
{
// Get IIS web site id
string m_webSiteId = webObjectsSvc.GetWebSiteIdFromIIS(siteId, "W3SVC/{0}");
string m_webSiteId = webObjectsSvc.GetWebSiteIdFromIIS(srvman, siteId, "W3SVC/{0}");
// site port
RegistryKey sitePortKey = Registry.LocalMachine.OpenSubKey(String.Format("{0}Port /LM/{1}:",
FRONTPAGE_PORT_REGLOC, m_webSiteId));
@ -2622,9 +2714,11 @@ namespace WebsitePanel.Providers.Web
// Ensure requested user account doesn't exist
if (SecurityUtils.UserExists(username, ServerSettings, UsersOU))
return false;
// Ensure a web site exists
if (!SiteExists(siteId))
return false;
// create user account
SystemUser user = new SystemUser
{
@ -2643,10 +2737,12 @@ namespace WebsitePanel.Providers.Web
try
{
using (ServerManager srvman = webObjectsSvc.GetServerManager())
{
string cmdPath = null;
string cmdArgs = null;
//
string m_webSiteId = webObjectsSvc.GetWebSiteIdFromIIS(siteId, null);
string m_webSiteId = webObjectsSvc.GetWebSiteIdFromIIS(srvman, siteId, null);
// try to install FPSE2002
// add registry key for anonymous group if not exists
@ -2676,12 +2772,11 @@ namespace WebsitePanel.Providers.Web
Log.WriteInfo("FPSE2002 Install Log: " + FileUtils.ExecuteSystemCommand(cmdPath, cmdArgs));
#endregion
}
#region Enable Windows Authentication mode
// Enable Windows Authentication mode
winAuthSvc.SetEnabled(siteId, true);
#endregion
}
catch (Exception ex)
{
@ -2694,14 +2789,16 @@ namespace WebsitePanel.Providers.Web
}
public override void UninstallFrontPage(string siteId, string username)
{
using (ServerManager srvman = webObjectsSvc.GetServerManager())
{
// Ensure a web site exists
if (!SiteExists(siteId))
if (!webObjectsSvc.SiteExists(srvman, siteId))
return;
try
{
string m_webSiteId = webObjectsSvc.GetWebSiteIdFromIIS(siteId, null);
string m_webSiteId = webObjectsSvc.GetWebSiteIdFromIIS(srvman, siteId, null);
// remove anonymous group
string groupName = "anonfp_" + m_webSiteId;
@ -2733,6 +2830,7 @@ namespace WebsitePanel.Providers.Web
{
Log.WriteError(String.Format("FPSE2002 uninstall error. Web site: {0}.", siteId), ex);
}
}
}
public override bool IsFrontPageSystemInstalled()
@ -2802,11 +2900,11 @@ namespace WebsitePanel.Providers.Web
}
public bool ColdFusionDirectoriesAdded(string siteId)
public bool ColdFusionDirectoriesAdded(ServerManager srvman, string siteId)
{
int identifier = 0;
WebVirtualDirectory[] dirs = GetVirtualDirectories(siteId);
WebVirtualDirectory[] dirs = GetVirtualDirectories(srvman, siteId);
foreach (WebVirtualDirectory dir in dirs)
{
@ -2820,7 +2918,9 @@ namespace WebsitePanel.Providers.Web
{
bool isCFenabled = false;
string ID = webObjectsSvc.GetWebSiteIdFromIIS(siteId, "{0}");
using (ServerManager srvman = webObjectsSvc.GetServerManager())
{
string ID = webObjectsSvc.GetWebSiteIdFromIIS(srvman, siteId, "{0}");
if (IsColdFusionSystemInstalled())
{
@ -2841,6 +2941,7 @@ namespace WebsitePanel.Providers.Web
}
return isCFenabled;
}
}
#endregion
@ -2849,7 +2950,10 @@ namespace WebsitePanel.Providers.Web
public override SettingPair[] GetProviderDefaultSettings()
{
List<SettingPair> allSettings = new List<SettingPair>();
allSettings.AddRange(extensionsSvc.GetISAPIExtensionsInstalled());
using (ServerManager srvman = webObjectsSvc.GetServerManager())
{
allSettings.AddRange(extensionsSvc.GetISAPIExtensionsInstalled(srvman));
// add default web management settings
WebManagementServiceSettings wmSettings = GetWebManagementServiceSettings();
@ -2858,6 +2962,7 @@ namespace WebsitePanel.Providers.Web
allSettings.Add(new SettingPair("WmSvc.Port", wmSettings.Port));
allSettings.Add(new SettingPair("WmSvc.ServiceUrl", wmSettings.ServiceUrl));
allSettings.Add(new SettingPair("WmSvc.RequiresWindowsCredentials", wmSettings.RequiresWindowsCredentials.ToString()));
}
}
// return settings
@ -3315,7 +3420,7 @@ namespace WebsitePanel.Providers.Web
get { return ProviderSettings["WmSvc.CredentialsMode"]; }
}
public new bool CheckWebManagementAccountExists(string accountName)
public override bool CheckWebManagementAccountExists(string accountName)
{
// Preserve setting to restore it back
bool adEnabled = ServerSettings.ADEnabled;
@ -3336,7 +3441,7 @@ namespace WebsitePanel.Providers.Web
}
}
public new ResultObject CheckWebManagementPasswordComplexity(string accountPassword)
public override ResultObject CheckWebManagementPasswordComplexity(string accountPassword)
{
// Preserve setting to restore it back
bool adEnabled = ServerSettings.ADEnabled;
@ -3365,7 +3470,7 @@ namespace WebsitePanel.Providers.Web
return result;
}
public new void GrantWebManagementAccess(string siteName, string accountName, string accountPassword)
public override void GrantWebManagementAccess(string siteName, string accountName, string accountPassword)
{
// Remote Management Access feature requires Modify permissions on the web site's wwwroot folder
GrantWebManagementAccessInternally(siteName, accountName, accountPassword, NTFSPermission.Modify);
@ -3415,12 +3520,14 @@ namespace WebsitePanel.Providers.Web
//
Log.WriteInfo("FQ Account Name: {0};", accountName);
}
using (ServerManager srvman = webObjectsSvc.GetServerManager())
{
//
ManagementAuthorization.Grant(accountName, fqWebPath, false);
//
WebSite site = webObjectsSvc.GetWebSiteFromIIS(siteName);
WebSite site = webObjectsSvc.GetWebSiteFromIIS(srvman, siteName);
//
string contentPath = webObjectsSvc.GetPhysicalPath(site);
string contentPath = webObjectsSvc.GetPhysicalPath(srvman, site);
//
Log.WriteInfo("Site Content Path: {0};", contentPath);
//
@ -3435,9 +3542,10 @@ namespace WebsitePanel.Providers.Web
// Restore setting back
ServerSettings.ADEnabled = adEnabled;
}
}
public new void ChangeWebManagementAccessPassword(string accountName, string accountPassword)
public override void ChangeWebManagementAccessPassword(string accountName, string accountPassword)
{
// Preserve setting to restore it back
bool adEnabled = ServerSettings.ADEnabled;
@ -3465,7 +3573,7 @@ namespace WebsitePanel.Providers.Web
ServerSettings.ADEnabled = adEnabled;
}
public new void RevokeWebManagementAccess(string siteName, string accountName)
public override void RevokeWebManagementAccess(string siteName, string accountName)
{
// Preserve setting to restore it back
bool adEnabled = ServerSettings.ADEnabled;
@ -3477,10 +3585,13 @@ namespace WebsitePanel.Providers.Web
// Trace input parameters
Log.WriteInfo("Site Name: {0}; Account Name: {1}; FqWebPath: {2};",
siteName, accountName, fqWebPath);
using (ServerManager srvman = webObjectsSvc.GetServerManager())
{
//
WebSite site = webObjectsSvc.GetWebSiteFromIIS(siteName);
WebSite site = webObjectsSvc.GetWebSiteFromIIS(srvman, siteName);
//
string contentPath = webObjectsSvc.GetPhysicalPath(site);
string contentPath = webObjectsSvc.GetPhysicalPath(srvman, site);
//
Log.WriteInfo("Site Content Path: {0};", contentPath);
// Revoke access permissions
@ -3498,6 +3609,7 @@ namespace WebsitePanel.Providers.Web
}
// Restore setting back
ServerSettings.ADEnabled = adEnabled;
}
}
private void ReadWebDeployPublishingAccessDetails(WebVirtualDirectory iisObject)
@ -3533,7 +3645,7 @@ namespace WebsitePanel.Providers.Web
private bool? isWmSvcInstalled;
protected void ReadWebManagementAccessDetails(WebVirtualDirectory iisObject)
protected void ReadWebManagementAccessDetails(ServerManager srvman, WebVirtualDirectory iisObject)
{
bool wmSvcAvailable = IsWebManagementServiceInstalled();
//
@ -3546,12 +3658,10 @@ namespace WebsitePanel.Providers.Web
WebVirtualDirectory.WmSvcSiteEnabled,
IsWebManagementAccessEnabled(iisObject));
using (var serverManager = webObjectsSvc.GetServerManager())
{
//
string fqWebPath = @"/" + iisObject.FullQualifiedPath;
//
Configuration config = serverManager.GetAdministrationConfiguration();
Configuration config = srvman.GetAdministrationConfiguration();
ConfigurationSection authorizationSection = config.GetSection("system.webServer/management/authorization");
ConfigurationElementCollection authorizationRulesCollection = authorizationSection.GetCollection("authorizationRules");
@ -3578,7 +3688,6 @@ namespace WebsitePanel.Providers.Web
}
}
}
}
protected ConfigurationElement FindElement(ConfigurationElementCollection collection, string elementTagName, params string[] keyValues)
{

View file

@ -44,9 +44,7 @@ namespace WebsitePanel.Providers.Web.MimeTypes
/// Loads available mime maps into supplied virtual iisDirObject description.
/// </summary>
/// <param name="vdir">Virtual iisDirObject description.</param>
public void GetMimeMaps(WebVirtualDirectory virtualDir)
{
using (var srvman = GetServerManager())
public void GetMimeMaps(ServerManager srvman, WebVirtualDirectory virtualDir)
{
var config = srvman.GetWebConfiguration(virtualDir.FullQualifiedPath);
//
@ -66,7 +64,6 @@ namespace WebsitePanel.Providers.Web.MimeTypes
//
virtualDir.MimeMaps = mappings.ToArray();
}
}
/// <summary>
/// Saves mime types from virtual iisDirObject description into configuration file.

View file

@ -53,8 +53,7 @@ namespace WebsitePanel.Providers.Web.Iis
CX500DistinguishedName dn = new CX500DistinguishedName();
CX509Enrollment enroll = new CX509Enrollment();
CObjectIds objectIds = new CObjectIds();
CObjectId clientObjectId = new CObjectId();
CObjectId serverObjectId = new CObjectId();
CObjectId objectId = new CObjectId();
CX509ExtensionKeyUsage extensionKeyUsage = new CX509ExtensionKeyUsage();
CX509ExtensionEnhancedKeyUsage x509ExtensionEnhancedKeyUsage = new CX509ExtensionEnhancedKeyUsage();
@ -66,11 +65,14 @@ namespace WebsitePanel.Providers.Web.Iis
csPs.Add(csp);
// Provide key container name, key length and key spec to the private key object
//objPrivateKey.ContainerName = "AlejaCMa";
privateKey.Length = cert.CSRLength;
privateKey.KeySpec = X509KeySpec.XCN_AT_SIGNATURE;
privateKey.KeySpec = X509KeySpec.XCN_AT_KEYEXCHANGE;
privateKey.KeyUsage = X509PrivateKeyUsageFlags.XCN_NCRYPT_ALLOW_ALL_USAGES;
privateKey.ExportPolicy = X509PrivateKeyExportFlags.XCN_NCRYPT_ALLOW_PLAINTEXT_EXPORT_FLAG | X509PrivateKeyExportFlags.XCN_NCRYPT_ALLOW_EXPORT_FLAG;
privateKey.ExportPolicy =
X509PrivateKeyExportFlags.XCN_NCRYPT_ALLOW_PLAINTEXT_EXPORT_FLAG
| X509PrivateKeyExportFlags.XCN_NCRYPT_ALLOW_ARCHIVING_FLAG
| X509PrivateKeyExportFlags.XCN_NCRYPT_ALLOW_PLAINTEXT_ARCHIVING_FLAG
| X509PrivateKeyExportFlags.XCN_NCRYPT_ALLOW_EXPORT_FLAG;
privateKey.MachineContext = true;
// Provide the CSP collection object (in this case containing only 1 CSP object)
@ -97,10 +99,9 @@ namespace WebsitePanel.Providers.Web.Iis
pkcs10.X509Extensions.Add((CX509Extension)extensionKeyUsage);
// Enhanced Key Usage Extension
clientObjectId.InitializeFromValue("1.3.6.1.5.5.7.3.2");
objectIds.Add(clientObjectId);
serverObjectId.InitializeFromValue("1.3.6.1.5.5.7.3.1");
objectIds.Add(serverObjectId);
objectId.InitializeFromName(CERTENROLLLib.CERTENROLL_OBJECTID.XCN_OID_PKIX_KP_SERVER_AUTH);
objectIds.Add(objectId);
x509ExtensionEnhancedKeyUsage.InitializeEncode(objectIds);
pkcs10.X509Extensions.Add((CX509Extension)x509ExtensionEnhancedKeyUsage);
@ -108,6 +109,9 @@ namespace WebsitePanel.Providers.Web.Iis
string request = String.Format(@"CN={0}, O={1}, OU={2}, L={3}, S={4}, C={5}", cert.Hostname, cert.Organisation, cert.OrganisationUnit, cert.City, cert.State, cert.Country);
dn.Encode(request, X500NameFlags.XCN_CERT_NAME_STR_NONE);
// enable SMIME capabilities
pkcs10.SmimeCapabilities = true;
// Assing the subject name by using the Distinguished Name object initialized above
pkcs10.Subject = dn;
@ -335,7 +339,7 @@ namespace WebsitePanel.Providers.Web.Iis
public void AddBinding(SSLCertificate certificate, WebSite website)
{
using (ServerManager sm = GetServerManager())
using (ServerManager srvman = GetServerManager())
{
// Not sure why do we need to work with X.509 store here, so commented it out and lets see what happens
X509Store store = new X509Store(StoreName.My, StoreLocation.LocalMachine);
@ -344,7 +348,7 @@ namespace WebsitePanel.Providers.Web.Iis
List<ServerBinding> bindings = new List<ServerBinding>();
// Retrieve existing site bindings to figure out what do we have here
WebObjectsModuleService webObjSvc = new WebObjectsModuleService();
bindings.AddRange(webObjSvc.GetSiteBindings(website.SiteId));
bindings.AddRange(webObjSvc.GetSiteBindings(srvman, website.SiteId));
// Look for dedicated ip
bool dedicatedIp = bindings.Exists(binding => String.IsNullOrEmpty(binding.Host) && binding.IP != "*");
//
@ -353,11 +357,11 @@ namespace WebsitePanel.Providers.Web.Iis
bindingInformation = dedicatedIp ? string.Format("{0}:443:", website.SiteIPAddress)
: string.Format("{0}:443:{1}", website.SiteIPAddress, certificate.Hostname);
//
sm.Sites[website.SiteId].Bindings.Add(bindingInformation, certificate.Hash, store.Name);
srvman.Sites[website.SiteId].Bindings.Add(bindingInformation, certificate.Hash, store.Name);
//
store.Close();
//
sm.CommitChanges();
srvman.CommitChanges();
}
}

View file

@ -49,10 +49,7 @@ namespace WebsitePanel.Providers.Web.Iis.WebObjects
public const string ResponseModeAttribute = "responseMode";
public const string PrefixLanguageFilePath = "prefixLanguageFilePath";
public void GetCustomErrors(WebVirtualDirectory virtualDir)
{
//
using (var srvman = GetServerManager())
public void GetCustomErrors(ServerManager srvman, WebVirtualDirectory virtualDir)
{
var config = srvman.GetWebConfiguration(virtualDir.FullQualifiedPath);
//
@ -74,7 +71,6 @@ namespace WebsitePanel.Providers.Web.Iis.WebObjects
//
virtualDir.HttpErrors = errors.ToArray();
}
}
public void SetCustomErrors(WebVirtualDirectory virtualDir)
{

View file

@ -40,9 +40,7 @@ namespace WebsitePanel.Providers.Web.WebObjects
public const string NameAttribute = "name";
public const string ValueAttribute = "value";
public void GetCustomHttpHeaders(WebVirtualDirectory virtualDir)
{
using (var srvman = GetServerManager())
public void GetCustomHttpHeaders(ServerManager srvman, WebVirtualDirectory virtualDir)
{
var config = srvman.GetApplicationHostConfiguration();
//
@ -67,7 +65,6 @@ namespace WebsitePanel.Providers.Web.WebObjects
//
virtualDir.HttpHeaders = headers.ToArray();
}
}
public void SetCustomHttpHeaders(WebVirtualDirectory virtualDir)
{

View file

@ -133,7 +133,7 @@ namespace WebsitePanel.Providers.Web.Iis.WebObjects
//
if (virtualDir.DedicatedApplicationPool)
{
var appPool = GetApplicationPool(virtualDir);
var appPool = GetApplicationPool(srvman, virtualDir);
vdir.UserName = appPool.ProcessModel.UserName;
vdir.Password = appPool.ProcessModel.Password;
}
@ -150,13 +150,11 @@ namespace WebsitePanel.Providers.Web.Iis.WebObjects
}
}
public ApplicationPool GetApplicationPool(WebVirtualDirectory virtualDir)
public ApplicationPool GetApplicationPool(ServerManager srvman, WebVirtualDirectory virtualDir)
{
if (virtualDir == null)
throw new ArgumentNullException("vdir");
// read app pool
using (var srvman = GetServerManager())
{
var appPool = srvman.ApplicationPools[virtualDir.ApplicationPool];
//
if (appPool == null)
@ -164,7 +162,6 @@ namespace WebsitePanel.Providers.Web.Iis.WebObjects
//
return appPool;
}
}
public void CreateApplicationPool(string appPoolName, string appPoolUsername,
string appPoolPassword, string runtimeVersion, bool enable32BitOnWin64,
@ -324,9 +321,7 @@ namespace WebsitePanel.Providers.Web.Iis.WebObjects
}
}
public ServerState GetSiteState(string siteId)
{
using (var srvman = GetServerManager())
public ServerState GetSiteState(ServerManager srvman, string siteId)
{
// ensure website exists
if (srvman.Sites[siteId] == null)
@ -352,19 +347,13 @@ namespace WebsitePanel.Providers.Web.Iis.WebObjects
//
return siteState;
}
}
public bool SiteExists(string siteId)
{
using (var srvman = GetServerManager())
public bool SiteExists(ServerManager srvman, string siteId)
{
return (srvman.Sites[siteId] != null);
}
}
public string[] GetSites()
{
using (var srvman = GetServerManager())
public string[] GetSites(ServerManager srvman)
{
var iisObjects = new List<string>();
//
@ -373,22 +362,16 @@ namespace WebsitePanel.Providers.Web.Iis.WebObjects
//
return iisObjects.ToArray();
}
}
public string GetWebSiteNameFromIIS(string siteName)
{
using (var srvman = GetServerManager())
public string GetWebSiteNameFromIIS(ServerManager srvman, string siteName)
{
if (srvman.Sites[siteName] != null)
return srvman.Sites[siteName].Name;
//
return null;
}
}
public string GetWebSiteIdFromIIS(string siteId, string format)
{
using (var srvman = GetServerManager())
public string GetWebSiteIdFromIIS(ServerManager srvman, string siteId, string format)
{
var iisObject = srvman.Sites[siteId];
// Format string is empty
@ -397,11 +380,8 @@ namespace WebsitePanel.Providers.Web.Iis.WebObjects
//
return String.Format(format, iisObject.Id);
}
}
public WebSite GetWebSiteFromIIS(string siteId)
{
using (var srvman = GetServerManager())
public WebSite GetWebSiteFromIIS(ServerManager srvman, string siteId)
{
var webSite = new WebSite();
//
@ -415,17 +395,14 @@ namespace WebsitePanel.Providers.Web.Iis.WebObjects
webSite[WebSite.IIS7_LOG_EXT_FILE_FIELDS] = iisObject.LogFile.LogExtFileFlags.ToString();
}
// Read instant website id
webSite[WebSite.IIS7_SITE_ID] = GetWebSiteIdFromIIS(siteId, "W3SVC{0}");
webSite[WebSite.IIS7_SITE_ID] = GetWebSiteIdFromIIS(srvman, siteId, "W3SVC{0}");
// Read web site iisAppObject pool name
webSite.ApplicationPool = iisObject.Applications["/"].ApplicationPoolName;
//
return webSite;
}
}
public ServerBinding[] GetSiteBindings(string siteId)
{
using (var srvman = GetServerManager())
public ServerBinding[] GetSiteBindings(ServerManager srvman, string siteId)
{
var iisObject = srvman.Sites[siteId];
// get server bingings
@ -444,7 +421,6 @@ namespace WebsitePanel.Providers.Web.Iis.WebObjects
//
return bindings.ToArray();
}
}
private void SyncWebSiteBindingsChanges(string siteId, ServerBinding[] bindings)
{
@ -486,17 +462,18 @@ namespace WebsitePanel.Providers.Web.Iis.WebObjects
}
public void UpdateSiteBindings(string siteId, ServerBinding[] bindings)
{
using (ServerManager srvman = GetServerManager())
{
// Ensure web site exists
if (!SiteExists(siteId))
if (!SiteExists(srvman, siteId))
return;
}
//
SyncWebSiteBindingsChanges(siteId, bindings);
}
public string GetPhysicalPath(WebVirtualDirectory virtualDir)
{
using (var srvman = GetServerManager())
public string GetPhysicalPath(ServerManager srvman, WebVirtualDirectory virtualDir)
{
string siteId = (virtualDir.ParentSiteName == null)
? virtualDir.Name : virtualDir.ParentSiteName;
@ -521,7 +498,6 @@ namespace WebsitePanel.Providers.Web.Iis.WebObjects
//
return iisDirObject.PhysicalPath;
}
}
public void DeleteApplicationPool(params string[] appPoolNames)
{
@ -552,11 +528,11 @@ namespace WebsitePanel.Providers.Web.Iis.WebObjects
public void DeleteSite(string siteId)
{
if (!SiteExists(siteId))
return;
//
using (var srvman = GetServerManager())
{
if (!SiteExists(srvman, siteId))
return;
//
var indexOf = srvman.Sites.IndexOf(srvman.Sites[siteId]);
srvman.Sites.RemoveAt(indexOf);
@ -565,13 +541,11 @@ namespace WebsitePanel.Providers.Web.Iis.WebObjects
}
}
public WebVirtualDirectory[] GetVirtualDirectories(string siteId)
public WebVirtualDirectory[] GetVirtualDirectories(ServerManager srvman, string siteId)
{
if (!SiteExists(siteId))
if (!SiteExists(srvman, siteId))
return new WebVirtualDirectory[] { };
using (var srvman = GetServerManager())
{
var vdirs = new List<WebVirtualDirectory>();
var iisObject = srvman.Sites[siteId];
//
@ -590,7 +564,6 @@ namespace WebsitePanel.Providers.Web.Iis.WebObjects
//
return vdirs.ToArray();
}
}
public WebVirtualDirectory GetVirtualDirectory(string siteId, string directoryName)
{
@ -601,11 +574,11 @@ namespace WebsitePanel.Providers.Web.Iis.WebObjects
if (String.IsNullOrEmpty(directoryName))
throw new ArgumentNullException("directoryName");
//
if (!SiteExists(siteId))
return null;
//
using (var srvman = GetServerManager())
{
if (!SiteExists(srvman, siteId))
return null;
var site = srvman.Sites[siteId];
//
var vdir = new WebVirtualDirectory
@ -622,11 +595,11 @@ namespace WebsitePanel.Providers.Web.Iis.WebObjects
public void CreateVirtualDirectory(string siteId, string directoryName, string physicalPath)
{
if (!SiteExists(siteId))
throw new ApplicationException();
//
using (var srvman = GetServerManager())
{
if (!SiteExists(srvman, siteId))
throw new ApplicationException();
var iisSiteObject = srvman.Sites[siteId];
var iisAppObject = iisSiteObject.Applications.Add(directoryName, physicalPath);
//
@ -636,11 +609,11 @@ namespace WebsitePanel.Providers.Web.Iis.WebObjects
public bool VirtualDirectoryExists(string siteId, string directoryName)
{
if (!SiteExists(siteId))
return false;
using (var srvman = GetServerManager())
{
if (!SiteExists(srvman, siteId))
return false;
var vdir = new WebVirtualDirectory
{
Name = directoryName,
@ -653,11 +626,11 @@ namespace WebsitePanel.Providers.Web.Iis.WebObjects
public void DeleteVirtualDirectory(WebVirtualDirectory virtualDir)
{
if (!SiteExists(virtualDir.ParentSiteName))
return;
//
using (var srvman = GetServerManager())
{
if (!SiteExists(srvman, virtualDir.ParentSiteName))
return;
var iisSiteObject = srvman.Sites[virtualDir.ParentSiteName];
var iisAppObject = iisSiteObject.Applications[virtualDir.VirtualPath];
//

View file

@ -71,6 +71,7 @@
<Reference Include="System.Data" />
<Reference Include="System.DirectoryServices" />
<Reference Include="System.Management" />
<Reference Include="System.Web" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>

View file

@ -2392,37 +2392,37 @@ namespace WebsitePanel.Providers.Web
throw new NotImplementedException();
}
public List<HtaccessUser> GetHeliconApeUsers(string siteId)
public virtual List<HtaccessUser> GetHeliconApeUsers(string siteId)
{
throw new NotImplementedException();
}
public HtaccessUser GetHeliconApeUser(string siteId, string userName)
public virtual HtaccessUser GetHeliconApeUser(string siteId, string userName)
{
throw new NotImplementedException();
}
public void UpdateHeliconApeUser(string siteId, HtaccessUser user)
public virtual void UpdateHeliconApeUser(string siteId, HtaccessUser user)
{
throw new NotImplementedException();
}
public void DeleteHeliconApeUser(string siteId, string userName)
public virtual void DeleteHeliconApeUser(string siteId, string userName)
{
throw new NotImplementedException();
}
public List<WebGroup> GetHeliconApeGroups(string siteId)
public virtual List<WebGroup> GetHeliconApeGroups(string siteId)
{
throw new NotImplementedException();
}
public WebGroup GetHeliconApeGroup(string siteId, string groupName)
public virtual WebGroup GetHeliconApeGroup(string siteId, string groupName)
{
throw new NotImplementedException();
}
public void UpdateHeliconApeGroup(string siteId, WebGroup group)
public virtual void UpdateHeliconApeGroup(string siteId, WebGroup group)
{
throw new NotImplementedException();
}
@ -2437,7 +2437,7 @@ namespace WebsitePanel.Providers.Web
throw new NotSupportedException();
}
public void DeleteHeliconApeGroup(string siteId, string groupName)
public virtual void DeleteHeliconApeGroup(string siteId, string groupName)
{
throw new NotImplementedException();
}
@ -3630,27 +3630,27 @@ namespace WebsitePanel.Providers.Web
#endregion
#region Remote Management Access
public void GrantWebManagementAccess(string siteName, string accountName, string accountPassword)
public virtual void GrantWebManagementAccess(string siteName, string accountName, string accountPassword)
{
throw new NotSupportedException();
}
public void RevokeWebManagementAccess(string siteName, string accountName)
public virtual void RevokeWebManagementAccess(string siteName, string accountName)
{
throw new NotSupportedException();
}
public void ChangeWebManagementAccessPassword(string accountName, string accountPassword)
public virtual void ChangeWebManagementAccessPassword(string accountName, string accountPassword)
{
throw new NotSupportedException();
}
public bool CheckWebManagementAccountExists(string accountName)
public virtual bool CheckWebManagementAccountExists(string accountName)
{
throw new NotSupportedException();
}
public ResultObject CheckWebManagementPasswordComplexity(string accountPassword)
public virtual ResultObject CheckWebManagementPasswordComplexity(string accountPassword)
{
throw new NotSupportedException();
}

View file

@ -11,8 +11,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
..\..\LICENSE.txt = ..\..\LICENSE.txt
..\..\Readme.htm = ..\..\Readme.htm
..\..\ReleaseNotes.htm = ..\..\ReleaseNotes.htm
VersionInfo.cs = VersionInfo.cs
VersionInfo.vb = VersionInfo.vb
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebsitePanel.Server", "WebsitePanel.Server\WebsitePanel.Server.csproj", "{38C6047C-E447-4CC2-891F-ABE54D4659F3}"

View file

@ -154,7 +154,7 @@ namespace WebsitePanel.Server
Log.WriteEnd("'{0}' CreateVMFromVM", ProviderSettings.ProviderName);
return result;
}
catch (System.TimeoutException ex)
catch (System.TimeoutException)
{
return result;
}

View file

@ -42,7 +42,7 @@
<!-- Perform security check -->
<enabled value="true"/>
<!-- Server password -->
<password value="${installer.server.password}"/>
<password value="Z6JYIY9o9rX3FCWTz0sffYdiLdg="/>
</security>
</websitepanel.server>
<system.web>

View file

@ -121,7 +121,7 @@
<value>&lt;p&gt;When you grant &lt;b&gt;Full Access&lt;/b&gt; permission to a user, that user can open this mailbox and access all of its content.&lt;/p&gt; &lt;br&gt;&lt;p&gt;When you grant &lt;b&gt;Send As&lt;/b&gt; permission to a user, that user can send messages as this mailbox. &lt;/p&gt;&lt;br&gt;&lt;p&gt;We do not recommend to use this setting together “Send on behalf” (“Send as”) it may work unpredictable.&lt;/p&gt;</value>
</data>
<data name="lblGrandPermissions.Text" xml:space="preserve">
<value>Grand this permission to:</value>
<value>Grant this permission to:</value>
</data>
<data name="secSendAs.Text" xml:space="preserve">
<value>Send As</value>

View file

@ -35,7 +35,7 @@
function HighlightRow(chkB)
{
var xState=chkB.checked;
var row = chkB.parentElement.parentElement;
var row = chkB.parentNode.parentNode;
if(xState)
{
row.setAttribute("temp_class", row.className);

View file

@ -68,7 +68,7 @@ namespace WebsitePanel.Portal.ProviderControls
hosts = ES.Services.VPSPC.GetClusters(PanelRequest.ServiceId);
}
}
catch (Exception ex)
catch
{
hosts = null;
}

View file

@ -130,7 +130,7 @@ namespace WebsitePanel.Portal.VPSForPC
btn.Enabled = false;
}
messageBox.ShowErrorMessage("VPS_ERROR_CREATE", new Exception("no templates"));
messageBox.ShowErrorMessage("VPS_ERROR_CREATE", new Exception("no templates", ex));
}
// summary letter e-mail
PackageInfo package = ES.Services.Packages.GetPackage(PanelSecurity.PackageId);

View file

@ -85,7 +85,7 @@ namespace WebsitePanel.Portal.VPSForPC
listOperatingSystems.Enabled = false;
txtVmName.Enabled = false;
btnCreate.Enabled = false;
messageBox.ShowErrorMessage("VPS_ERROR_CREATE", new Exception("no VM"));
messageBox.ShowErrorMessage("VPS_ERROR_CREATE", new Exception("no VM", ex));
}
}

View file

@ -67,12 +67,7 @@ namespace WebsitePanel.Portal.VPSForPC
}
catch (Exception ex)
{
vm = null;
}
if (vm == null)
{
messageBox.ShowErrorMessage("VPS_LOAD_VM_META_ITEM");
messageBox.ShowErrorMessage("VPS_LOAD_VM_META_ITEM", ex);
return;
}

View file

@ -107,15 +107,23 @@ namespace WebsitePanel.Portal
}
}
private void BindListOfAvailableSslDomains(ServerBinding[] siteBindings, SSLCertificate[] siteCertificates)
private void BindListOfAvailableSslDomains(ServerBinding[] siteBindings, SSLCertificate[] siteCertificates, string websiteName = "")
{
lstDomains.Items.Clear();
//
foreach (ServerBinding binding in siteBindings)
{
//
if (binding.IP.ToString().Length > 0 && binding.Host.Length == 0)
{
lstDomains.Items.Add(new ListItem(websiteName, websiteName));
lstDomains.Items.Add(new ListItem(String.Format("www.{0}", websiteName), String.Format("www.{0}", websiteName)));
}
else
{
lstDomains.Items.Add(new ListItem(binding.Host, binding.Host));
}
}
}
public void BindWebItem(WebVirtualDirectory item)
@ -137,7 +145,7 @@ namespace WebsitePanel.Portal
SSLNotInstalled.Visible = true;
//
BindListOfAvailableSslDomains(webSite.Bindings, certificates);
BindListOfAvailableSslDomains(webSite.Bindings, certificates, webSite.Name);
if (certificates.Length > 0)
{
@ -560,7 +568,7 @@ namespace WebsitePanel.Portal
SSLNotInstalled.Visible = true;
//
BindListOfAvailableSslDomains(item.Bindings, certificates);
BindListOfAvailableSslDomains(item.Bindings, certificates, item.Name);
if (certificates.Length > 0)
{

View file

@ -1 +1 @@
%windir%\Microsoft.NET\Framework\v4.0.30319\msbuild.exe build.xml /target:Build /property:BuildConfiguration=Debug /v:d /fileLogger
%windir%\Microsoft.NET\Framework\v4.0.30319\msbuild.exe build.xml /target:Build /property:BuildConfiguration=Debug /v:n /fileLogger

View file

@ -1 +1 @@
%windir%\Microsoft.NET\Framework\v4.0.30319\msbuild.exe build.xml /target:Build /property:BuildConfiguration=Release /v:d /fileLogger
%windir%\Microsoft.NET\Framework\v4.0.30319\msbuild.exe build.xml /target:Build /property:BuildConfiguration=Release /v:n /fileLogger

View file

@ -1,10 +1,10 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="C:\Program Files (x86)\MSBuild\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets"/>
<PropertyGroup>
<Version>1.2.0.0</Version>
<FileVersion>1.2.0.38</FileVersion>
<VersionLabel>1.2.0</VersionLabel>
<ReleaseDate>2011-07-13</ReleaseDate>
<Version>1.2.1.0</Version>
<FileVersion>1.2.1.0</FileVersion>
<VersionLabel>1.2.1</VersionLabel>
<ReleaseDate>2012-01-19</ReleaseDate>
<BuildConfiguration>Release</BuildConfiguration>
<RootFolder>..</RootFolder>
<TrunkFolder>$(RootFolder)\WebsitePanel</TrunkFolder>

View file

@ -1 +1 @@
%windir%\Microsoft.NET\Framework\v4.0.30319\msbuild.exe build.xml /target:Deploy /property:BuildConfiguration=Debug /v:d /fileLogger
%windir%\Microsoft.NET\Framework\v4.0.30319\msbuild.exe build.xml /target:Deploy /property:BuildConfiguration=Debug /v:n /fileLogger

View file

@ -1 +1 @@
%windir%\Microsoft.NET\Framework\v4.0.30319\msbuild.exe build.xml /target:Deploy /property:BuildConfiguration=Release /v:d /fileLogger
%windir%\Microsoft.NET\Framework\v4.0.30319\msbuild.exe build.xml /target:Deploy /property:BuildConfiguration=Release /v:n /fileLogger