Linux - Server This forum is for the discussion of Linux Software used in a server related context. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
07-01-2010, 12:46 PM
|
#1
|
Member
Registered: Sep 2007
Location: Florida
Distribution: Raspbian, Debian, CentOS, Ubuntu
Posts: 131
Rep:
|
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.
|
|
|
07-02-2010, 12:30 AM
|
#2
|
Member
Registered: Jun 2010
Posts: 361
Rep:
|
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
|
|
|
07-02-2010, 08:12 AM
|
#3
|
Member
Registered: Sep 2007
Location: Florida
Distribution: Raspbian, Debian, CentOS, Ubuntu
Posts: 131
Original Poster
Rep:
|
Thanks man!
Quote:
Originally Posted by zirias
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!
|
|
|
07-06-2010, 10:30 AM
|
#4
|
Member
Registered: Sep 2007
Location: Florida
Distribution: Raspbian, Debian, CentOS, Ubuntu
Posts: 131
Original Poster
Rep:
|
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.
|
|
|
07-06-2010, 10:38 AM
|
#5
|
Member
Registered: Jun 2010
Posts: 361
Rep:
|
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?
|
|
|
07-06-2010, 01:33 PM
|
#6
|
Member
Registered: Sep 2007
Location: Florida
Distribution: Raspbian, Debian, CentOS, Ubuntu
Posts: 131
Original Poster
Rep:
|
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.
|
|
|
07-06-2010, 01:39 PM
|
#7
|
Member
Registered: Jun 2010
Posts: 361
Rep:
|
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....
|
|
|
07-06-2010, 02:11 PM
|
#8
|
Member
Registered: Sep 2007
Location: Florida
Distribution: Raspbian, Debian, CentOS, Ubuntu
Posts: 131
Original Poster
Rep:
|
Quote:
Originally Posted by zirias
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 
|
|
|
07-06-2010, 03:24 PM
|
#9
|
Member
Registered: Sep 2007
Location: Florida
Distribution: Raspbian, Debian, CentOS, Ubuntu
Posts: 131
Original Poster
Rep:
|
Quote:
Originally Posted by zirias
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.
|
|
|
07-06-2010, 10:13 PM
|
#10
|
Member
Registered: Jun 2010
Posts: 361
Rep:
|
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.
|
|
|
07-07-2010, 02:05 PM
|
#11
|
Member
Registered: Sep 2007
Location: Florida
Distribution: Raspbian, Debian, CentOS, Ubuntu
Posts: 131
Original Poster
Rep:
|
Quote:
Originally Posted by zirias
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.
|
|
|
10-19-2010, 01:17 PM
|
#12
|
LQ Newbie
Registered: Aug 2006
Posts: 1
Rep:
|
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.
|
|
|
All times are GMT -5. The time now is 04:33 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|