From 7e8b03762f8768ba2fd7fec8ac171ffebafb076e Mon Sep 17 00:00:00 2001 From: Clark Boylan Date: Fri, 27 May 2016 10:40:05 -0700 Subject: [PATCH] Create a simpleproxy user Previously this depended on other things creating a logstash user which would enable this service to run. There is no logstash user created on these hosts any longer and it was bad to rely on that side effect of colocation anyways. Fix this by creating a user just for this service. Change-Id: I6b0779552d3c47f3bf27b1548599cfc6e9461dcb --- manifests/init.pp | 45 +++++++++++++++++++--------- templates/simpleproxy-mysql.init.erb | 2 +- 2 files changed, 32 insertions(+), 15 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 88d077f..285d0fc 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -15,23 +15,40 @@ # == Class: simpleproxy # class simpleproxy { + package { 'mysql-proxy': + ensure => absent, + } - package { 'mysql-proxy': - ensure => absent, - } + file { '/etc/mysql-proxy': + ensure => absent, + recurse => true, + force => true, + } - file { '/etc/mysql-proxy': - ensure => absent, - recurse => true, - force => true, - } + file { '/etc/default/mysql-proxy': + ensure => absent, + } - file { '/etc/default/mysql-proxy': - ensure => absent, - } + package { 'simpleproxy': + ensure => latest, + } - package { 'simpleproxy': - ensure => latest, - } + group { 'simpleproxy': + ensure => present, + system => true, + } + user { 'simpleproxy': + ensure => present, + system => true, + comment => 'Simple Proxy User', + home => '/usr/share/doc/simpleproxy', + gid => 'simpleproxy', + shell => '/bin/bash', + membership => 'minimum', + require => [ + Group['simpleproxy'], + Package['simpleproxy'], + ], + } } diff --git a/templates/simpleproxy-mysql.init.erb b/templates/simpleproxy-mysql.init.erb index 043cc48..bd87fdc 100644 --- a/templates/simpleproxy-mysql.init.erb +++ b/templates/simpleproxy-mysql.init.erb @@ -18,7 +18,7 @@ NAME=simpleproxy-mysql DAEMON=/usr/bin/simpleproxy DAEMON_ARGS="-L<%= @db_port %> -R <%= @db_host %>:<%= @db_port %> -d" SCRIPTNAME=/etc/init.d/$NAME -USER=logstash +USER=simpleproxy # Exit if the package is not installed [ -x "$DAEMON" ] || exit 0