Skip to content

Commit 909fcc4

Browse files
committed
Enable ssl connection without host verify
1 parent f2692af commit 909fcc4

File tree

4 files changed

+16
-0
lines changed

4 files changed

+16
-0
lines changed

ClientLib/CoreClient.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,11 @@ protected void SetAddress(string url)
104104
/// </summary>
105105
protected void CreateConnection(ConnectionOptions options)
106106
{
107+
if (options.ConnSSL)
108+
{
109+
Connection.DisableServerCertValidation = true;
110+
this.address = new Address(options.Url.Replace("amqp://", "amqps://"));
111+
}
107112
Open open = new Open()
108113
{
109114
ContainerId = Guid.NewGuid().ToString()

ClientLib/OptionsParser.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ public abstract class ConnectionOptions : Options
6565
public int Heartbeat { get; protected set; }
6666
public string AuthMech { get; protected set; }
6767
public int FrameSize { get; private set; }
68+
public bool ConnSSL { get; protected set; }
6869

6970
/// <summary>
7071
/// Constructor
@@ -86,6 +87,8 @@ public ConnectionOptions() : base()
8687
(string authMech) => { this.AuthMech = authMech; });
8788
this.Add("conn-max-frame-size=", "Set connection max frame size",
8889
(int frameSize) => { this.FrameSize = frameSize; });
90+
this.Add("conn-ssl=", "Enable ssl connection without verify host adn enable trustAll",
91+
(bool connSSL) => { this.ConnSSL = connSSL; });
8992
}
9093
}
9194

ClientLibNetCore/CoreClient.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,11 @@ protected void SetAddress(string url)
102102
/// </summary>
103103
protected void CreateConnection(ConnectionOptions options)
104104
{
105+
if (options.ConnSSL)
106+
{
107+
Connection.DisableServerCertValidation = true;
108+
this.address = new Address(options.Url.Replace("amqp://", "amqps://"));
109+
}
105110
Open open = new Open()
106111
{
107112
ContainerId = Guid.NewGuid().ToString()

ClientLibNetCore/OptionsParser.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ public abstract class ConnectionOptions : Options
6565
public int Heartbeat { get; protected set; }
6666
public string AuthMech { get; protected set; }
6767
public int FrameSize { get; private set; }
68+
public bool ConnSSL { get; protected set; }
6869

6970
/// <summary>
7071
/// Constructor
@@ -86,6 +87,8 @@ public ConnectionOptions() : base()
8687
(string authMech) => { this.AuthMech = authMech; });
8788
this.Add("conn-max-frame-size=", "Set connection max frame size",
8889
(int frameSize) => { this.FrameSize = frameSize; });
90+
this.Add("conn-ssl=", "Enable ssl connection without verify host adn enable trustAll",
91+
(bool connSSL) => { this.ConnSSL = connSSL; });
8992
}
9093
}
9194

0 commit comments

Comments
 (0)