Documentation
¶
Index ¶
- Constants
- Variables
- func CheckFileDoesNotExist() error
- func CreateInoxdEnvFileIfNotExists(outW io.Writer, input EnvFileCreationParams) (path string, _ error)
- func EnableInoxd(unitName string, out io.Writer, errOut io.Writer) error
- func StartInoxd(unitName string, restart bool, out io.Writer, errOut io.Writer) error
- func StopRemoveUnit(removeEnvFile bool, out io.Writer, errOut io.Writer) error
- func WriteInoxUnitFile(args InoxUnitParams) (unitName string, _ error)
- type EnvFileCreationParams
- type InoxUnitParams
Constants ¶
View Source
const ( SYSTEMD_DIR_PATH = "/etc/systemd" INOX_SERVICE_UNIT_NAME = "inox" INOX_SERVICE_UNIT_PATH = SYSTEMD_DIR_PATH + "/system/" + INOX_SERVICE_UNIT_NAME + ".service" INOX_SERVICE_UNIT_FPERMS = 0o644 SYSTEMCTL_CMD_NAME = "systemctl" DEFAULT_CPU_QUOTA_PERCENT_PER_CPU = 75 //75% )
View Source
const ( DEFAULT_INOXD_ENV_FILE_PATH = "/run/inoxd/env" INOXD_ENV_FILE_PERMS = fs.FileMode(0o440) INOXD_ENV_FILE_DIR_PERMS = fs.FileMode(0o770) )
Variables ¶
View Source
var ( ErrUnitFileExists = errors.New("unit file already exists") ErrNoSystemd = errors.New("systemd does not seem to be the init system on this machine") ErrNotRoot = errors.New("current user is not root") )
View Source
var ( ErrBadEnvFilePerms = errors.New( "the permissions of the inoxd environment file are not " + strconv.FormatUint(uint64(INOXD_ENV_FILE_PERMS), 8)) ErrEnvFileNotOwnedByRoot = errors.New("the inoxd environment file is not owned by root") ErrEnvFileNotOwnedByRootGroup = errors.New("the inoxd environment file is not owned by the root group") )
View Source
var (
SYSTEMCTL_ALLOWED_LOCATIONS = []string{"/usr/bin/systemctl", "/usr/sbin/systemctl", "/bin/systemctl", "/sbin/systemctl"}
)
Functions ¶
func CheckFileDoesNotExist ¶
func CheckFileDoesNotExist() error
func CreateInoxdEnvFileIfNotExists ¶
func CreateInoxdEnvFileIfNotExists(outW io.Writer, input EnvFileCreationParams) (path string, _ error)
CreateInoxdEnvFileIfNotExists creates an environment file to be used by systemd to start inoxd. The file contains EXTREMELY SENSITIVE information: INOXD_MASTER_KEYSET: a set of master keys primarily used to encrypt and decrypt keys. CLOUDFLARE_ORIGIN_CERTIFICATE: the origin certificate delivered by Cloudflare.
func StartInoxd ¶
func StopRemoveUnit ¶
func WriteInoxUnitFile ¶
func WriteInoxUnitFile(args InoxUnitParams) (unitName string, _ error)
WriteInoxUnitFile writes the unit file for inoxd at INOX_SERVICE_UNIT_PATH, if the file already exists ErrUnitFileExists is returned and unitName is set.
Types ¶
type EnvFileCreationParams ¶
type EnvFileCreationParams struct {
CloudflareOriginCertificate string //optional, if set CLOUDFLARE_ORIGIN_CERTIFICATE is set.
}
type InoxUnitParams ¶
Click to show internal directories.
Click to hide internal directories.