Smail/backend/config/ssl_lease_unix.go
smail 200a399b4d
Some checks are pending
Security Checks / security (push) Waiting to run
收紧证书与配置状态文件访问
2026-09-22 03:35:32 +08:00

23 lines
410 B
Go

//go:build !windows
package config
import (
"os"
"path/filepath"
)
func openSSLLease(path string) (*os.File, error) {
absolute, err := filepath.Abs(filepath.Clean(path))
if err != nil {
return nil, err
}
root, err := os.OpenRoot(filepath.Dir(absolute))
if err != nil {
return nil, err
}
file, err := root.OpenFile(filepath.Base(absolute), os.O_RDWR, 0600)
_ = root.Close()
return file, err
}