From b4d1666cc8ed408633e312c0d1c1a8860667441d Mon Sep 17 00:00:00 2001 From: justcoding121 Date: Wed, 21 Nov 2018 09:41:48 -0500 Subject: [PATCH 1/4] correct timeline --- src/Titanium.Web.Proxy/RequestHandler.cs | 2 -- src/Titanium.Web.Proxy/ResponseHandler.cs | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Titanium.Web.Proxy/RequestHandler.cs b/src/Titanium.Web.Proxy/RequestHandler.cs index 794eee22a..347e90bfa 100644 --- a/src/Titanium.Web.Proxy/RequestHandler.cs +++ b/src/Titanium.Web.Proxy/RequestHandler.cs @@ -300,8 +300,6 @@ await handleWebSocketUpgrade(httpCmd, args, args.HttpClient.Request, return false; } - args.TimeLine["Connection Ready"] = DateTime.Now; - // construct the web request that we are going to issue on behalf of the client. await handleHttpSessionRequest(connection, args); return true; diff --git a/src/Titanium.Web.Proxy/ResponseHandler.cs b/src/Titanium.Web.Proxy/ResponseHandler.cs index c3891d530..974c8160f 100644 --- a/src/Titanium.Web.Proxy/ResponseHandler.cs +++ b/src/Titanium.Web.Proxy/ResponseHandler.cs @@ -130,6 +130,8 @@ await args.CopyResponseBodyAsync(clientStreamWriter, TransformationMode.None, } } + args.TimeLine["Response Sent"] = DateTime.Now; + } /// From 315d3e20e5f6998395dfa618fb42ff4576b17f31 Mon Sep 17 00:00:00 2001 From: justcoding121 Date: Fri, 23 Nov 2018 15:07:06 -0500 Subject: [PATCH 2/4] remove duplicate timeline set --- src/Titanium.Web.Proxy/RequestHandler.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Titanium.Web.Proxy/RequestHandler.cs b/src/Titanium.Web.Proxy/RequestHandler.cs index 347e90bfa..73e96931e 100644 --- a/src/Titanium.Web.Proxy/RequestHandler.cs +++ b/src/Titanium.Web.Proxy/RequestHandler.cs @@ -380,7 +380,6 @@ await args.HttpClient.SendRequest(Enable100ContinueBehaviour, args.IsTransparent await handleHttpSessionResponse(args); } - args.TimeLine["Response Sent"] = DateTime.Now; } /// From b0d2cd22ae697ed2c191a73bb2540ee69668925a Mon Sep 17 00:00:00 2001 From: justcoding121 Date: Thu, 6 Dec 2018 19:13:00 -0500 Subject: [PATCH 3/4] #529 let generic certificate override in transparent endpoint --- src/Titanium.Web.Proxy/Models/ExplicitProxyEndPoint.cs | 5 ----- src/Titanium.Web.Proxy/Models/ProxyEndPoint.cs | 7 +++++++ src/Titanium.Web.Proxy/TransparentClientHandler.cs | 3 ++- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/Titanium.Web.Proxy/Models/ExplicitProxyEndPoint.cs b/src/Titanium.Web.Proxy/Models/ExplicitProxyEndPoint.cs index 5eb955822..4684653f2 100644 --- a/src/Titanium.Web.Proxy/Models/ExplicitProxyEndPoint.cs +++ b/src/Titanium.Web.Proxy/Models/ExplicitProxyEndPoint.cs @@ -27,11 +27,6 @@ public ExplicitProxyEndPoint(IPAddress ipAddress, int port, bool decryptSsl = tr internal bool IsSystemHttpsProxy { get; set; } - /// - /// Generic certificate to use for SSL decryption. - /// - public X509Certificate2 GenericCertificate { get; set; } - /// /// Intercept tunnel connect request. /// Valid only for explicit endpoints. diff --git a/src/Titanium.Web.Proxy/Models/ProxyEndPoint.cs b/src/Titanium.Web.Proxy/Models/ProxyEndPoint.cs index 5f3e0b948..9247a4ed4 100644 --- a/src/Titanium.Web.Proxy/Models/ProxyEndPoint.cs +++ b/src/Titanium.Web.Proxy/Models/ProxyEndPoint.cs @@ -1,5 +1,6 @@ using System.Net; using System.Net.Sockets; +using System.Security.Cryptography.X509Certificates; namespace Titanium.Web.Proxy.Models { @@ -47,5 +48,11 @@ protected ProxyEndPoint(IPAddress ipAddress, int port, bool decryptSsl) public bool IpV6Enabled => Equals(IpAddress, IPAddress.IPv6Any) || Equals(IpAddress, IPAddress.IPv6Loopback) || Equals(IpAddress, IPAddress.IPv6None); + + + /// + /// Generic certificate to use for SSL decryption. + /// + public X509Certificate2 GenericCertificate { get; set; } } } diff --git a/src/Titanium.Web.Proxy/TransparentClientHandler.cs b/src/Titanium.Web.Proxy/TransparentClientHandler.cs index 8a825977e..f5077f5cd 100644 --- a/src/Titanium.Web.Proxy/TransparentClientHandler.cs +++ b/src/Titanium.Web.Proxy/TransparentClientHandler.cs @@ -81,7 +81,8 @@ private async Task handleClient(TransparentProxyEndPoint endPoint, TcpClientConn sslStream = new SslStream(clientStream); string certName = HttpHelper.GetWildCardDomainName(httpsHostName); - var certificate = await CertificateManager.CreateCertificateAsync(certName); + var certificate = endPoint.GenericCertificate ?? + await CertificateManager.CreateCertificateAsync(certName); // Successfully managed to authenticate the client using the fake certificate await sslStream.AuthenticateAsServerAsync(certificate, false, SslProtocols.Tls, false); From 10e7e544b34017e2952f5a0b07ea0b0b78188fe6 Mon Sep 17 00:00:00 2001 From: buildbot121 Date: Fri, 7 Dec 2018 00:15:54 +0000 Subject: [PATCH 4/4] API documentation update by build server --- ...eb.Proxy.Models.ExplicitProxyEndPoint.html | 40 +++-------------- ...tanium.Web.Proxy.Models.ProxyEndPoint.html | 43 ++++++++++++++++--- ...Proxy.Models.TransparentProxyEndPoint.html | 3 ++ docs/index.json | 6 +-- docs/xrefmap.yml | 26 +++++------ 5 files changed, 61 insertions(+), 57 deletions(-) diff --git a/docs/api/Titanium.Web.Proxy.Models.ExplicitProxyEndPoint.html b/docs/api/Titanium.Web.Proxy.Models.ExplicitProxyEndPoint.html index f091c3ffb..b392b1fbf 100644 --- a/docs/api/Titanium.Web.Proxy.Models.ExplicitProxyEndPoint.html +++ b/docs/api/Titanium.Web.Proxy.Models.ExplicitProxyEndPoint.html @@ -107,6 +107,9 @@
Inherited Members
+ @@ -183,39 +186,6 @@
Parameters
-

