Created
July 2, 2013 15:25
-
-
Save madAndroid/5910255 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -135,24 +135,30 @@ define sf_squid::firewall_allow::service ( $source = undef ) { | |
} | |
} | |
define sf_squid::firewall_allow::output ( $destination = undef ) { | |
+ | |
+ $uid = sf_get_uid($sf_squid::params::user) | |
+ | |
sf_firewall::basic { "00080 ${title}": | |
proto => 'tcp', | |
dport => '80', | |
destination => $destination, | |
action => 'accept', | |
chain => 'OUTPUT', | |
- uid => $sf_squid::params::user | |
+ uid => $uid, | |
} | |
} | |
define sf_squid::firewall_allow::output_https ( $destination = undef ) { | |
+ | |
+ $uid = sf_get_uid($sf_squid::params::user) | |
+ | |
sf_firewall::basic { "00443 ${title}": | |
proto => 'tcp', | |
dport => '443', | |
destination => $destination, | |
action => 'accept', | |
chain => 'OUTPUT', | |
- uid => $sf_squid::params::user | |
+ uid => $uid, | |
} | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'etc' | |
module Puppet::Parser::Functions | |
newfunction(:sf_get_uid, :type => :rvalue) do |user| | |
return_uid = nil | |
Etc.passwd { |u| | |
if u.name =~ /#{user}/ | |
return_uid = u.uid | |
break | |
end | |
} | |
return_uid | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment