LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 07-01-2010, 12:46 PM   #1
mtlhd
Member
 
Registered: Sep 2007
Location: Florida
Distribution: Raspbian, Debian, CentOS, Ubuntu
Posts: 131

Rep: Reputation: 18
trying to proxy SSL requests to another port to hide port # in URL


Hey all,
Got a toughie.
At least it is for me.
server:
LAMP - debian, apache2, mysql, php5

a bit info on my network:
There is a another service here that already uses port 443 already. It made my website time out, hence the move to another port. PLus, i dont want the 2 services sharing the port.

What I am trying to do is forward 443 requests to another port where the SSL service is running so I can hide my port number in the URL.

Is there a way to make this happen?

Here is my sites available conf file:
Code:
NameVirtualHost *:80
NameVirtualHost *:443
NameVirtualHost *:####
DirectoryIndex index.htm index.html index.php

<VirtualHost *:80>
	ServerName www.mysite.com
	ServerAlias mysite.com
	ServerAdmin webmaster@mysite.com
	DocumentRoot /home/me/www/mysite
	<Directory />
		Options FollowSymLinks -Indexes
		AllowOverride None
		Order deny,allow
		allow from all
	</Directory>
	ErrorLog /var/log/apache2/error.log
	CustomLog /home/me/www/mysite/logs/access.log combined
	RewriteEngine On
	RewriteCond %{HTTP_HOST} ^(mysite.com|misite.com|www.misite.com) [NC]
	RewriteRule ^(.*)$ http://www.mysite.com$1 [R=301,L]
</VirtualHost>

<VirtualHost _default_:443>
	ServerName www.mysite.com
	ServerAlias mysite.com
	ServerAdmin webmaster@mysite.com
	SSLProxyEngine on
        RewriteEngine on
	ProxyPass / https://www.mysite.com:####/
	ProxyPassReverse / https://www.mysite.com:####/
</VirtualHost>

<VirtualHost _default_:####>
	ServerName www.mysite.com:####
        ServerAlias mysite.com
	ServerAdmin webmaster@mysite.com
	DocumentRoot /home/me/www/mysite
	<Directory />
		Options FollowSymLinks -Indexes
		AllowOverride None
		Order Allow,Deny
		Allow from all
	</Directory>
	ErrorLog /var/log/apache2/ssl-error.log
	CustomLog /home/me/www/mysite/logs/access.log combined
	SSLEngine on
	SSLCertificateFile /etc/apache2/ssl.crt/mysite.com.crt
	SSLCertificateKeyFile /etc/apache2/ssl.key/mysite.com.key
</VirtualHost>

Last edited by mtlhd; 07-01-2010 at 12:54 PM.
 
Old 07-02-2010, 12:30 AM   #2
zirias
Member
 
Registered: Jun 2010
Posts: 361

Rep: Reputation: 59
No. Just used mod_gnutls instead of mod_ssl for https, it supports Server Name Indication in SSL handshake, most browsers support it too, so you will get name-based virtual hosts with SSL
 
Old 07-02-2010, 08:12 AM   #3
mtlhd
Member
 
Registered: Sep 2007
Location: Florida
Distribution: Raspbian, Debian, CentOS, Ubuntu
Posts: 131

Original Poster
Rep: Reputation: 18
Thanks man!

Quote:
Originally Posted by zirias View Post
No. Just used mod_gnutls instead of mod_ssl for https, it supports Server Name Indication in SSL handshake, most browsers support it too, so you will get name-based virtual hosts with SSL
Thank you for the idea, looking into it now!
 
Old 07-06-2010, 10:30 AM   #4
mtlhd
Member
 
Registered: Sep 2007
Location: Florida
Distribution: Raspbian, Debian, CentOS, Ubuntu
Posts: 131

Original Poster
Rep: Reputation: 18
GnuTLS giving me errors

GnuTLS: Failed to Import Private Key - ASN1 parser: Error in DER parsing.

here is my conf file:
Code:
#Mod_GNUTLS currently enabled
	GnuTLSEnable on
	GnuTLSCertificateFile /etc/apache2/ssl.crt/mysite.crt
	GnuTLSKeyFile /etc/apache2/ssl.key/mysite.key
	GnuTLSPriorities NORMAL
I'm not understanding the issue. This is a cert that was bought from a service.

Thanks in advance.
 
Old 07-06-2010, 10:38 AM   #5
zirias
Member
 
Registered: Jun 2010
Posts: 361

Rep: Reputation: 59
Hmm, I only use files in PEM format and have no such issues -- maybe you could try converting your key from DER to PEM format using the openssl commandline utility?
 
Old 07-06-2010, 01:33 PM   #6
mtlhd
Member
 
Registered: Sep 2007
Location: Florida
Distribution: Raspbian, Debian, CentOS, Ubuntu
Posts: 131

Original Poster
Rep: Reputation: 18
I dont know

