AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Netzwerke Delphi Indy HTTP Proxy Server + SSL = Read Timeout

Indy HTTP Proxy Server + SSL = Read Timeout

Ein Thema von Zacherl · begonnen am 9. Sep 2011 · letzter Beitrag vom 12. Sep 2011
Antwort Antwort
Benutzerbild von Zacherl
Zacherl

Registriert seit: 3. Sep 2004
4.629 Beiträge
 
Delphi 10.2 Tokyo Starter
 
#1

Indy HTTP Proxy Server + SSL = Read Timeout

  Alt 9. Sep 2011, 08:02
Hey,

ich versuche seit geraumer Zeit den Indy HTTP Proxy mit OpenSSL zum laufen zu bringen. Allerdings wirft die Indy Komponente jedes Mal, wenn ich eine Verbindung tunneln will, eine Exception mit dem Inhalt "Read Timeout".

Das komische an der Sache ist aber, wenn ich eine IdHTTP Komponente erstelle, dieser einen IdSSLIOHandlerSocketOpenSSL Handler mit selben Einstellungen zuweise und dann manuell die angeforderte SSL Seite aufrufe, dann funktioniert dies tadellos. Am Server / Certifikat / was weiß ich, kanns also nicht liegen.

Momentan habe ich folgenden Code:
Delphi-Quellcode:
procedure TForm4.IdHTTPProxyServer1HTTPBeforeCommand(
  AContext: TIdHTTPProxyServerContext);
var
  SSLClient: TIdSSLIOHandlerSocketOpenSSL;
begin
  if (TIdTCPClient(AContext.OutboundClient).Port = 443) then
  begin
    if not (AContext.OutboundClient.IOHandler is TIdSSLIOHandlerSocketOpenSSL) then
    begin
      if Assigned(AContext.OutboundClient.IOHandler) then
      begin
        AContext.OutboundClient.IOHandler.Free;
      end;
      AContext.OutboundClient.IOHandler :=
        TIdSSLIOHandlerSocketOpenSSL.Create(AContext.OutboundClient);
    end;
    SSLClient :=
      TIdSSLIOHandlerSocketOpenSSL(AContext.OutboundClient.IOHandler);
    SSLClient.SSLOptions.Method := sslvSSLv23;
    SSLClient.SSLOptions.Mode := sslmClient;
    SSLClient.SSLOptions.VerifyMode := [];
    SSLClient.PassThrough := false;
  end else if AContext.OutboundClient.IOHandler is TIdSSLIOHandlerSocketOpenSSL then
  begin
    TIdSSLIOHandlerSocketOpenSSL(AContext.OutboundClient.IOHandler).PassThrough := true;
  end;
end;
Wenn ich die Statusnachrichten vom SSL IOHandler ausgeben lasse, erkenne ich ebenfalls nichts Verdächtiges:
Code:
SSL-Status: "before/connect initialization"
SSL-Status: "before/connect initialization"
SSL-Status: "SSLv2/v3 write client hello A"
SSL-Status: "SSLv3 read server hello A"
SSL-Status: "SSLv3 read server certificate A"
SSL-Status: "SSLv3 read server key exchange A"
SSL-Status: "SSLv3 read server done A"
SSL-Status: "SSLv3 write client key exchange A"
SSL-Status: "SSLv3 write change cipher spec A"
SSL-Status: "SSLv3 write finished A"
SSL-Status: "SSLv3 flush data"
SSL-Status: "SSLv3 read finished A"
SSL-Status: "SSL negotiation finished successfully"
SSL-Status: "SSL negotiation finished successfully"
Cipher: name = DHE-RSA-AES256-SHA; description = DHE-RSA-AES256-SHA     SSLv3 Kx=DH      Au=RSA Enc=AES(256) Mac=SHA1
; bits = 256; version = TLSv1/SSLv3;
SSL-Status: "SSL negotiation finished successfully"
--> an dieser Stelle bricht die Verbindung ab
Hat jemand eine Idee, woher mein Problem kommen könnte?

Viele Grüße
Zacherl
Projekte:
- GitHub (Profil, zyantific)
- zYan Disassembler Engine ( Zydis Online, Zydis GitHub)

Geändert von Zacherl ( 9. Sep 2011 um 08:40 Uhr)
  Mit Zitat antworten Zitat
