Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
T
Titanium-Web-Proxy
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Titanium-Web-Proxy
Commits
0c8f2779
Commit
0c8f2779
authored
Apr 10, 2018
by
Honfika
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decrypt ssl in transparent endpoint + using case insensitive hashset
parent
656c575c
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
20 additions
and
22 deletions
+20
-22
ExplicitProxyEndPoint.cs
Titanium.Web.Proxy/Models/ExplicitProxyEndPoint.cs
+1
-7
ProxyEndPoint.cs
Titanium.Web.Proxy/Models/ProxyEndPoint.cs
+8
-3
TransparentProxyEndPoint.cs
Titanium.Web.Proxy/Models/TransparentProxyEndPoint.cs
+2
-2
RequestHandler.cs
Titanium.Web.Proxy/RequestHandler.cs
+1
-1
WinAuthHandler.cs
Titanium.Web.Proxy/WinAuthHandler.cs
+8
-9
No files found.
Titanium.Web.Proxy/Models/ExplicitProxyEndPoint.cs
View file @
0c8f2779
...
@@ -17,11 +17,6 @@ namespace Titanium.Web.Proxy.Models
...
@@ -17,11 +17,6 @@ namespace Titanium.Web.Proxy.Models
internal
bool
IsSystemHttpsProxy
{
get
;
set
;
}
internal
bool
IsSystemHttpsProxy
{
get
;
set
;
}
/// <summary>
/// Enable SSL?
/// </summary>
public
bool
DecryptSsl
{
get
;
}
/// <summary>
/// <summary>
/// Generic certificate to use for SSL decryption.
/// Generic certificate to use for SSL decryption.
/// </summary>
/// </summary>
...
@@ -46,9 +41,8 @@ namespace Titanium.Web.Proxy.Models
...
@@ -46,9 +41,8 @@ namespace Titanium.Web.Proxy.Models
/// <param name="ipAddress"></param>
/// <param name="ipAddress"></param>
/// <param name="port"></param>
/// <param name="port"></param>
/// <param name="decryptSsl"></param>
/// <param name="decryptSsl"></param>
public
ExplicitProxyEndPoint
(
IPAddress
ipAddress
,
int
port
,
bool
decryptSsl
=
true
)
:
base
(
ipAddress
,
port
)
public
ExplicitProxyEndPoint
(
IPAddress
ipAddress
,
int
port
,
bool
decryptSsl
=
true
)
:
base
(
ipAddress
,
port
,
decryptSsl
)
{
{
this
.
DecryptSsl
=
decryptSsl
;
}
}
internal
async
Task
InvokeBeforeTunnelConnectRequest
(
ProxyServer
proxyServer
,
TunnelConnectSessionEventArgs
connectArgs
,
ExceptionHandler
exceptionFunc
)
internal
async
Task
InvokeBeforeTunnelConnectRequest
(
ProxyServer
proxyServer
,
TunnelConnectSessionEventArgs
connectArgs
,
ExceptionHandler
exceptionFunc
)
...
...
Titanium.Web.Proxy/Models/ProxyEndPoint.cs
View file @
0c8f2779
...
@@ -16,13 +16,14 @@ namespace Titanium.Web.Proxy.Models
...
@@ -16,13 +16,14 @@ namespace Titanium.Web.Proxy.Models
/// </summary>
/// </summary>
/// <param name="ipAddress"></param>
/// <param name="ipAddress"></param>
/// <param name="port"></param>
/// <param name="port"></param>
/// <param name="
enable
Ssl"></param>
/// <param name="
decrypt
Ssl"></param>
protected
ProxyEndPoint
(
IPAddress
ipAddress
,
int
port
)
protected
ProxyEndPoint
(
IPAddress
ipAddress
,
int
port
,
bool
decryptSsl
)
{
{
IpAddress
=
ipAddress
;
IpAddress
=
ipAddress
;
Port
=
port
;
Port
=
port
;
DecryptSsl
=
decryptSsl
;
}
}
/// <summary>
/// <summary>
/// underlying TCP Listener object
/// underlying TCP Listener object
/// </summary>
/// </summary>
...
@@ -38,6 +39,10 @@ namespace Titanium.Web.Proxy.Models
...
@@ -38,6 +39,10 @@ namespace Titanium.Web.Proxy.Models
/// </summary>
/// </summary>
public
int
Port
{
get
;
internal
set
;
}
public
int
Port
{
get
;
internal
set
;
}
/// <summary>
/// Enable SSL?
/// </summary>
public
bool
DecryptSsl
{
get
;
}
/// <summary>
/// <summary>
/// Is IPv6 enabled?
/// Is IPv6 enabled?
...
...
Titanium.Web.Proxy/Models/TransparentProxyEndPoint.cs
View file @
0c8f2779
...
@@ -19,8 +19,8 @@ namespace Titanium.Web.Proxy.Models
...
@@ -19,8 +19,8 @@ namespace Titanium.Web.Proxy.Models
/// </summary>
/// </summary>
/// <param name="ipAddress"></param>
/// <param name="ipAddress"></param>
/// <param name="port"></param>
/// <param name="port"></param>
/// <param name="
enable
Ssl"></param>
/// <param name="
decrypt
Ssl"></param>
public
TransparentProxyEndPoint
(
IPAddress
ipAddress
,
int
port
)
:
base
(
ipAddress
,
port
)
public
TransparentProxyEndPoint
(
IPAddress
ipAddress
,
int
port
,
bool
decryptSsl
=
true
)
:
base
(
ipAddress
,
port
,
decryptSsl
)
{
{
GenericCertificateName
=
"localhost"
;
GenericCertificateName
=
"localhost"
;
}
}
...
...
Titanium.Web.Proxy/RequestHandler.cs
View file @
0c8f2779
...
@@ -232,7 +232,7 @@ namespace Titanium.Web.Proxy
...
@@ -232,7 +232,7 @@ namespace Titanium.Web.Proxy
{
{
var
clientHelloInfo
=
await
SslTools
.
PeekClientHello
(
clientStream
);
var
clientHelloInfo
=
await
SslTools
.
PeekClientHello
(
clientStream
);
var
isHttps
=
clientHelloInfo
!=
null
;
var
isHttps
=
endPoint
.
DecryptSsl
&&
clientHelloInfo
!=
null
;
string
httpsHostName
=
null
;
string
httpsHostName
=
null
;
if
(
isHttps
)
if
(
isHttps
)
...
...
Titanium.Web.Proxy/WinAuthHandler.cs
View file @
0c8f2779
...
@@ -14,14 +14,14 @@ namespace Titanium.Web.Proxy
...
@@ -14,14 +14,14 @@ namespace Titanium.Web.Proxy
public
partial
class
ProxyServer
public
partial
class
ProxyServer
{
{
//possible header names
//possible header names
private
static
readonly
HashSet
<
string
>
authHeaderNames
=
new
HashSet
<
string
>
private
static
readonly
HashSet
<
string
>
authHeaderNames
=
new
HashSet
<
string
>
(
StringComparer
.
OrdinalIgnoreCase
)
{
{
"WWW-Authenticate"
.
ToLower
()
,
"WWW-Authenticate"
,
//IIS 6.0 messed up names below
//IIS 6.0 messed up names below
"WWWAuthenticate"
.
ToLower
()
,
"WWWAuthenticate"
,
"NTLMAuthorization"
.
ToLower
()
,
"NTLMAuthorization"
,
"NegotiateAuthorization"
.
ToLower
()
,
"NegotiateAuthorization"
,
"KerberosAuthorization"
.
ToLower
()
"KerberosAuthorization"
};
};
private
static
readonly
HashSet
<
string
>
authSchemes
=
new
HashSet
<
string
>
private
static
readonly
HashSet
<
string
>
authSchemes
=
new
HashSet
<
string
>
...
@@ -48,8 +48,7 @@ namespace Titanium.Web.Proxy
...
@@ -48,8 +48,7 @@ namespace Titanium.Web.Proxy
var
response
=
args
.
WebSession
.
Response
;
var
response
=
args
.
WebSession
.
Response
;
//check in non-unique headers first
//check in non-unique headers first
var
header
=
response
.
Headers
.
NonUniqueHeaders
.
FirstOrDefault
(
var
header
=
response
.
Headers
.
NonUniqueHeaders
.
FirstOrDefault
(
x
=>
authHeaderNames
.
Contains
(
x
.
Key
));
x
=>
authHeaderNames
.
Contains
(
x
.
Key
.
ToLower
()));
if
(!
header
.
Equals
(
new
KeyValuePair
<
string
,
List
<
HttpHeader
>>()))
if
(!
header
.
Equals
(
new
KeyValuePair
<
string
,
List
<
HttpHeader
>>()))
{
{
...
@@ -68,7 +67,7 @@ namespace Titanium.Web.Proxy
...
@@ -68,7 +67,7 @@ namespace Titanium.Web.Proxy
headerName
=
null
;
headerName
=
null
;
//check in non-unique headers first
//check in non-unique headers first
var
uHeader
=
response
.
Headers
.
Headers
.
FirstOrDefault
(
x
=>
authHeaderNames
.
Contains
(
x
.
Key
.
ToLower
()
));
var
uHeader
=
response
.
Headers
.
Headers
.
FirstOrDefault
(
x
=>
authHeaderNames
.
Contains
(
x
.
Key
));
if
(!
uHeader
.
Equals
(
new
KeyValuePair
<
string
,
HttpHeader
>()))
if
(!
uHeader
.
Equals
(
new
KeyValuePair
<
string
,
HttpHeader
>()))
{
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment