mirror of
https://github.com/yunginnanet/HellPot
synced 2024-06-29 17:20:50 +00:00
Security: prep code for gosec CI and adjust logfile perms
This commit is contained in:
parent
f64959ace1
commit
fe898b0be7
@ -54,7 +54,7 @@ func writeConfig() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if _, err := os.Stat(prefConfigLocation); os.IsNotExist(err) {
|
if _, err := os.Stat(prefConfigLocation); os.IsNotExist(err) {
|
||||||
if err = os.MkdirAll(prefConfigLocation, 0o755); err != nil {
|
if err = os.MkdirAll(prefConfigLocation, 0o750); err != nil {
|
||||||
println("error writing new config: " + err.Error())
|
println("error writing new config: " + err.Error())
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
@ -111,6 +111,7 @@ func getConfigPaths() (paths []string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func loadCustomConfig(path string) {
|
func loadCustomConfig(path string) {
|
||||||
|
/* #nosec */
|
||||||
if f, err = os.Open(path); err != nil {
|
if f, err = os.Open(path); err != nil {
|
||||||
println("Error opening specified config file: " + path)
|
println("Error opening specified config file: " + path)
|
||||||
println(err.Error())
|
println(err.Error())
|
||||||
|
@ -38,6 +38,7 @@ func StartLogger() zerolog.Logger {
|
|||||||
|
|
||||||
CurrentLogFile = logDir + logFileName + ".log"
|
CurrentLogFile = logDir + logFileName + ".log"
|
||||||
|
|
||||||
|
/* #nosec */
|
||||||
if logFile, err = os.OpenFile(CurrentLogFile, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0o666); err != nil {
|
if logFile, err = os.OpenFile(CurrentLogFile, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0o666); err != nil {
|
||||||
println("cannot create log file: " + err.Error())
|
println("cannot create log file: " + err.Error())
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
|
Loading…
Reference in New Issue
Block a user