Code:
OpenSSL> x509 -in mysite.crt -inform DER -out mysite_p.crt -outform PEM
unable to load certificate
482:error:0D0680A8:asn1 encoding routines:ASN1_CHECK_TLEN:wrong tag:tasn_dec.c:1306:
482:error:0D07803A:asn1 encoding routines:ASN1_ITEM_EX_D2I:nested asn1 error:tasn_dec.c:380:Type=X509
error in x509
That was the result, but when I just checked the crt, it reported back fine.
 
Old 07-06-2010, 01:39 PM   #7
zirias
Member
 
Registered: Jun 2010
Posts: 361

Rep: Reputation: 59
Hmm, but when OpenSSL /as well as/ GnuTLS have problems reading the file, there must be something broken in the file. So the same file actually DID work with mod_ssl? This is kind of surprising because mod_ssl uses OpenSSL, so OpenSSL should be capable of reading it....
 
Old 07-06-2010, 02:11 PM   #8
mtlhd
Member
 
Registered: Sep 2007
Location: Florida
Distribution: Raspbian, Debian, CentOS, Ubuntu
Posts: 131

Original Poster
Rep: Reputation: 18
Unhappy

Quote:
Originally Posted by zirias View Post
Hmm, but when OpenSSL /as well as/ GnuTLS have problems reading the file, there must be something broken in the file. So the same file actually DID work with mod_ssl? This is kind of surprising because mod_ssl uses OpenSSL, so OpenSSL should be capable of reading it....
Thank you for all your help thus far.

Yea, I was thinking the same thing. mod_ssl worked fine, even on another port, I just simply can not show the port on the URL and can't use 443 because something already sits on it.

I am not lucky
 
Old 07-06-2010, 03:24 PM   #9
mtlhd
Member
 
Registered: Sep 2007
Location: Florida
Distribution: Raspbian, Debian, CentOS, Ubuntu
Posts: 131

Original Poster
Rep: Reputation: 18
Quote:
Originally Posted by zirias View Post
Hmm, but when OpenSSL /as well as/ GnuTLS have problems reading the file, there must be something broken in the file. So the same file actually DID work with mod_ssl? This is kind of surprising because mod_ssl uses OpenSSL, so OpenSSL should be capable of reading it....
Is it possible the cert i bought is the problem???, I figured they were standard for either mod.
 
Old 07-06-2010, 10:13 PM   #10
zirias
Member
 
Registered: Jun 2010
Posts: 361

Rep: Reputation: 59
Wait, now I remember I once had problems with a bought cert with a GnuTLS build of exim (mailserver) while the OpenSSL build worked perfectly. In the end, I found out the cert was encoded in some PKCS format (PKCS12? I'm not sure any more) and while OpenSSL auto-detected that, GnuTLS assumed plain DER and failed. Could be the same thing for your cert. If this is the case, just "unpack" the PKCS with the OpenSSL commandline to get a plain PEM format cert and key.
 
Old 07-07-2010, 02:05 PM   #11
mtlhd
Member
 
Registered: Sep 2007
Location: Florida
Distribution: Raspbian, Debian, CentOS, Ubuntu
Posts: 131

Original Poster
Rep: Reputation: 18
Quote:
Originally Posted by zirias View Post
Wait, now I remember I once had problems with a bought cert with a GnuTLS build of exim (mailserver) while the OpenSSL build worked perfectly. In the end, I found out the cert was encoded in some PKCS format (PKCS12? I'm not sure any more) and while OpenSSL auto-detected that, GnuTLS assumed plain DER and failed. Could be the same thing for your cert. If this is the case, just "unpack" the PKCS with the OpenSSL commandline to get a plain PEM format cert and key.
Well, I was able to use OpenSSL to convert the crt file to a pem file, but I still got the same error that GnuTLS could not import the key file followed by '(-69) ASN1 parser: Error in DER parsing.'

Don't know what else to do.
 
Old 10-19-2010, 01:17 PM   #12
uhurusurfa
LQ Newbie
 
Registered: Aug 2006
Posts: 1

Rep: Reputation: 0
I have received the same error in the past when a certificate file already exists that it is trying to create. Deleting the old one got rid of the error.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Error parsing proxy URL http://localhost:4001 : Bad port number? lugoteehalt Linux - Networking 1 11-20-2009 06:58 PM
forwarding ssl port to a different ssl port number on a different machine coal-fire-ice Linux - Networking 6 03-15-2007 12:30 PM
Proxy server flodded by requests on port 53 & port 25 saurabh_sahni Linux - Security 5 04-26-2005 10:35 PM
Proxy server flodded by requests on port 53 & port 25 saurabh_sahni Linux - Networking 1 04-26-2005 03:01 PM
HTTP port and Proxy port problem AZIMBD03 Linux - Networking 3 04-15-2004 09:20 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 04:39 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration