RDS Certificate fixes
This commit is contained in:
parent
c7823a993f
commit
f8de8a70d1
12 changed files with 270 additions and 102 deletions
|
@ -122,6 +122,8 @@ namespace WebsitePanel.EnterpriseServer {
|
|||
|
||||
private System.Threading.SendOrPostCallback GetRdsCertificateByServiceIdOperationCompleted;
|
||||
|
||||
private System.Threading.SendOrPostCallback GetRdsCertificateByItemIdOperationCompleted;
|
||||
|
||||
private System.Threading.SendOrPostCallback AddRdsCertificateOperationCompleted;
|
||||
|
||||
/// <remarks/>
|
||||
|
@ -267,6 +269,9 @@ namespace WebsitePanel.EnterpriseServer {
|
|||
/// <remarks/>
|
||||
public event GetRdsCertificateByServiceIdCompletedEventHandler GetRdsCertificateByServiceIdCompleted;
|
||||
|
||||
/// <remarks/>
|
||||
public event GetRdsCertificateByItemIdCompletedEventHandler GetRdsCertificateByItemIdCompleted;
|
||||
|
||||
/// <remarks/>
|
||||
public event AddRdsCertificateCompletedEventHandler AddRdsCertificateCompleted;
|
||||
|
||||
|
@ -2335,6 +2340,47 @@ namespace WebsitePanel.EnterpriseServer {
|
|||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetRdsCertificateByItemId", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
|
||||
public RdsCertificate GetRdsCertificateByItemId(int itemId) {
|
||||
object[] results = this.Invoke("GetRdsCertificateByItemId", new object[] {
|
||||
itemId});
|
||||
return ((RdsCertificate)(results[0]));
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public System.IAsyncResult BeginGetRdsCertificateByItemId(int itemId, System.AsyncCallback callback, object asyncState) {
|
||||
return this.BeginInvoke("GetRdsCertificateByItemId", new object[] {
|
||||
itemId}, callback, asyncState);
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public RdsCertificate EndGetRdsCertificateByItemId(System.IAsyncResult asyncResult) {
|
||||
object[] results = this.EndInvoke(asyncResult);
|
||||
return ((RdsCertificate)(results[0]));
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public void GetRdsCertificateByItemIdAsync(int itemId) {
|
||||
this.GetRdsCertificateByItemIdAsync(itemId, null);
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public void GetRdsCertificateByItemIdAsync(int itemId, object userState) {
|
||||
if ((this.GetRdsCertificateByItemIdOperationCompleted == null)) {
|
||||
this.GetRdsCertificateByItemIdOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetRdsCertificateByItemIdOperationCompleted);
|
||||
}
|
||||
this.InvokeAsync("GetRdsCertificateByItemId", new object[] {
|
||||
itemId}, this.GetRdsCertificateByItemIdOperationCompleted, userState);
|
||||
}
|
||||
|
||||
private void OnGetRdsCertificateByItemIdOperationCompleted(object arg) {
|
||||
if ((this.GetRdsCertificateByItemIdCompleted != null)) {
|
||||
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
|
||||
this.GetRdsCertificateByItemIdCompleted(this, new GetRdsCertificateByItemIdCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/AddRdsCertificate", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
|
||||
public ResultObject AddRdsCertificate(RdsCertificate certificate) {
|
||||
|
@ -3578,6 +3624,32 @@ namespace WebsitePanel.EnterpriseServer {
|
|||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
|
||||
public delegate void GetRdsCertificateByItemIdCompletedEventHandler(object sender, GetRdsCertificateByItemIdCompletedEventArgs e);
|
||||
|
||||
/// <remarks/>
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
|
||||
[System.Diagnostics.DebuggerStepThroughAttribute()]
|
||||
[System.ComponentModel.DesignerCategoryAttribute("code")]
|
||||
public partial class GetRdsCertificateByItemIdCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
|
||||
|
||||
private object[] results;
|
||||
|
||||
internal GetRdsCertificateByItemIdCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
|
||||
base(exception, cancelled, userState) {
|
||||
this.results = results;
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public RdsCertificate Result {
|
||||
get {
|
||||
this.RaiseExceptionIfNecessary();
|
||||
return ((RdsCertificate)(this.results[0]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
|
||||
public delegate void AddRdsCertificateCompletedEventHandler(object sender, AddRdsCertificateCompletedEventArgs e);
|
||||
|
|
|
@ -288,6 +288,11 @@ namespace WebsitePanel.EnterpriseServer
|
|||
return GetRdsCertificateByServiceIdInternal(serviceId);
|
||||
}
|
||||
|
||||
public static RdsCertificate GetRdsCertificateByItemId(int itemId)
|
||||
{
|
||||
return GetRdsCertificateByItemIdInternal(itemId);
|
||||
}
|
||||
|
||||
public static ResultObject AddRdsCertificate(RdsCertificate certificate)
|
||||
{
|
||||
return AddRdsCertificateInternal(certificate);
|
||||
|
@ -346,6 +351,21 @@ namespace WebsitePanel.EnterpriseServer
|
|||
return result;
|
||||
}
|
||||
|
||||
private static RdsCertificate GetRdsCertificateByItemIdInternal(int itemId)
|
||||
{
|
||||
Organization org = OrganizationController.GetOrganization(itemId);
|
||||
|
||||
if (org == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
int serviceId = GetRemoteDesktopServiceID(org.PackageId);
|
||||
var result = ObjectUtils.FillObjectFromDataReader<RdsCertificate>(DataProvider.GetRdsCertificateByServiceId(serviceId));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private static ResultObject AddRdsCertificateInternal(RdsCertificate certificate)
|
||||
{
|
||||
var result = TaskManager.StartResultTask<ResultObject>("REMOTE_DESKTOP_SERVICES", "ADD_RDS_SERVER");
|
||||
|
@ -431,7 +451,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
var organizationUsers = OrganizationController.GetOrganizationUsersPaged(collection.ItemId, null, null, null, 0, Int32.MaxValue).PageUsers;
|
||||
var organizationAdmins = rds.GetRdsCollectionLocalAdmins(org.OrganizationId, collection.Name);
|
||||
|
||||
return organizationUsers.Where(o => organizationAdmins.Select(a => a.ToLower()).Contains(o.DomainUserName.ToLower())).ToList();
|
||||
return organizationUsers.Where(o => organizationAdmins.Select(a => a.ToLower()).Contains(o.SamAccountName.ToLower())).ToList();
|
||||
}
|
||||
|
||||
private static ResultObject SaveRdsCollectionLocalAdminsInternal(OrganizationUser[] users, int collectionId)
|
||||
|
|
|
@ -338,6 +338,12 @@ namespace WebsitePanel.EnterpriseServer
|
|||
return RemoteDesktopServicesController.GetRdsCertificateByServiceId(serviceId);
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public RdsCertificate GetRdsCertificateByItemId(int itemId)
|
||||
{
|
||||
return RemoteDesktopServicesController.GetRdsCertificateByItemId(itemId);
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public ResultObject AddRdsCertificate(RdsCertificate certificate)
|
||||
{
|
||||
|
|
|
@ -48,5 +48,6 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
|
|||
public int? RdsCollectionId { get; set; }
|
||||
public bool ConnectionEnabled { get; set; }
|
||||
public string Status { get; set; }
|
||||
public bool SslAvailable { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -67,13 +67,13 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
|
|||
private const string Admins = "Admins";
|
||||
private const string RdsGroupFormat = "rds-{0}-{1}";
|
||||
private const string RdsModuleName = "RemoteDesktopServices";
|
||||
private const string AddNpsString = "netsh nps add np name=\"\"{0}\"\" policysource=\"1\" processingorder=\"{1}\" conditionid=\"0x3d\" conditiondata=\"^5$\" conditionid=\"0x1fb5\" conditiondata=\"{2}\" conditionid=\"0x1e\" conditiondata=\"UserAuthType:(PW|CA)\" profileid=\"0x1005\" profiledata=\"TRUE\" profileid=\"0x100f\" profiledata=\"TRUE\" profileid=\"0x1009\" profiledata=\"0x7\" profileid=\"0x1fe6\" profiledata=\"0x40000000\"";
|
||||
private const string WspAdministratorsGroupName = "WSP-Org-Administrators";
|
||||
private const string AddNpsString = "netsh nps add np name=\"\"{0}\"\" policysource=\"1\" processingorder=\"{1}\" conditionid=\"0x3d\" conditiondata=\"^5$\" conditionid=\"0x1fb5\" conditiondata=\"{2}\" conditionid=\"0x1e\" conditiondata=\"UserAuthType:(PW|CA)\" profileid=\"0x1005\" profiledata=\"TRUE\" profileid=\"0x100f\" profiledata=\"TRUE\" profileid=\"0x1009\" profiledata=\"0x7\" profileid=\"0x1fe6\" profiledata=\"0x40000000\"";
|
||||
private const string WspAdministratorsGroupDescription = "WSP Org Administrators";
|
||||
private const string RdsServersOU = "RDSServers";
|
||||
private const string RDSHelpDeskComputerGroup = "Websitepanel-RDSHelpDesk-Computer";
|
||||
private const string RDSHelpDeskGroup = "WSP-HelpDeskAdministrators";
|
||||
private const string RDSHelpDeskGroupDescription = "WSP Help Desk Administrators";
|
||||
private const string RDSHelpDeskGroupDescription = "WSP Help Desk Administrators";
|
||||
private const string LocalAdministratorsGroupName = "Administrators";
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -343,13 +343,8 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
|
|||
|
||||
//add session servers to group
|
||||
foreach (var rdsServer in collection.Servers)
|
||||
{
|
||||
if (!CheckLocalAdminsGroupExists(rdsServer.FqdName, runSpace))
|
||||
{
|
||||
CreateLocalAdministratorsGroup(rdsServer.FqdName, runSpace);
|
||||
}
|
||||
|
||||
AddAdGroupToLocalAdmins(runSpace, rdsServer.FqdName, helpDeskGroupSamAccountName);
|
||||
{
|
||||
AddAdGroupToLocalAdmins(runSpace, rdsServer.FqdName, helpDeskGroupSamAccountName);
|
||||
AddComputerToCollectionAdComputerGroup(organizationId, collection.Name, rdsServer);
|
||||
}
|
||||
}
|
||||
|
@ -575,20 +570,11 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
|
|||
ExecuteShellCommand(runSpace, cmd, false);
|
||||
|
||||
CheckOrCreateHelpDeskComputerGroup();
|
||||
string helpDeskGroupSamAccountName = CheckOrCreateAdGroup(GetHelpDeskGroupPath(RDSHelpDeskGroup), GetRootOUPath(), RDSHelpDeskGroup, RDSHelpDeskGroupDescription);
|
||||
|
||||
if (!CheckLocalAdminsGroupExists(server.FqdName, runSpace))
|
||||
{
|
||||
CreateLocalAdministratorsGroup(server.FqdName, runSpace);
|
||||
}
|
||||
string helpDeskGroupSamAccountName = CheckOrCreateAdGroup(GetHelpDeskGroupPath(RDSHelpDeskGroup), GetRootOUPath(), RDSHelpDeskGroup, RDSHelpDeskGroupDescription);
|
||||
|
||||
AddAdGroupToLocalAdmins(runSpace, server.FqdName, helpDeskGroupSamAccountName);
|
||||
AddComputerToCollectionAdComputerGroup(organizationId, collectionName, server);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
CloseRunspace(runSpace);
|
||||
|
@ -1001,18 +987,7 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
|
|||
}
|
||||
|
||||
foreach (var hostName in hosts)
|
||||
{
|
||||
if (!CheckLocalAdminsGroupExists(hostName, runspace))
|
||||
{
|
||||
var errors = CreateLocalAdministratorsGroup(hostName, runspace);
|
||||
|
||||
if (errors.Any())
|
||||
{
|
||||
Log.WriteWarning(string.Join("\r\n", errors.Select(e => e.ToString()).ToArray()));
|
||||
throw new Exception(string.Join("\r\n", errors.Select(e => e.ToString()).ToArray()));
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
AddAdGroupToLocalAdmins(runspace, hostName, helpDeskGroupSamAccountName);
|
||||
AddAdGroupToLocalAdmins(runspace, hostName, localAdminsGroupSamAccountName);
|
||||
|
||||
|
@ -1029,60 +1004,13 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
|
|||
{
|
||||
string groupName = GetLocalAdminsGroupName(collectionName);
|
||||
return GetUsersToCollectionAdGroup(collectionName, groupName, organizationId);
|
||||
}
|
||||
|
||||
private bool CheckLocalAdminsGroupExists(string hostName, Runspace runspace)
|
||||
{
|
||||
var scripts = new List<string>
|
||||
{
|
||||
string.Format("net localgroup {0}", WspAdministratorsGroupName)
|
||||
};
|
||||
|
||||
object[] errors = null;
|
||||
var result = ExecuteRemoteShellCommand(runspace, hostName, scripts, out errors);
|
||||
|
||||
if (!errors.Any())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private object[] CreateLocalAdministratorsGroup(string hostName, Runspace runspace)
|
||||
{
|
||||
var scripts = new List<string>
|
||||
{
|
||||
string.Format("$cn = [ADSI]\"WinNT://{0}\"", hostName),
|
||||
string.Format("$group = $cn.Create(\"Group\", \"{0}\")", WspAdministratorsGroupName),
|
||||
"$group.setinfo()",
|
||||
string.Format("$group.description = \"{0}\"", WspAdministratorsGroupDescription),
|
||||
"$group.setinfo()"
|
||||
};
|
||||
|
||||
object[] errors = null;
|
||||
ExecuteRemoteShellCommand(runspace, hostName, scripts, out errors);
|
||||
|
||||
if (!errors.Any())
|
||||
{
|
||||
scripts = new List<string>
|
||||
{
|
||||
string.Format("$GroupObj = [ADSI]\"WinNT://{0}/Administrators\"", hostName),
|
||||
string.Format("$GroupObj.Add(\"WinNT://{0}/{1}\")", hostName.ToLower().Replace(string.Format(".{0}", ServerSettings.ADRootDomain.ToLower()), ""), WspAdministratorsGroupName)
|
||||
};
|
||||
|
||||
errors = null;
|
||||
ExecuteRemoteShellCommand(runspace, hostName, scripts, out errors);
|
||||
}
|
||||
|
||||
return errors;
|
||||
}
|
||||
}
|
||||
|
||||
private void RemoveGroupFromLocalAdmin(string fqdnName, string hostName, string groupName, Runspace runspace)
|
||||
{
|
||||
var scripts = new List<string>
|
||||
{
|
||||
string.Format("$GroupObj = [ADSI]\"WinNT://{0}/{1}\"", hostName, WspAdministratorsGroupName),
|
||||
string.Format("$GroupObj = [ADSI]\"WinNT://{0}/{1}\"", hostName, LocalAdministratorsGroupName),
|
||||
string.Format("$GroupObj.Remove(\"WinNT://{0}/{1}\")", ServerSettings.ADRootDomain, RDSHelpDeskGroup),
|
||||
string.Format("$GroupObj.Remove(\"WinNT://{0}/{1}\")", ServerSettings.ADRootDomain, groupName)
|
||||
};
|
||||
|
@ -1149,7 +1077,7 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
|
|||
{
|
||||
var scripts = new List<string>
|
||||
{
|
||||
string.Format("$GroupObj = [ADSI]\"WinNT://{0}/{1}\"", hostName, WspAdministratorsGroupName),
|
||||
string.Format("$GroupObj = [ADSI]\"WinNT://{0}/{1}\"", hostName, LocalAdministratorsGroupName),
|
||||
string.Format("$GroupObj.Add(\"WinNT://{0}/{1}\")", ServerSettings.ADRootDomain, samAccountName)
|
||||
};
|
||||
|
||||
|
|
|
@ -57,6 +57,7 @@ namespace WebsitePanel.Portal
|
|||
if (rdsServer.ItemId.HasValue)
|
||||
{
|
||||
rdsServer.Status = ES.Services.RDS.GetRdsServerStatus(rdsServer.ItemId.Value, rdsServer.FqdName);
|
||||
rdsServer.SslAvailable = ES.Services.RDS.GetRdsCertificateByItemId(rdsServer.ItemId.Value) != null;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -129,4 +129,19 @@
|
|||
<data name="lblPFXInstallPassword.Text" xml:space="preserve">
|
||||
<value>Certificate Password:</value>
|
||||
</data>
|
||||
<data name="secCertificateSettings.Text" xml:space="preserve">
|
||||
<value>SSL Certificate</value>
|
||||
</data>
|
||||
<data name="lblSelectFile.Text" xml:space="preserve">
|
||||
<value>Select Certificate:</value>
|
||||
</data>
|
||||
<data name="lblExpiryDate.Text" xml:space="preserve">
|
||||
<value>Expiry Date:</value>
|
||||
</data>
|
||||
<data name="lblIssuedBy.Text" xml:space="preserve">
|
||||
<value>Issued By:</value>
|
||||
</data>
|
||||
<data name="lblSanName.Text" xml:space="preserve">
|
||||
<value>SAN Name:</value>
|
||||
</data>
|
||||
</root>
|
|
@ -1,17 +1,63 @@
|
|||
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="RDS_Settings.ascx.cs" Inherits="WebsitePanel.Portal.ProviderControls.RDS_Settings" %>
|
||||
<table>
|
||||
<tr>
|
||||
<td colspan ="2" style="padding: 10px 0 10px 0;"><asp:FileUpload ID="upPFX" runat="server"/></td>
|
||||
</tr>
|
||||
<tr><td></td></tr>
|
||||
<tr>
|
||||
<td class="SubHead" style="width:200px" nowrap>
|
||||
<asp:Localize runat="server" meta:resourcekey="lblPFXInstallPassword" />
|
||||
</td>
|
||||
<td>
|
||||
<asp:TextBox ID="txtPFXInstallPassword" runat="server" TextMode="Password" Width="200px" />
|
||||
</td>
|
||||
</tr>
|
||||
<%@ Register Src="../UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" TagPrefix="wsp" %>
|
||||
|
||||
<fieldset>
|
||||
<legend>
|
||||
<asp:Label ID="secCertificateSettings" runat="server" meta:resourcekey="secServiceSettings" Text="SSL Certificate" CssClass="NormalBold"></asp:Label>
|
||||
</legend>
|
||||
<table>
|
||||
<tr>
|
||||
<td class="SubHead" style="width:200px" nowrap>
|
||||
<asp:Localize runat="server" meta:resourcekey="lblSelectFile" />
|
||||
</td>
|
||||
<td style="padding: 10px 0 10px 0;"><asp:FileUpload ID="upPFX" onchange="this.form.submit();" runat="server"/></td>
|
||||
</tr>
|
||||
<tr><td></td></tr>
|
||||
<tr>
|
||||
<td class="SubHead" style="width:200px" nowrap>
|
||||
<asp:Localize runat="server" meta:resourcekey="lblPFXInstallPassword" />
|
||||
</td>
|
||||
<td>
|
||||
<asp:TextBox ID="txtPFXInstallPassword" runat="server" TextMode="Password" Width="200px" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<legend>
|
||||
<asp:Label ID="currentCertificate" runat="server" meta:resourcekey="currentCertificate" Text="Current Certificate" CssClass="NormalBold"></asp:Label>
|
||||
</legend>
|
||||
<asp:Panel ID="plCertificateInfo" Visible="false" runat="server">
|
||||
<table>
|
||||
<tr>
|
||||
<td class="SubHead" style="width:200px" nowrap>
|
||||
<asp:Localize runat="server" meta:resourcekey="lblIssuedBy" />
|
||||
</td>
|
||||
<td class="SubHead">
|
||||
<asp:Label ID="lblIssuedBy" runat="server"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="SubHead" style="width:200px" nowrap>
|
||||
<asp:Localize runat="server" meta:resourcekey="lblSanName" />
|
||||
</td>
|
||||
<td class="SubHead">
|
||||
<asp:Label ID="lblSanName" runat="server"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="SubHead" style="width:200px" nowrap>
|
||||
<asp:Localize runat="server" meta:resourcekey="lblExpiryDate" />
|
||||
</td>
|
||||
<td class="SubHead">
|
||||
<asp:Label ID="lblExpiryDate" runat="server"/>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</asp:Panel>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<table>
|
||||
<tr>
|
||||
<td class="SubHead" width="200" nowrap>
|
||||
<asp:Label runat="server" ID="lblConnectionBroker" meta:resourcekey="lblConnectionBroker" Text="Connection Broker:"/>
|
||||
|
@ -84,4 +130,6 @@
|
|||
</asp:GridView>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</table>
|
||||
</fieldset>
|
||||
<br />
|
|
@ -26,8 +26,10 @@
|
|||
// (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 AjaxControlToolkit;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using System.Web.UI.WebControls;
|
||||
using WebsitePanel.EnterpriseServer;
|
||||
using WebsitePanel.Providers.Common;
|
||||
|
@ -39,7 +41,7 @@ namespace WebsitePanel.Portal.ProviderControls
|
|||
{
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
FillCertificateInfo();
|
||||
}
|
||||
|
||||
public string GWServers
|
||||
|
@ -54,6 +56,25 @@ namespace WebsitePanel.Portal.ProviderControls
|
|||
}
|
||||
}
|
||||
|
||||
private void FillCertificateInfo()
|
||||
{
|
||||
var certificate = ES.Services.RDS.GetRdsCertificateByServiceId(PanelRequest.ServiceId);
|
||||
|
||||
if (certificate != null)
|
||||
{
|
||||
var array = Convert.FromBase64String(certificate.Hash);
|
||||
char[] chars = new char[array.Length / sizeof(char)];
|
||||
System.Buffer.BlockCopy(array, 0, chars, 0, array.Length);
|
||||
string password = new string(chars);
|
||||
plCertificateInfo.Visible = true;
|
||||
byte[] content = Convert.FromBase64String(certificate.Content);
|
||||
var x509 = new X509Certificate2(content, password);
|
||||
lblIssuedBy.Text = x509.Issuer.Replace("CN =", "").Replace("OU =", "").Replace("O =", "").Replace("L =", "").Replace("S =", "").Replace("C =", "");
|
||||
lblExpiryDate.Text = x509.NotAfter.ToLongDateString();
|
||||
lblSanName.Text = x509.SubjectName.Name.Replace("CN =", "");
|
||||
}
|
||||
}
|
||||
|
||||
public void BindSettings(System.Collections.Specialized.StringDictionary settings)
|
||||
{
|
||||
txtConnectionBroker.Text = settings["ConnectionBroker"];
|
||||
|
@ -163,7 +184,7 @@ namespace WebsitePanel.Portal.ProviderControls
|
|||
GWServers = str.TrimEnd(';');
|
||||
UpdateLyncServersGrid();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class GWServer
|
||||
|
|
|
@ -12,6 +12,15 @@ namespace WebsitePanel.Portal.ProviderControls {
|
|||
|
||||
public partial class RDS_Settings {
|
||||
|
||||
/// <summary>
|
||||
/// secCertificateSettings control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Label secCertificateSettings;
|
||||
|
||||
/// <summary>
|
||||
/// upPFX control.
|
||||
/// </summary>
|
||||
|
@ -30,6 +39,51 @@ namespace WebsitePanel.Portal.ProviderControls {
|
|||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.TextBox txtPFXInstallPassword;
|
||||
|
||||
/// <summary>
|
||||
/// currentCertificate control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Label currentCertificate;
|
||||
|
||||
/// <summary>
|
||||
/// plCertificateInfo control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Panel plCertificateInfo;
|
||||
|
||||
/// <summary>
|
||||
/// lblIssuedBy control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Label lblIssuedBy;
|
||||
|
||||
/// <summary>
|
||||
/// lblSanName control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Label lblSanName;
|
||||
|
||||
/// <summary>
|
||||
/// lblExpiryDate control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Label lblExpiryDate;
|
||||
|
||||
/// <summary>
|
||||
/// lblConnectionBroker control.
|
||||
/// </summary>
|
||||
|
|
|
@ -84,7 +84,7 @@
|
|||
</asp:TemplateField>
|
||||
<asp:TemplateField>
|
||||
<ItemTemplate>
|
||||
<asp:LinkButton ID="lnkInstallCertificate" runat="server" Text="Certificate" Visible='<%# Eval("ItemId") != null && Eval("Status") != null && Eval("Status").ToString().StartsWith("Online") %>'
|
||||
<asp:LinkButton ID="lnkInstallCertificate" runat="server" Text="Certificate" Visible='<%# Convert.ToBoolean(Eval("SslAvailable")) && Eval("ItemId") != null && Eval("Status") != null && Eval("Status").ToString().StartsWith("Online") %>'
|
||||
CommandName="InstallCertificate" CommandArgument='<%# Eval("Id") %>' ToolTip="Repair Certificate"
|
||||
OnClientClick="if(confirm('Are you sure you want to install certificate?')) ShowProgressDialog('Installing certificate...'); else return false;"></asp:LinkButton>
|
||||
</ItemTemplate>
|
||||
|
|
|
@ -5865,7 +5865,9 @@
|
|||
</Content>
|
||||
<Content Include="RDS\UserControls\App_LocalResources\RDSCollectionUsers.ascx.resx" />
|
||||
<Content Include="RDS\UserControls\App_LocalResources\RDSCollectionServers.ascx.resx" />
|
||||
<Content Include="RDS\UserControls\App_LocalResources\RDSCollectionApps.ascx.resx" />
|
||||
<Content Include="RDS\UserControls\App_LocalResources\RDSCollectionApps.ascx.resx">
|
||||
<SubType>Designer</SubType>
|
||||
</Content>
|
||||
<Content Include="ProviderControls\App_LocalResources\RDS_Settings.ascx.resx" />
|
||||
<Content Include="UserControls\App_LocalResources\DomainControl.ascx.resx">
|
||||
<SubType>Designer</SubType>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue