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

Add ocfenforcer as user #933

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 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
1 change: 1 addition & 0 deletions modules/ocf_mail/files/site_ocf/aliases
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ postmaster: sm
mailer-daemon: postmaster

mirrors: root
ocfenforcer: root
ocfstats: root
jenkins: root
rancid: root
Expand Down
9 changes: 8 additions & 1 deletion modules/ocf_printhost/manifests/cups.pp
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,16 @@
}
}

#Tea4cups saves files based on its owner
file { '/usr/lib/cups/backend/tea4cups':
PotatoParser marked this conversation as resolved.
Show resolved Hide resolved
ensure => 'file',
owner => 'ocfenforcer',
mode => '0700';
Copy link
Member

Choose a reason for hiding this comment

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

Probably also good to include require => Package['cups-tea4cups'] here since this is normally provided by that package so you'd want it to exist first before modifying it's permissions

}

mount { '/var/spool/cups':
device => 'tmpfs',
fstype => 'tmpfs',
options => 'mode=0710,gid=lp,noatime,nodev,noexec,nosuid';
options => 'uid=ocfenforcer,mode=0710,gid=lp,noatime,nodev,noexec,nosuid';
}
}
7 changes: 7 additions & 0 deletions modules/ocf_printhost/manifests/enforcer.pp
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
class ocf_printhost::enforcer {
user { 'ocfenforcer':
ensure => present,
}

package { ['cups-tea4cups', 'mariadb-client']: }

$mysql_password = assert_type(Pattern[/^[a-zA-Z0-9]*$/], lookup('ocfprinting::mysql::password'))
Expand All @@ -19,13 +23,16 @@

'/opt/share/enforcer':
ensure => directory,
owner => 'ocfenforcer',
mode => '0500';

'/opt/share/enforcer/enforcer.conf':
content => template(
'ocf_printhost/enforcer/enforcer.conf.erb',
'ocf/broker/broker.conf.erb',
),
owner => 'ocfenforcer',
mode => '0500',
show_diff => false;
}

Expand Down
4 changes: 2 additions & 2 deletions modules/ocf_printhost/templates/cups/tea4cups.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ keepfiles : no
<% else %>
keepfiles : yes
<% end %>
prehook_enforcer : /usr/local/bin/enforcer prehook
posthook_enforcer : /usr/local/bin/enforcer posthook
prehook_enforcer : sudo -Eu ocfenforcer /usr/local/bin/enforcer prehook
posthook_enforcer : sudo -Eu ocfenforcer /usr/local/bin/enforcer posthook