Mombu the Programming Forum

Go Back   Mombu the Programming Forum > Programming > HTTPS SSLeay problems - any experts out there?
User Name
Password
REGISTER NOW! Mark Forums Read




Reply Bookmark and Share
1 1st September 09:20
ira
External User
 
Posts: 1
Default HTTPS SSLeay problems - any experts out there?



Hi. I'm having a bit of trouble using a Perl script that will login to
a secure website... and then access subsequent pages with a cookie.
This works when accessing manually via the browser (Konqueror) which
then accepts the cookie and allows me to login to subsequent pages
with the valid cookie. It appears that the HTTP/SSLeay installation
is working fine since no errors come up when I access "https://"
directives. I just haven't been able to get beyond logging in.

I have tried many things, but I haven't been able to get my perl
script to authenticate successfully. Everything works fine on
non-secure (http://) websites.

I did notice a "Client-SSL-Warning: Peer certificate not verified"
warning in the header that I get returned to me.

I have tried many things, but no success, am I missing something
obvious here?
I am running FreeBSD 4.8 with Perl 5.6.1 with the Crypt-SSLeay 0.51.

This is my script:

-----------------------------
#!/usr/local/bin/perl -w
use strict;
use Crypt::SSLeay;
use LWP::UserAgent;
use LWP::Simple;
use HTTP::Request::Common qw(POST);
use HTTP::Cookies;

my $ua = LWP::UserAgent->new;
my $cookie_jar = HTTP::Cookies->new(file => "lwpcookies2.txt",
autosave => 1);
$ua->cookie_jar( $cookie_jar);
$ua->agent('Mozilla/5.0');
my $url = 'https://www.sdmediagroup.com/registration/';
my $req = POST $url, ['login' => 'me', 'password' => 'mypass'];
my $res = $ua->request($req);
$cookie_jar->extract_cookies($res);

if ($res->is_success) {
# print out result to look at headers
print $res->as_string;

# access page with cookie secured after logged in
my $req = HTTP::Request->new(GET => 'http://www.ddj.com/');
$cookie_jar->add_cookie_header($req);
$res = $ua->request($req);
print $res->as_string;
} else {
print "Failed: ", $res->status_line, "\n";
}
----------------------------

The response I get from the login POST is this:
HTTP/1.1 200 OK
Cache-Control: private
Connection: close
Date: Tue, 29 Jun 2004 22:06:17 GMT
Server: Apache/1.3.28 (Unix) PHP/4.3.3 mod_ssl/2.8.15 OpenSSL/0.9.7a
Resin/2.1.10
Content-Length: 1132
Content-Type: text/html
Content-Type: text/html; charset=iso-8859-1
Client-Date: Tue, 29 Jun 2004 22:06:34 GMT
Client-Peer: 66.77.26.213:443
Client-Response-Num: 1
Client-SSL-Cert-Issuer: /C=US/O=Equifax Secure Inc./CN=Equifax Secure
Global eBusines
s CA-1
Client-SSL-Cert-Subject:
/C=US/O=www.sdmediagroup.com/OU=https://services.choicepoint
..net/get.jsp?2922628099/OU=See www.geotrust.com/quickssl/cps
(c)04/OU=Domain Control
Validated/CN=www.sdmediagroup.com
Client-SSL-Cipher: DHE-RSA-AES256-SHA
Client-SSL-Warning: Peer certificate not verified
Set-Cookie: JSESSIONID=aQEjvqhLgLTd; path=/

..... html saying that an error has occured processing the request...


Subsequent page accesses don't work obviously because of invalid
cookie due to failed login.

Any help would be greatly appreciated! Thanks in advance.
  Reply With Quote


 


Reply


Thread Tools
Display Modes


Some other forums that might be of your interest : Development, Ada, Apple script, Assembler, Awk, Beos, Basic, C, C++, C#, C# .net, .net, .net frameworks, Asp .net, Clarion, Clipper, Clos, Clu, Cobol, Coldfusion, Delphi, Dylan, Eiffel, Forth, Fortran, Haskell, Hermes, Icon, Idl, Java, Java script, Jscript .net, Jcl, Linoleum, Lisp, Lotus, Limbo, Logo, Ml, Mumps, Oberon, Postscript, Pop, Pl1, Prolog, Python, Ruby, Pascal, Perl, Php, Rebol, Rexx, Sed, Sather, Scheme, Smalltalk, Tcl, Vhdl, Vrml, Visual basic, Visual basic .net, Yorick, Mysql, Omnis, Postgresql, Xbase, Access, Oracle, Adabas, Berkeley, Btrieve, Filemaker, Gupta, Db2, Informix, Ingres, Mssql server, Object, Olap, Paradox, Rdb, Revelation, Sybase, Theory, Dbase, Html, Java script, Css, Flash, Photoshop, Corel script, Xml, Tech, Beos, Gem, Hp48, Hpux, Linux, Mac, Ms-dos, Os2, Palm, Solaris, Ti99, Windows, Xenix, Aos, Chorus, Geos, Inferno, Lantastic, Lynx, Mach, Minix, Netware, Os9, Parix, Plan9, Psos, Qnx, Xinu, Sco, Unix, Aix, Aux, 386bsd, Bsdi, Freebsd, Netbsd, Openbsd, Ultrix, Amd, Intel, Aptiva, Buz, Deals, Homebuilt, Overclocking, Programming, Extra forums


Copyright © 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
666