Code Monkey home page Code Monkey logo

bubbly's Introduction

Bubbly

For configuring Certbot with Nginx as quickly and securely as possible.

Normal Code Climate

If you want an instant A+ score on Qualys SSL Labs and A score on SecurityHeaders.io, then this is what you'll need to do. You won't need any familiarity with Certbot, Let's Encrypt, the ACME spec, or SSL in general, just basic Nginx configuration.

1. Install Certbot and Clone Bubbly

We'll start off by cloning the project into the home folder with git.

cd &&
sudo apt install git certbot &&
git clone https://github.com/eustasy/bubbly

2. Generate Statics

Generate the static keys once per server.

~/bubbly/bubbly_generate-statics.sh

As it will warn, this will take a while.

Have a seat.

3. Copy config blocks

When you've gone and made something in the 15 minutes that could well take, or you've just set up a new SSH session, copy the Nginx configuration over to the Nginx area.

~/bubbly/bubbly_copy-configs.sh

4. Configure & Enable Verification

Copy the verification site template and replace the instances of example.com in the file with your actual domain name.

sudo cp /etc/nginx/sites-available/bubbly_verify.conf /etc/nginx/sites-available/example.com.conf
sudo nano /etc/nginx/sites-available/example.com.conf

Use Ctrl and \ to initiate a search and replace for example.com with your domain.

sudo ln -s /etc/nginx/sites-available/example.com.conf /etc/nginx/sites-enabled/example.com.conf
sudo nginx -t && sudo service nginx reload

Alternatively, you can simply add include location/bubbly_well-known-passthrough.conf; to an existing site you want to continue working while we upgrade.

5. Fetch Certificates

Fetch your certificates like this:

~/bubbly/bubbly_renew-ssl.sh -d example.com -d www.example.com

It will ask for the root password, and an email address, so hang around, it shouldn't take more than a few seconds.

6. Start using the Certificates

Remove the verification config you just made, and replace it with a live version of the site. You'll need to more carefully review the [OPTION]s in this file, as you'll also need to change the certificate location to match the domain name you requested. Consider taking a look at the [OPTION]s and [WARNING]s in other linked config files.

sudo rm /etc/nginx/sites-available/example.com.conf
sudo cp /etc/nginx/sites-available/bubbly_live.conf /etc/nginx/sites-available/example.com.conf
sudo nano /etc/nginx/sites-available/example.com.conf

Use Ctrl and \ to initiate a search and replace for example.com with your domain.

sudo nginx -t && sudo service nginx reload

7. Automate Renewal

Edit crontab.conf and append it to your existing cron jobs for automatic renewal. This is important, since Let's Encrypt certificates expire in three months.

nano ~/bubbly/crontab.conf
cat ~/bubbly/crontab.conf > /tmp/bubbly-crontab
crontab -l >> /tmp/bubbly-crontab
crontab /tmp/bubbly-crontab

Screenshot of SSLLabs.com

Screenshot of SecurityHeaders.io

bubbly's People

Contributors

alx avatar audreyt avatar lewisgoddard avatar nallonp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bubbly's Issues

Speed up DH Parameter generation.

Option 1: Use the dsaparam flag on generation.

The reasonable solution would be to add the -dsaparam option.

openssl dhparam -dsaparam -out /etc/ssl/private/dhparam.pem 4096

This option instructs OpenSSL to produce "DSA-like" DH parameters (p is such that p-1 is a multiple of a smaller prime q, and the generator has multiplicative order q). This is considerably faster because it does not need to nest the primality tests, and thus only thousands, not millions, of candidates will be generated and tested.

As far as academics know, DSA-like parameters for DH are equally secure; there is no actual advantage to using "strong primes" (the terminology is traditional and does not actually imply some extra strength).

Similarly, you may also use a 2048-bit modulus, which is already very far into the "cannot break it zone". The 4096-bit modulus will make DH computations slower (which is not a real problem for a VPN; these occur only at the start of the connection), but won't actually improve security.

To some extent, a 4096-bit modulus may woo auditors, but auditors are unlikely to be much impressed by a Raspberry-Pi, which is way too cheap anyway.

Source

Option 2. Use a service

curl https://2ton.com.au/dhparam/4096

Option 3. Install a randomness generator like rng-tools

See https://www.cyberciti.biz/open-source/debian-ubuntu-centos-linux-setup-additional-entropy-for-server-using-aveged-rng-tools-utils/

FEATURE: Turn off server version identification.

Expected behavior

Nginx does not publicly report its version.

Actual behavior

Nginx publicly reports its version.

Steps to reproduce the behavior

  1. Request anything from an Nginx installation configured with Bubbly.
  2. Check header "Server"

FEATURE: Expect-CT Header

As Google is abandoning HPKP in favour of the Expect-CT header, we should implement that instead.

This makes things much easier, as it works like CSP but for Certificate Transparency. No more hashing certificates and updating a file.