Properties -

- - | - Improve this Doc - - - View Source - - -

GenericCertificate

-

Generic certificate to use for SSL decryption.

-
-
-
Declaration
-
-
public X509Certificate2 GenericCertificate { get; set; }
-
-
Property Value
- - - - - - - - - - - - - -
TypeDescription
X509Certificate2

Events

@@ -223,7 +193,7 @@

Events Improve this Doc - View Source + View Source

BeforeTunnelConnectRequest

Intercept tunnel connect request. @@ -256,7 +226,7 @@

Event Type
Improve this Doc - View Source + View Source

BeforeTunnelConnectResponse

Intercept tunnel connect response. diff --git a/docs/api/Titanium.Web.Proxy.Models.ProxyEndPoint.html b/docs/api/Titanium.Web.Proxy.Models.ProxyEndPoint.html index 112e69337..acbde465b 100644 --- a/docs/api/Titanium.Web.Proxy.Models.ProxyEndPoint.html +++ b/docs/api/Titanium.Web.Proxy.Models.ProxyEndPoint.html @@ -130,7 +130,7 @@

Constructors Improve this Doc - View Source + View Source

ProxyEndPoint(IPAddress, Int32, Boolean)

@@ -175,7 +175,7 @@

Properties Improve this Doc - View Source + View Source

