You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ssl_permissions.go 428B

1234567891011121314151617181920
  1. // +build !windows
  2. package pq
  3. import "os"
  4. // sslKeyPermissions checks the permissions on user-supplied ssl key files.
  5. // The key file should have very little access.
  6. //
  7. // libpq does not check key file permissions on Windows.
  8. func sslKeyPermissions(sslkey string) error {
  9. info, err := os.Stat(sslkey)
  10. if err != nil {
  11. return err
  12. }
  13. if info.Mode().Perm()&0077 != 0 {
  14. return ErrSSLKeyHasWorldPermissions
  15. }
  16. return nil
  17. }