Skip to content

Commit

Permalink
Merge pull request #401 from cyberious/FM-2131
Browse files Browse the repository at this point in the history
FM-2131 Move to non temp directory for factor_dot_d
  • Loading branch information
cmurphy committed Jan 15, 2015
2 parents 80f0962 + 9e380b9 commit 7a91f20
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,11 @@
##2015-01-14 - Supported Release 4.5.1
###Summary

This release changes the temporary facter_dot_d cache locations outside of the /tmp directory due to a possible security vunerability. CVE-2015-1029

####Bugfixes
- Facter_dot_d cache will now be stored in puppet libdir instead of tmp

##2014-12-15 - Supported Release 4.5.0
###Summary

Expand Down
6 changes: 3 additions & 3 deletions lib/facter/facter_dot_d.rb
Expand Up @@ -15,15 +15,15 @@
class Facter::Util::DotD
require 'yaml'

def initialize(dir="/etc/facts.d", cache_file="/tmp/facts_cache.yml")
def initialize(dir="/etc/facts.d", cache_file=File.join(Puppet[:libdir], "facts_dot_d.cache"))
@dir = dir
@cache_file = cache_file
@cache = nil
@types = {".txt" => :txt, ".json" => :json, ".yaml" => :yaml}
end

def entries
Dir.entries(@dir).reject{|f| f =~ /^\.|\.ttl$/}.sort.map {|f| File.join(@dir, f) }
Dir.entries(@dir).reject { |f| f =~ /^\.|\.ttl$/ }.sort.map { |f| File.join(@dir, f) }
rescue
[]
end
Expand Down Expand Up @@ -113,7 +113,7 @@ def script_parser(file)

def cache_save!
cache = load_cache
File.open(@cache_file, "w", 0600) {|f| f.write(YAML.dump(cache)) }
File.open(@cache_file, "w", 0600) { |f| f.write(YAML.dump(cache)) }
rescue
end

Expand Down
2 changes: 1 addition & 1 deletion metadata.json
@@ -1,6 +1,6 @@
{
"name": "puppetlabs-stdlib",
"version": "4.5.0",
"version": "4.5.1",
"author": "puppetlabs",
"summary": "Standard library of resources for Puppet modules.",
"license": "Apache-2.0",
Expand Down

0 comments on commit 7a91f20

Please sign in to comment.