Expect-CT: max-age=0, report-uri="https://scotthelme.report-uri.io/r/default/ct/reportOnly"
Expect-CT: enforce,max-age=30,report-uri="https://scotthelme.report-uri.io/r/default/ct/enforce"

PHP 7.2 Support

  • Add option with default socket location
  • Are 7.0/7.1 still supported? If not, remove them as options.

FEATURE: Public Key Pinning (HPKP)

Roadmap

  • Generate hashes when the keys are updated.
  • Replace hashes for automatic HPKP configuration in nginx-config/directive/bubbly_hpkp.conf
  • Default to report only for safety, with documented options and warnings in-configuration.
  • Secondary option with short life, due to short certificate life.
  • Add documentation to README.md

References

There is no CONTRIBUTING.md

Expected behavior

There should be a CONTRIBUTING.md file within .github.

Actual behavior

There is not.


  • Add a CONTRIBUTING.md file.
  • Contributing Description
  • Making Changes
  • Filing an Issue
  • Creating a Pull Request
  • Current State
  • Document Cipher Sources
  • Document Headers
  • Document contact points

nginx: [emerg] zero size shared memory zone "servers" error

Hello,
$ nginx -v
nginx version: nginx/1.15.12

$ nginx -V

built by gcc 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04.4)
built with OpenSSL 1.0.2q  20 Nov 2018
TLS SNI support enabled
configure arguments: --add-module=../ngx_cache_purge --add-module=../nginx-rtmp-module --with-http_stub_status_module --with-http_ssl_module --sbin-path=/usr/sbin/nginx --lock-path=/var/run/nginx.lock --conf-path=/etc/nginx/nginx.conf --pid-path=/run/nginx.pid --with-pcre=../pcre-8.4* --with-zlib=../zlib-1.2.11 --with-openssl=../openssl-1.0.2q --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --user=nginx --group=nginx --with-http_auth_request_module --with-http_degradation_module --with-http_geoip_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_image_filter_module --with-http_mp4_module --with-http_perl_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_v2_module --with-stream_ssl_module --with-stream --with-threads --prefix=/etc/nginx

$ sudo nginx -t && sudo service nginx reload

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: [emerg] zero size shared memory zone "servers"
nginx: configuration file /etc/nginx/nginx.conf test failed

PS: I do not see sites-enabled directory under /etc/nginx
Could you please let me know what I missed?

Thank you
Bombolini

Setting up multiple domains

This has been an outstanding resource. Thank you!

The nginx configuration seems to break down after one domain instance per server, though. For example, the configuration works (mostly) out of the box for domain.com. (I swapped SPDY for HTTP/2 and added WebSockets support, but that's it.)

If I apply the same procedure with blog.domain.com (with a different Let's Encrypt certificate, obviously) and run them simultaneously, I get this nginx alert:

 * Restarting nginx nginx
nginx: [emerg] duplicate listen options for [::]:80 in /etc/nginx/conf.d/wordpress.conf:3

What would you recommend to permit n servers with n certificates to run simultaneously and independently on SSL/{SPDY|HTTP2}?

Invalid nginx configuration

The nginx configuration in this repo isn't valid when loaded into my copy of nginx (Ubuntu 14.04, v1.9.7). It complains:

nginx: [emerg] duplicate listen options for [::]:443 in /etc/nginx/conf.d/diplio.conf:21

I'm mostly an nginx n00b still, but at first glance I would agree with it: the second server block clashes with the third. Commenting out the second block works, and pages are served as expected.

(To be clear, this is with one server environment, unlike ticket #2.)

Error on step 8 with Nginx 1.4.6

nginx: [emerg] invalid parameter "http2" in /etc/nginx/sites-enabled/nginx.conf:25
nginx: configuration file /etc/nginx/nginx.conf test failed

I do not support http2, so I disabled it

server {
        #listen 443 ssl http2;
        #listen [::]:443 ssl http2;
        listen 443 ssl;
        listen [::]:443 ssl;
...

Then I got error

nginx: [emerg] unknown directive "ssl_session_tickets" in /etc/nginx/sites-enabled/nginx.conf:51

I also disabled them. Then got

# nginx -t
nginx: [emerg] BIO_new_file("/etc/letsencrypt/live/%MYSITE%/fullchain.pem") failed (SSL: error:02001002:system library:fopen:No such file or directory:fopen('/etc/letsencrypt/live/%MYSITE%/fullchain.pem','r') error:2006D080:BIO routines:BIO_new_file:no such file)
nginx: configuration file /etc/nginx/nginx.conf test failed
# nginx -v
nginx version: nginx/1.4.6 (Ubuntu)
# uname -a
Linux ubuntu-512mb-ams2-01-arendude 3.13.0-79-generic #123-Ubuntu SMP Fri Feb 19 14:27:58 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.