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

set sane default shell for consul user #388

Merged
merged 1 commit into from
Dec 4, 2017
Merged
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
3 changes: 3 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@
# [*watches*]
# Hash of consul::watch resources to create.
#
# [*shell*]
# The shell for the consul user. Defaults to something that prohibits login, like /usr/sbin/nologin
# === Examples
#
# @example
Expand Down Expand Up @@ -189,6 +191,7 @@
$user = $consul::params::user,
$version = $consul::params::version,
Hash $watches = $consul::params::watches,
Optional[String] $shell = $consul::params::shell,
) inherits consul::params {

# lint:ignore:140chars
Expand Down
1 change: 1 addition & 0 deletions manifests/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@
ensure => 'present',
system => true,
groups => $consul::extra_groups,
shell => $consul::shell,
}

if ($consul::manage_group) and ($consul::install_method != 'docker' ) {
Expand Down
8 changes: 8 additions & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
$os = downcase($::kernel)

if $::operatingsystem == 'Ubuntu' {
$shell = '/usr/sbin/nologin'
if versioncmp($::operatingsystemrelease, '8.04') < 1 {
$init_style = 'debian'
} elsif versioncmp($::operatingsystemrelease, '15.04') < 0 {
Expand All @@ -65,6 +66,7 @@
$init_style = 'systemd'
}
} elsif $::osfamily == 'RedHat' {
$shell = '/sbin/nologin'
case $::operatingsystem {
'Fedora': {
if versioncmp($::operatingsystemrelease, '12') < 0 {
Expand All @@ -85,25 +87,31 @@
}
}
} elsif $::operatingsystem == 'Debian' {
$shell = '/usr/sbin/nologin'
if versioncmp($::operatingsystemrelease, '8.0') < 0 {
$init_style = 'debian'
} else {
$init_style = 'systemd'
}
} elsif $::operatingsystem == 'Archlinux' {
$shell = '/sbin/nologin'
$init_style = 'systemd'
} elsif $::operatingsystem == 'OpenSuSE' {
$shell = '/usr/sbin/nologin'
$init_style = 'systemd'
} elsif $::operatingsystem =~ /SLE[SD]/ {
$shell = '/usr/sbin/nologin'
if versioncmp($::operatingsystemrelease, '12.0') < 0 {
$init_style = 'sles'
} else {
$init_style = 'systemd'
}
} elsif $::operatingsystem == 'Darwin' {
$shell = undef
$init_style = 'launchd'
} elsif $::operatingsystem == 'FreeBSD' {
$init_style = 'freebsd'
$shell = '/usr/sbin/nologin'
} else {
fail('Cannot determine init_style, unsupported OS')
}
Expand Down