Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

create ssl cert per vhost, not one monster #2129

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 0 additions & 31 deletions puppet/modules/web/manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -15,37 +15,6 @@
letsencrypt => $https,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer to drop this parameter and move the inclusion into the vhost:

if $letsencrypt {
include web::letsencrypt
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That will break using web::base with HTTPS directly, like it's done by redmine and profiles::jenkins::controller, as those do not use web::vhost.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we modify those to also include the base? I think b31f6de should work and makes it all more consistent.

}

if $https {
$letsencypt_domain = 'theforeman.org'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like there was a typo here, but at least it was used consistently.


letsencrypt::certonly { $letsencypt_domain:
plugin => 'webroot',
# domain / webroot_paths must match exactly
domains => [
'theforeman.org',
'archivedeb.theforeman.org',
'deb.theforeman.org',
'debugs.theforeman.org',
'downloads.theforeman.org',
'stagingdeb.theforeman.org',
'www.theforeman.org',
'yum.theforeman.org',
'stagingyum.theforeman.org',
],
webroot_paths => [
'/var/www/vhosts/web/htdocs',
'/var/www/vhosts/archivedeb/htdocs',
'/var/www/vhosts/deb/htdocs',
'/var/www/vhosts/debugs/htdocs',
'/var/www/vhosts/downloads/htdocs',
'/var/www/vhosts/stagingdeb/htdocs',
'/var/www/vhosts/web/htdocs',
'/var/www/vhosts/yum/htdocs',
'/var/www/vhosts/stagingyum/htdocs',
],
}
}

if $facts['os']['selinux']['enabled'] {
include selinux

Expand Down
14 changes: 10 additions & 4 deletions puppet/modules/web/manifests/vhost.pp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@
}

if $web::https {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As noted above, let's include the prerequisite here

Suggested change
if $web::https {
if $web::https {
include web::letsencrypt

letsencrypt::certonly { $servername:
plugin => 'webroot',
domains => [$servername] + $serveraliases,
webroot_paths => [$docroot],
}

apache::vhost { "${title}-https":
servername => $servername,
serveraliases => $serveraliases,
Expand All @@ -62,10 +68,10 @@
docroot_mode => $docroot_mode,
port => 443,
ssl => true,
ssl_cert => "${letsencrypt::config_dir}/live/${web::letsencypt_domain}/cert.pem",
ssl_chain => "${letsencrypt::config_dir}/live/${web::letsencypt_domain}/chain.pem",
ssl_key => "${letsencrypt::config_dir}/live/${web::letsencypt_domain}/privkey.pem",
require => Letsencrypt::Certonly[$web::letsencypt_domain],
ssl_cert => "${letsencrypt::config_dir}/live/${servername}/cert.pem",
ssl_chain => "${letsencrypt::config_dir}/live/${servername}/chain.pem",
ssl_key => "${letsencrypt::config_dir}/live/${servername}/privkey.pem",
require => Letsencrypt::Certonly[$servername],
* => $attrs,
}
}
Expand Down