DecryptSsl

@@ -201,12 +201,43 @@
Property Value
+ + | + Improve this Doc + + + View Source + + +

GenericCertificate

+

Generic certificate to use for SSL decryption.

+
+
+
Declaration
+
+
public X509Certificate2 GenericCertificate { get; set; }
+
+
Property Value
+ + + + + + + + + + + + + +
TypeDescription
X509Certificate2
| Improve this Doc - View Source + View Source

IpAddress

@@ -237,7 +268,7 @@
Property Value
Improve this Doc - View Source + View Source

IpV6Enabled

@@ -268,7 +299,7 @@
Property Value
Improve this Doc - View Source + View Source

Port

@@ -305,7 +336,7 @@
Property Value
Improve this Doc
  • - View Source + View Source
  • diff --git a/docs/api/Titanium.Web.Proxy.Models.TransparentProxyEndPoint.html b/docs/api/Titanium.Web.Proxy.Models.TransparentProxyEndPoint.html index 2cb8aed4b..a4ce930f7 100644 --- a/docs/api/Titanium.Web.Proxy.Models.TransparentProxyEndPoint.html +++ b/docs/api/Titanium.Web.Proxy.Models.TransparentProxyEndPoint.html @@ -107,6 +107,9 @@
    Inherited Members
    + diff --git a/docs/index.json b/docs/index.json index 93e21cdc7..688199fdc 100644 --- a/docs/index.json +++ b/docs/index.json @@ -217,7 +217,7 @@ "api/Titanium.Web.Proxy.Models.ExplicitProxyEndPoint.html": { "href": "api/Titanium.Web.Proxy.Models.ExplicitProxyEndPoint.html", "title": "Class ExplicitProxyEndPoint | Titanium Web Proxy", - "keywords": "Class ExplicitProxyEndPoint A proxy endpoint that the client is aware of. So client application know that it is communicating with a proxy server. Inheritance Object ProxyEndPoint ExplicitProxyEndPoint Inherited Members ProxyEndPoint.IpAddress ProxyEndPoint.Port ProxyEndPoint.DecryptSsl ProxyEndPoint.IpV6Enabled Object.ToString() Object.Equals(Object) Object.Equals(Object, Object) Object.ReferenceEquals(Object, Object) Object.GetHashCode() Object.GetType() Object.MemberwiseClone() Namespace : Titanium.Web.Proxy.Models Assembly : Titanium.Web.Proxy.dll Syntax public class ExplicitProxyEndPoint : ProxyEndPoint Constructors | Improve this Doc View Source ExplicitProxyEndPoint(IPAddress, Int32, Boolean) Constructor. Declaration public ExplicitProxyEndPoint(IPAddress ipAddress, int port, bool decryptSsl = true) Parameters Type Name Description IPAddress ipAddress Listening IP address. Int32 port Listening port. Boolean decryptSsl Should we decrypt ssl? Properties | Improve this Doc View Source GenericCertificate Generic certificate to use for SSL decryption. Declaration public X509Certificate2 GenericCertificate { get; set; } Property Value Type Description X509Certificate2 Events | Improve this Doc View Source BeforeTunnelConnectRequest Intercept tunnel connect request. Valid only for explicit endpoints. Set the DecryptSsl property to false if this HTTP connect request should'nt be decrypted and instead be relayed. Declaration public event AsyncEventHandler BeforeTunnelConnectRequest Event Type Type Description AsyncEventHandler < TunnelConnectSessionEventArgs > | Improve this Doc View Source BeforeTunnelConnectResponse Intercept tunnel connect response. Valid only for explicit endpoints. Declaration public event AsyncEventHandler BeforeTunnelConnectResponse Event Type Type Description AsyncEventHandler < TunnelConnectSessionEventArgs >" + "keywords": "Class ExplicitProxyEndPoint A proxy endpoint that the client is aware of. So client application know that it is communicating with a proxy server. Inheritance Object ProxyEndPoint ExplicitProxyEndPoint Inherited Members ProxyEndPoint.IpAddress ProxyEndPoint.Port ProxyEndPoint.DecryptSsl ProxyEndPoint.IpV6Enabled ProxyEndPoint.GenericCertificate Object.ToString() Object.Equals(Object) Object.Equals(Object, Object) Object.ReferenceEquals(Object, Object) Object.GetHashCode() Object.GetType() Object.MemberwiseClone() Namespace : Titanium.Web.Proxy.Models Assembly : Titanium.Web.Proxy.dll Syntax public class ExplicitProxyEndPoint : ProxyEndPoint Constructors | Improve this Doc View Source ExplicitProxyEndPoint(IPAddress, Int32, Boolean) Constructor. Declaration public ExplicitProxyEndPoint(IPAddress ipAddress, int port, bool decryptSsl = true) Parameters Type Name Description IPAddress ipAddress Listening IP address. Int32 port Listening port. Boolean decryptSsl Should we decrypt ssl? Events | Improve this Doc View Source BeforeTunnelConnectRequest Intercept tunnel connect request. Valid only for explicit endpoints. Set the DecryptSsl property to false if this HTTP connect request should'nt be decrypted and instead be relayed. Declaration public event AsyncEventHandler BeforeTunnelConnectRequest Event Type Type Description AsyncEventHandler < TunnelConnectSessionEventArgs > | Improve this Doc View Source BeforeTunnelConnectResponse Intercept tunnel connect response. Valid only for explicit endpoints. Declaration public event AsyncEventHandler BeforeTunnelConnectResponse Event Type Type Description AsyncEventHandler < TunnelConnectSessionEventArgs >" }, "api/Titanium.Web.Proxy.Models.ExternalProxy.html": { "href": "api/Titanium.Web.Proxy.Models.ExternalProxy.html", @@ -247,7 +247,7 @@ "api/Titanium.Web.Proxy.Models.ProxyEndPoint.html": { "href": "api/Titanium.Web.Proxy.Models.ProxyEndPoint.html", "title": "Class ProxyEndPoint | Titanium Web Proxy", - "keywords": "Class ProxyEndPoint An abstract endpoint where the proxy listens Inheritance Object ProxyEndPoint ExplicitProxyEndPoint TransparentProxyEndPoint Inherited Members Object.ToString() Object.Equals(Object) Object.Equals(Object, Object) Object.ReferenceEquals(Object, Object) Object.GetHashCode() Object.GetType() Object.MemberwiseClone() Namespace : Titanium.Web.Proxy.Models Assembly : Titanium.Web.Proxy.dll Syntax public abstract class ProxyEndPoint Constructors | Improve this Doc View Source ProxyEndPoint(IPAddress, Int32, Boolean) Constructor. Declaration protected ProxyEndPoint(IPAddress ipAddress, int port, bool decryptSsl) Parameters Type Name Description IPAddress ipAddress Int32 port Boolean decryptSsl Properties | Improve this Doc View Source DecryptSsl Enable SSL? Declaration public bool DecryptSsl { get; } Property Value Type Description Boolean | Improve this Doc View Source IpAddress Ip Address we are listening. Declaration public IPAddress IpAddress { get; } Property Value Type Description IPAddress | Improve this Doc View Source IpV6Enabled Is IPv6 enabled? Declaration public bool IpV6Enabled { get; } Property Value Type Description Boolean | Improve this Doc View Source Port Port we are listening. Declaration public int Port { get; } Property Value Type Description Int32" + "keywords": "Class ProxyEndPoint An abstract endpoint where the proxy listens Inheritance Object ProxyEndPoint ExplicitProxyEndPoint TransparentProxyEndPoint Inherited Members Object.ToString() Object.Equals(Object) Object.Equals(Object, Object) Object.ReferenceEquals(Object, Object) Object.GetHashCode() Object.GetType() Object.MemberwiseClone() Namespace : Titanium.Web.Proxy.Models Assembly : Titanium.Web.Proxy.dll Syntax public abstract class ProxyEndPoint Constructors | Improve this Doc View Source ProxyEndPoint(IPAddress, Int32, Boolean) Constructor. Declaration protected ProxyEndPoint(IPAddress ipAddress, int port, bool decryptSsl) Parameters Type Name Description IPAddress ipAddress Int32 port Boolean decryptSsl Properties | Improve this Doc View Source DecryptSsl Enable SSL? Declaration public bool DecryptSsl { get; } Property Value Type Description Boolean | Improve this Doc View Source GenericCertificate Generic certificate to use for SSL decryption. Declaration public X509Certificate2 GenericCertificate { get; set; } Property Value Type Description X509Certificate2 | Improve this Doc View Source IpAddress Ip Address we are listening. Declaration public IPAddress IpAddress { get; } Property Value Type Description IPAddress | Improve this Doc View Source IpV6Enabled Is IPv6 enabled? Declaration public bool IpV6Enabled { get; } Property Value Type Description Boolean | Improve this Doc View Source Port Port we are listening. Declaration public int Port { get; } Property Value Type Description Int32" }, "api/Titanium.Web.Proxy.Models.ProxyProtocolType.html": { "href": "api/Titanium.Web.Proxy.Models.ProxyProtocolType.html", @@ -257,7 +257,7 @@ "api/Titanium.Web.Proxy.Models.TransparentProxyEndPoint.html": { "href": "api/Titanium.Web.Proxy.Models.TransparentProxyEndPoint.html", "title": "Class TransparentProxyEndPoint | Titanium Web Proxy", - "keywords": "Class TransparentProxyEndPoint A proxy end point client is not aware of. Useful when requests are redirected to this proxy end point through port forwarding via router. Inheritance Object ProxyEndPoint TransparentProxyEndPoint Inherited Members ProxyEndPoint.IpAddress ProxyEndPoint.Port ProxyEndPoint.DecryptSsl ProxyEndPoint.IpV6Enabled Object.ToString() Object.Equals(Object) Object.Equals(Object, Object) Object.ReferenceEquals(Object, Object) Object.GetHashCode() Object.GetType() Object.MemberwiseClone() Namespace : Titanium.Web.Proxy.Models Assembly : Titanium.Web.Proxy.dll Syntax public class TransparentProxyEndPoint : ProxyEndPoint Constructors | Improve this Doc View Source TransparentProxyEndPoint(IPAddress, Int32, Boolean) Initialize a new instance. Declaration public TransparentProxyEndPoint(IPAddress ipAddress, int port, bool decryptSsl = true) Parameters Type Name Description IPAddress ipAddress Listening Ip address. Int32 port Listening port. Boolean decryptSsl Should we decrypt ssl? Properties | Improve this Doc View Source GenericCertificateName Name of the Certificate need to be sent (same as the hostname we want to proxy). This is valid only when UseServerNameIndication is set to false. Declaration public string GenericCertificateName { get; set; } Property Value Type Description String Events | Improve this Doc View Source BeforeSslAuthenticate Before Ssl authentication this event is fired. Declaration public event AsyncEventHandler BeforeSslAuthenticate Event Type Type Description AsyncEventHandler < BeforeSslAuthenticateEventArgs >" + "keywords": "Class TransparentProxyEndPoint A proxy end point client is not aware of. Useful when requests are redirected to this proxy end point through port forwarding via router. Inheritance Object ProxyEndPoint TransparentProxyEndPoint Inherited Members ProxyEndPoint.IpAddress ProxyEndPoint.Port ProxyEndPoint.DecryptSsl ProxyEndPoint.IpV6Enabled ProxyEndPoint.GenericCertificate Object.ToString() Object.Equals(Object) Object.Equals(Object, Object) Object.ReferenceEquals(Object, Object) Object.GetHashCode() Object.GetType() Object.MemberwiseClone() Namespace : Titanium.Web.Proxy.Models Assembly : Titanium.Web.Proxy.dll Syntax public class TransparentProxyEndPoint : ProxyEndPoint Constructors | Improve this Doc View Source TransparentProxyEndPoint(IPAddress, Int32, Boolean) Initialize a new instance. Declaration public TransparentProxyEndPoint(IPAddress ipAddress, int port, bool decryptSsl = true) Parameters Type Name Description IPAddress ipAddress Listening Ip address. Int32 port Listening port. Boolean decryptSsl Should we decrypt ssl? Properties | Improve this Doc View Source GenericCertificateName Name of the Certificate need to be sent (same as the hostname we want to proxy). This is valid only when UseServerNameIndication is set to false. Declaration public string GenericCertificateName { get; set; } Property Value Type Description String Events | Improve this Doc View Source BeforeSslAuthenticate Before Ssl authentication this event is fired. Declaration public event AsyncEventHandler BeforeSslAuthenticate Event Type Type Description AsyncEventHandler < BeforeSslAuthenticateEventArgs >" }, "api/Titanium.Web.Proxy.Network.CertificateEngine.html": { "href": "api/Titanium.Web.Proxy.Network.CertificateEngine.html", diff --git a/docs/xrefmap.yml b/docs/xrefmap.yml index bfa65757b..ecda8f2ac 100644 --- a/docs/xrefmap.yml +++ b/docs/xrefmap.yml @@ -2519,19 +2519,6 @@ references: commentId: E:Titanium.Web.Proxy.Models.ExplicitProxyEndPoint.BeforeTunnelConnectResponse fullName: Titanium.Web.Proxy.Models.ExplicitProxyEndPoint.BeforeTunnelConnectResponse nameWithType: ExplicitProxyEndPoint.BeforeTunnelConnectResponse -- uid: Titanium.Web.Proxy.Models.ExplicitProxyEndPoint.GenericCertificate - name: GenericCertificate - href: api/Titanium.Web.Proxy.Models.ExplicitProxyEndPoint.html#Titanium_Web_Proxy_Models_ExplicitProxyEndPoint_GenericCertificate - commentId: P:Titanium.Web.Proxy.Models.ExplicitProxyEndPoint.GenericCertificate - fullName: Titanium.Web.Proxy.Models.ExplicitProxyEndPoint.GenericCertificate - nameWithType: ExplicitProxyEndPoint.GenericCertificate -- uid: Titanium.Web.Proxy.Models.ExplicitProxyEndPoint.GenericCertificate* - name: GenericCertificate - href: api/Titanium.Web.Proxy.Models.ExplicitProxyEndPoint.html#Titanium_Web_Proxy_Models_ExplicitProxyEndPoint_GenericCertificate_ - commentId: Overload:Titanium.Web.Proxy.Models.ExplicitProxyEndPoint.GenericCertificate - isSpec: "True" - fullName: Titanium.Web.Proxy.Models.ExplicitProxyEndPoint.GenericCertificate - nameWithType: ExplicitProxyEndPoint.GenericCertificate - uid: Titanium.Web.Proxy.Models.ExternalProxy name: ExternalProxy href: api/Titanium.Web.Proxy.Models.ExternalProxy.html @@ -2833,6 +2820,19 @@ references: isSpec: "True" fullName: Titanium.Web.Proxy.Models.ProxyEndPoint.DecryptSsl nameWithType: ProxyEndPoint.DecryptSsl +- uid: Titanium.Web.Proxy.Models.ProxyEndPoint.GenericCertificate + name: GenericCertificate + href: api/Titanium.Web.Proxy.Models.ProxyEndPoint.html#Titanium_Web_Proxy_Models_ProxyEndPoint_GenericCertificate + commentId: P:Titanium.Web.Proxy.Models.ProxyEndPoint.GenericCertificate + fullName: Titanium.Web.Proxy.Models.ProxyEndPoint.GenericCertificate + nameWithType: ProxyEndPoint.GenericCertificate +- uid: Titanium.Web.Proxy.Models.ProxyEndPoint.GenericCertificate* + name: GenericCertificate + href: api/Titanium.Web.Proxy.Models.ProxyEndPoint.html#Titanium_Web_Proxy_Models_ProxyEndPoint_GenericCertificate_ + commentId: Overload:Titanium.Web.Proxy.Models.ProxyEndPoint.GenericCertificate + isSpec: "True" + fullName: Titanium.Web.Proxy.Models.ProxyEndPoint.GenericCertificate + nameWithType: ProxyEndPoint.GenericCertificate - uid: Titanium.Web.Proxy.Models.ProxyEndPoint.IpAddress name: IpAddress href: api/Titanium.Web.Proxy.Models.ProxyEndPoint.html#Titanium_Web_Proxy_Models_ProxyEndPoint_IpAddress