Always store files in ~/.certspotter, even if running as root
This commit is contained in:
parent
c185657181
commit
f75c47d9ca
|
@ -39,10 +39,6 @@ var stateDir string
|
|||
|
||||
var printMutex sync.Mutex
|
||||
|
||||
func isRoot () bool {
|
||||
return os.Geteuid() == 0
|
||||
}
|
||||
|
||||
func homedir () string {
|
||||
home := os.Getenv("HOME")
|
||||
if home != "" {
|
||||
|
@ -56,20 +52,12 @@ func homedir () string {
|
|||
}
|
||||
|
||||
func DefaultStateDir (programName string) string {
|
||||
if isRoot() {
|
||||
return filepath.Join("/var/lib", programName)
|
||||
} else {
|
||||
return filepath.Join(homedir(), "." + programName)
|
||||
}
|
||||
}
|
||||
|
||||
func DefaultConfigDir (programName string) string {
|
||||
if isRoot() {
|
||||
return filepath.Join("/etc", programName)
|
||||
} else {
|
||||
return filepath.Join(homedir(), "." + programName)
|
||||
}
|
||||
}
|
||||
|
||||
func LogEntry (info *certspotter.EntryInfo) {
|
||||
if !*noSave {
|
||||
|
|
Loading…
Reference in New Issue