Benutzerbild von Zacherl
Zacherl

Registriert seit: 3. Sep 2004
4.629 Beiträge
 
Delphi 10.2 Tokyo Starter
 
#2

AW: Indy HTTP Proxy Server + SSL = Read Timeout

  Alt 9. Sep 2011, 16:05
Habe das jetzt nochmal weitergehend debuggt. Die Exception wird in der IdHTTPProxyServer.pas in der Funkion CommandCONNECT in Zeile 418 geworfen.
Delphi-Quellcode:
if not LContext.FOutboundClient.IOHandler.InputBufferIsEmpty then
begin
  LContext.FOutboundClient.IOHandler.ReadStream(LServerToClientStream, -1, True);
end;
Vielleicht ist noch wichtig zu erwähnen, dass die proxifizierte Anwendung ein Java Programm ist, wobei ich den SSL Proxy auch im Firefox mit selbem "Erfolg" getestet habe.
Projekte:
- GitHub (Profil, zyantific)
- zYan Disassembler Engine ( Zydis Online, Zydis GitHub)
  Mit Zitat antworten Zitat
Benutzerbild von Zacherl
Zacherl

Registriert seit: 3. Sep 2004
4.629 Beiträge
 
Delphi 10.2 Tokyo Starter
 
#3

AW: Indy HTTP Proxy Server + SSL = Read Timeout

  Alt 11. Sep 2011, 04:05
push
Projekte:
- GitHub (Profil, zyantific)
- zYan Disassembler Engine ( Zydis Online, Zydis GitHub)
  Mit Zitat antworten Zitat
Assertor

Registriert seit: 4. Feb 2006
Ort: Hamburg
1.296 Beiträge
 
Turbo C++
 
#4

AW: Indy HTTP Proxy Server + SSL = Read Timeout

  Alt 12. Sep 2011, 11:34
Hi Zacherl,

so, zurück von den Delphi Tagen antworte ich mal.

Ich weiß nicht, was Du machen möchtest und wo Du den obigen Code herhast...

Möchtest Du
1. den Weg zum Proxy per SSL/TLS schützen
oder
2. SSL über den Proxy nutzen?

Letzteres geht mit einer halbwegs aktuellen Indy Version (10.5.x) ohne Probleme - das andere ist nicht implementiert (wäre auch sehr unüblich).

Rohdaten werden Binär über den Proxy getunnelt, d.h. der Endpunkt (z.B. Browser) ist für die SSL Negotiation mit dem Endpunkt hinter dem Proxy verantwortlich:
http://tools.ietf.org/id/draft-luoto...nneling-03.txt

Sonst wärst Du ja der Man-in-the-Middle, was bei SSL doch eher ein Reizwort ist.

Ich habe gerade mal im frischen XE2 den IdHTTPProxyServer auf eine neue VCL Formanwendung gezogen, aktiv gesetzt und gestartet. Beim IE als Proxy für alle Protokolle den localhost:8080 und siehe da: Es geht sofort, auch per SSL (z.B. auf https://www.google.com).

Viele Grüße,
Assertor
Frederik
  Mit Zitat antworten Zitat
Benutzerbild von Zacherl
Zacherl

Registriert seit: 3. Sep 2004
4.629 Beiträge
 
Delphi 10.2 Tokyo Starter
 
#5

AW: Indy HTTP Proxy Server + SSL = Read Timeout

  Alt 12. Sep 2011, 19:31
Vielen Dank für deine Antwort, jetzt wird mir einiges schon klarer Oh wei, ich wollte tatsächlich sowas wie man in the middle realisieren, obwohl das für meine Zwecke gar nicht mal nötig ist.

Intention war es lediglich über den Proxy einen Seitenaufruf auf einen anderen (lokalen) Server umzulenken.

Habe es nun nochmal ohne irgendwelche "Tricks" im OnBeforeHTTPCommand() Handler probiert, erhalte allerdings bei Delphi XE nach wie vor die Read Timeout Meldung. Mit Delphi XE2 funktioniert es tadellos
Projekte:
- GitHub (Profil, zyantific)
- zYan Disassembler Engine ( Zydis Online, Zydis GitHub)
  Mit Zitat antworten Zitat
Themen-Optionen Thema durchsuchen
Thema durchsuchen:

Erweiterte Suche
Ansicht

Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 16:15 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz