Bitcoin Forum
June 22, 2024, 05:06:55 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1] 2 »  All
  Print  
Author Topic: Anyone help me with SSL (CLOSED)  (Read 906 times)
squall1066 (OP)
Copper Member
Legendary
*
Offline Offline

Activity: 2310
Merit: 1032


View Profile
May 06, 2015, 04:14:01 PM
Last edit: May 08, 2015, 03:26:04 PM by squall1066
 #1

Hiya all, Sorry, but this is strictly high trust longstanding members only. It's not much but it's my site, I will reset all passwords after use.

I might consider someone guiding me step by step.

Basically, I am installing an SSL cert on apache2 server, I have generated CSR and received the four comodo files and made the server.crt file, But thats where I am stuck, I dont know where it goes or how to activate it on the VPS.

No I will not use a cloud.

Let me know what your price is.
Bitsky
Hero Member
*****
Offline Offline

Activity: 576
Merit: 514


View Profile
May 06, 2015, 04:46:13 PM
 #2

That should get you started

Code:
<VirtualHost 1.2.3.4:80>
ServerName example.net
ServerAlias www.example.net
Redirect permanent / https://www.example.net/
</VirtualHost>
<VirtualHost 1.2.3.4:443>
ServerName example.net
ServerAlias www.example.net
DocumentRoot /var/www/example.net/
SSLEngine On
SSLCertificateFile /etc/httpd/ssl.d/example.net.crt
SSLCertificateKeyFile /etc/httpd/ssl.d/example.net.key
SSLCACertificateFile /etc/httpd/ssl.d/intermediate.crt
</VirtualHost>

Bounty: Earn up to 68.7 BTC
Like my post? Feel free to drop a tip to 1BitskyZbfR4irjyXDaGAM2wYKQknwX36Y
squall1066 (OP)
Copper Member
Legendary
*
Offline Offline

Activity: 2310
Merit: 1032


View Profile
May 06, 2015, 07:00:12 PM
 #3

That should get you started

Code:
<VirtualHost 1.2.3.4:80>
ServerName example.net
ServerAlias www.example.net
Redirect permanent / https://www.example.net/
</VirtualHost>
<VirtualHost 1.2.3.4:443>
ServerName example.net
ServerAlias www.example.net
DocumentRoot /var/www/example.net/
SSLEngine On
SSLCertificateFile /etc/httpd/ssl.d/example.net.crt
SSLCertificateKeyFile /etc/httpd/ssl.d/example.net.key
SSLCACertificateFile /etc/httpd/ssl.d/intermediate.crt
</VirtualHost>

too far ahead, I am at this point


Find the Apache config file to edit.

Ubuntu's Apache configuration file for your ssl site is typically found in /etc/apache2/sites-enabled/your_site_name. If it is not found in the 'sites-enabled' folder, you would need to run the command sudo a2ensite your_site_name.

my site is not under the sites-enabled and the sudo command does not work "command not found"
Bitsky
Hero Member
*****
Offline Offline

Activity: 576
Merit: 514


View Profile
May 06, 2015, 07:15:32 PM
 #4

Not an Ubuntu user myself, but on Redhat you can get vhost information by running "httpd -S"; could be "apache2ctl -S" on Ubuntu.


Bounty: Earn up to 68.7 BTC
Like my post? Feel free to drop a tip to 1BitskyZbfR4irjyXDaGAM2wYKQknwX36Y
nomadcrypto
Sr. Member
****
Offline Offline

Activity: 387
Merit: 264



View Profile
May 06, 2015, 09:53:02 PM
 #5

1) copy the default vhost in /etc/apache2/sites-available/default-ssl.conf:

Code:
sudo cp /etc/apache2/sites-available/default-ssl.conf /etc/apache2/sites-available/001-yourdomain.conf

2)make the edits mentioned previously by Bitsky - just edit the relevant paths in your new 001-yourdomain.conf

3) enable the domain
Code:
sudo a2ensite 001-yourdomain.conf

RE: sudo not found

Can you post the output of the following?:
Code:
whereis sudo
squall1066 (OP)
Copper Member
Legendary
*
Offline Offline

Activity: 2310
Merit: 1032


View Profile
May 07, 2015, 01:40:57 PM
 #6



RE: sudo not found

Can you post the output of the following?:
Code:
whereis sudo

Code:
root@Squall:~# whereis sudo
sudo:
root@Squall:~#
squall1066 (OP)
Copper Member
Legendary
*
Offline Offline

Activity: 2310
Merit: 1032


View Profile
May 07, 2015, 01:47:38 PM
 #7

I just installed it so now its:-

Code:
root@Squall:/# whereis sudo
sudo: /usr/bin/sudo /usr/lib/sudo /usr/share/man/man8/sudo.8.gz
root@Squall:/#
squall1066 (OP)
Copper Member
Legendary
*
Offline Offline

Activity: 2310
Merit: 1032


View Profile
May 07, 2015, 01:54:15 PM
 #8

my site is not in /etc/apache2/sites-enabled/ but there is a folder with the site name on that is a shortcut link to somewhere, but I cant open or goto the link.

I run sudo a2ensite "sitename" but it returns with "sitename" does not exist.


Just so you know, I am following this guide.

https://www.digicert.com/ssl-certificate-installation-ubuntu-server-with-apache2.htm

I am at step 2, I just cant find the file to edit, or create it.
Muhammed Zakir
Hero Member
*****
Offline Offline

Activity: 560
Merit: 506


I prefer Zakir over Muhammed when mentioning me!


View Profile WWW
May 07, 2015, 02:05:42 PM
 #9

Did you check if there is any typos in site's name in the command?

P.S. What are you getting when you run whereis <site's name>?

squall1066 (OP)
Copper Member
Legendary
*
Offline Offline

Activity: 2310
Merit: 1032


View Profile
May 07, 2015, 02:13:33 PM
 #10

Did you check if there is any typos in site's name in the command?

yes, The ghost file that I found that leads to nowhere did start off 000-www.mysite.conf I tried this aswell but nothing, I cant do anything with this "ghost" file, I cand move/del/edit nothing, I'm stumped.  I use filezilla BTW, so I see it as a windows directory would show it, any I run command with putty.
nomadcrypto
Sr. Member
****
Offline Offline

Activity: 387
Merit: 264



View Profile
May 07, 2015, 04:43:10 PM
Last edit: May 07, 2015, 04:57:41 PM by nomadcrypto
 #11

Did you check if there is any typos in site's name in the command?

yes, The ghost file that I found that leads to nowhere did start off 000-www.mysite.conf I tried this aswell but nothing, I cant do anything with this "ghost" file, I cand move/del/edit nothing, I'm stumped.  I use filezilla BTW, so I see it as a windows directory would show it, any I run command with putty.

That ghost file is a symbolic link to some other file which may or may not exist(im guessing?). Your vhost should be in /etc/apache2/sites-available and the "a2ensite" script simply creates a symbolic link for it in /etc/apache2/sites-enabled.


If I were you I would just start over. Here is a step by step command list:

remove the current symbolic link
Code:
sudo unlink /etc/apache2/sites-enabled/{Your old vhost}.conf

or

Code:
sudo rm -rf /etc/apache2/sites-enabled/{the weird directory you mentioned}

^ make sure you verify the path. you don't want to accidentally delete the wrong directory.

copy the default ssl vhost in /etc/apache2/sites-available/default-ssl.conf:
Code:
sudo cp /etc/apache2/sites-available/default-ssl.conf /etc/apache2/sites-available/001-yourdomain.conf

uncomment/edit the relevant paths in your new 001-yourdomain.conf(DocumentRoot,  SSLCertificateFile, SSLCertificateKeyFile, etc)
Code:
<IfModule mod_ssl.c>
<VirtualHost _default_:443>
ServerAdmin webmaster@localhost

DocumentRoot /var/www/html

# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf

#   SSL Engine Switch:
#   Enable/Disable SSL for this virtual host.
SSLEngine on

#   A self-signed (snakeoil) certificate can be created by installing
#   the ssl-cert package. See
#   /usr/share/doc/apache2/README.Debian.gz for more info.
#   If both key and certificate are stored in the same file, only the
#   SSLCertificateFile directive is needed.
SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem
SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key

#   Server Certificate Chain:
#   Point SSLCertificateChainFile at a file containing the
#   concatenation of PEM encoded CA certificates which form the
#   certificate chain for the server certificate. Alternatively
#   the referenced file can be the same as SSLCertificateFile
#   when the CA certificates are directly appended to the server
#   certificate for convinience.
#SSLCertificateChainFile /etc/apache2/ssl.crt/server-ca.crt

#   Certificate Authority (CA):
#   Set the CA certificate verification path where to find CA
#   certificates for client authentication or alternatively one
#   huge file containing all of them (file must be PEM encoded)
#   Note: Inside SSLCACertificatePath you need hash symlinks
# to point to the certificate files. Use the provided
# Makefile to update the hash symlinks after changes.
#SSLCACertificatePath /etc/ssl/certs/
#SSLCACertificateFile /etc/apache2/ssl.crt/ca-bundle.crt

#   Certificate Revocation Lists (CRL):
#   Set the CA revocation path where to find CA CRLs for client
#   authentication or alternatively one huge file containing all
#   of them (file must be PEM encoded)
#   Note: Inside SSLCARevocationPath you need hash symlinks
# to point to the certificate files. Use the provided
# Makefile to update the hash symlinks after changes.
#SSLCARevocationPath /etc/apache2/ssl.crl/
#SSLCARevocationFile /etc/apache2/ssl.crl/ca-bundle.crl

#   Client Authentication (Type):
#   Client certificate verification type and depth.  Types are
#   none, optional, require and optional_no_ca.  Depth is a
#   number which specifies how deeply to verify the certificate
#   issuer chain before deciding the certificate is not valid.
#SSLVerifyClient require
#SSLVerifyDepth  10

#   SSL Engine Options:
#   Set various options for the SSL engine.
#   o FakeBasicAuth:
# Translate the client X.509 into a Basic Authorisation.  This means that
# the standard Auth/DBMAuth methods can be used for access control.  The
# user name is the `one line' version of the client's X.509 certificate.
# Note that no password is obtained from the user. Every entry in the user
# file needs this password: `xxj31ZMTZzkVA'.
#   o ExportCertData:
# This exports two additional environment variables: SSL_CLIENT_CERT and
# SSL_SERVER_CERT. These contain the PEM-encoded certificates of the
# server (always existing) and the client (only existing when client
# authentication is used). This can be used to import the certificates
# into CGI scripts.
#   o StdEnvVars:
# This exports the standard SSL/TLS related `SSL_*' environment variables.
# Per default this exportation is switched off for performance reasons,
# because the extraction step is an expensive operation and is usually
# useless for serving static content. So one usually enables the
# exportation for CGI and SSI requests only.
#   o OptRenegotiate:
# This enables optimized SSL connection renegotiation handling when SSL
# directives are used in per-directory context.
#SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire
<FilesMatch "\.(cgi|shtml|phtml|php)$">
SSLOptions +StdEnvVars
</FilesMatch>
<Directory /usr/lib/cgi-bin>
SSLOptions +StdEnvVars
</Directory>

#   SSL Protocol Adjustments:
#   The safe and default but still SSL/TLS standard compliant shutdown
#   approach is that mod_ssl sends the close notify alert but doesn't wait for
#   the close notify alert from client. When you need a different shutdown
#   approach you can use one of the following variables:
#   o ssl-unclean-shutdown:
# This forces an unclean shutdown when the connection is closed, i.e. no
# SSL close notify alert is send or allowed to received.  This violates
# the SSL/TLS standard but is needed for some brain-dead browsers. Use
# this when you receive I/O errors because of the standard approach where
# mod_ssl sends the close notify alert.
#   o ssl-accurate-shutdown:
# This forces an accurate shutdown when the connection is closed, i.e. a
# SSL close notify alert is send and mod_ssl waits for the close notify
# alert of the client. This is 100% SSL/TLS standard compliant, but in
# practice often causes hanging connections with brain-dead browsers. Use
# this only for browsers where you know that their SSL implementation
# works correctly.
#   Notice: Most problems of broken clients are also related to the HTTP
#   keep-alive facility, so you usually additionally want to disable
#   keep-alive for those clients, too. Use variable "nokeepalive" for this.
#   Similarly, one has to force some clients to use HTTP/1.0 to workaround
#   their broken HTTP/1.1 implementation. Use variables "downgrade-1.0" and
#   "force-response-1.0" for this.
BrowserMatch "MSIE [2-6]" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
# MSIE 7 and newer should be able to use keepalive
BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown

</VirtualHost>
</IfModule>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
3) enable the domain
Code:
sudo a2ensite 001-yourdomain.conf

I know this is probably like reading greek(assuming you don't read greek Tongue) right now but ubuntu really makes it a breeze to run a basic lamp setup once you figure it out.

edit
if you would like I can walk you through this on a teamviewer session or something.
Muhammed Zakir
Hero Member
*****
Offline Offline

Activity: 560
Merit: 506


I prefer Zakir over Muhammed when mentioning me!


View Profile WWW
May 07, 2015, 06:19:33 PM
 #12

-snip-

Code:
sudo rm -rf /etc/apache2/sites-enabled/{the weird directory you mentioned}

^ make sure you verify the path. you don't want to accidentally delete the wrong directory.
 -snip-

I highly recommend you to copy all the files in 'sites-enabled' before you try to run the above command. Using -a when running cp command is recommended.

squall1066 (OP)
Copper Member
Legendary
*
Offline Offline

Activity: 2310
Merit: 1032


View Profile
May 07, 2015, 06:27:15 PM
 #13

Every web dev who wants some sort of SSL has to go through this  Roll Eyes Geeez Louise!

There no easier way?  Tongue

K give me some time, I will do this later when I am set up mentally  Undecided
nomadcrypto
Sr. Member
****
Offline Offline

Activity: 387
Merit: 264



View Profile
May 07, 2015, 06:30:42 PM
 #14

-snip-

Code:
sudo rm -rf /etc/apache2/sites-enabled/{the weird directory you mentioned}

^ make sure you verify the path. you don't want to accidentally delete the wrong directory.
 -snip-

I highly recommend you to copy all the files in 'sites-enabled' before you try to run the above command. Using -a when running cp command is recommended.

if one follows the standards for setting up a vhost in ubuntu there shouldn't be anything in that directory except for symbolic links to config files located in sites-available.
Reynaldo
Legendary
*
Offline Offline

Activity: 1143
Merit: 1000


View Profile
May 07, 2015, 06:44:20 PM
 #15

When I've any issue with my linux box I usually check the arch linux wiki, it should apply to the latest updated linux distro and would only vary if ubuntu uses some different files for configuration (this might be the case); Take a read on https://wiki.archlinux.org/index.php/Apache_HTTP_Server and see if you can find anything there

the exact part regarding ssl

Code:
To use TLS/SSL, you will need to install openssl.
Create a private key and certificate signing request (CSR) and optionally self-sign the CSR (which creates a certificate):
Note: You may want to change the key size in bits (rsa_keygen_bits:2048), remove -sha256 to use SHA-1 instead of SHA-2, or change the number of days of validity (-days 365).
# cd /etc/httpd/conf
# openssl genpkey -algorithm RSA -pkeyopt rsa_keygen_bits:2048 -out server.key
# chmod 600 server.key
# openssl req -new -sha256 -key server.key -out server.csr
# openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
Then, in /etc/httpd/conf/httpd.conf, uncomment the following three lines:
LoadModule ssl_module modules/mod_ssl.so
LoadModule socache_shmcb_module modules/mod_socache_shmcb.so
Include conf/extra/httpd-ssl.conf
Warning: Some variations and implementations of SSL and TLS are vulnerable to attack. Mozilla has a useful SSL/TLS article which includes Apache specific configuration guidelines as well as an automated tool to help create a more secure configuration.
Restart httpd.service to apply any changes.
Bitsky
Hero Member
*****
Offline Offline

Activity: 576
Merit: 514


View Profile
May 07, 2015, 07:41:53 PM
 #16

Every web dev who wants some sort of SSL has to go through this  Roll Eyes Geeez Louise!

There no easier way?  Tongue

K give me some time, I will do this later when I am set up mentally  Undecided
That's why I only run CentOS/RHEL on all my servers and admin them via SSH only.
Never understood why Debian/Ubuntu would do crap like symlinking configs.

Bounty: Earn up to 68.7 BTC
Like my post? Feel free to drop a tip to 1BitskyZbfR4irjyXDaGAM2wYKQknwX36Y
Abdussamad
Legendary
*
Offline Offline

Activity: 3640
Merit: 1571



View Profile
May 08, 2015, 12:19:15 AM
 #17

I just installed it so now its:-

Code:
root@Squall:/# whereis sudo
sudo: /usr/bin/sudo /usr/lib/sudo /usr/share/man/man8/sudo.8.gz
root@Squall:/#

sudo is used to execute commands as another user. It's used on servers where root login is disabled and instead people login as an unprivileged user and use sudo to execute commands as root user.

In your case since you are already logged in as root you can omit the use of sudo.

Commodo has some excellent documentation that you should refer to instead of asking on random forums for help:

https://support.comodo.com/index.php?/Default/Knowledgebase/Article/View/637/37/certificate-installation-apache--mod_ssl

If you need someone to install it for you then PM me and I'll do it for a reasonable fee.
Rmcdermott927
Legendary
*
Offline Offline

Activity: 2254
Merit: 1140


View Profile
May 08, 2015, 05:51:53 AM
 #18

Hiya all, Sorry, but this is strictly high trust longstanding members only. It's not much but it's my site, I will reset all passwords after use.

I might consider someone guiding me step by step.

Basically, I am installing an SSL cert on apache2 server, I have generated CSR and received the four comodo files and made the server.crt file, But thats where I am stuck, I dont know where it goes or how to activate it on the VPS.

No I will not use a cloud.

Let me know what your price is.

Squall, what is a little tricky is that the intermediate certificates need to be combined in exactly the right order.  I'm not sure which particular Comodo cert you have, but mine had three intermediates.    Take a look here: https://support.comodo.com/index.php?/Default/Knowledgebase/Article/View/643/17/

squall1066 (OP)
Copper Member
Legendary
*
Offline Offline

Activity: 2310
Merit: 1032


View Profile
May 08, 2015, 10:04:09 AM
 #19


Squall, what is a little tricky is that the intermediate certificates need to be combined in exactly the right order.  I'm not sure which particular Comodo cert you have, but mine had three intermediates.    Take a look here: https://support.comodo.com/index.php?/Default/Knowledgebase/Article/View/643/17/

Yes, I have the same, I managed to compile fine using cat command.



sudo is used to execute commands as another user. It's used on servers where root login is disabled and instead people login as an unprivileged user and use sudo to execute commands as root user.

In your case since you are already logged in as root you can omit the use of sudo.

Commodo has some excellent documentation that you should refer to instead of asking on random forums for help:

https://support.comodo.com/index.php?/Default/Knowledgebase/Article/View/637/37/certificate-installation-apache--mod_ssl

If you need someone to install it for you then PM me and I'll do it for a reasonable fee.

Thats a little beyond me, How does that work? As I have root access but still need sudo to run certain commands to get this job done?

whats your idea of a reasonable fee  Grin
squall1066 (OP)
Copper Member
Legendary
*
Offline Offline

Activity: 2310
Merit: 1032


View Profile
May 08, 2015, 03:25:48 PM
 #20

closed,

I am not clever enough, I have been on it two weeks and made Major stupid mistakes, and my site is not popular enough to do this every year.

I have nearly lost my site due to my errors, no one wants my money, so I will just cloud my site with free SSL

discretion is the better part of valor.

Thanks all
Pages: [1] 2 »  All
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!