mirror of
https://github.com/mjl-/mox.git
synced 2025-07-10 10:34:40 +03:00
mox!
This commit is contained in:
18
moxio/umask.go
Normal file
18
moxio/umask.go
Normal file
@ -0,0 +1,18 @@
|
||||
package moxio
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
// CheckUmask checks that the umask is 7 for "other". Because files written
|
||||
// should not be world-accessible. E.g. database files, and the control unix
|
||||
// domain socket.
|
||||
func CheckUmask() error {
|
||||
old := syscall.Umask(007)
|
||||
syscall.Umask(old)
|
||||
if old&7 != 7 {
|
||||
return fmt.Errorf(`umask must have "7" for world/other, e.g. 007, not current %o`, old)
|
||||
}
|
||||
return nil
|
||||
}
|
Reference in New Issue
Block a user