RDS Certificate fixes
This commit is contained in:
parent
c7823a993f
commit
f8de8a70d1
12 changed files with 270 additions and 102 deletions
|
@ -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