From e5c8f5018434d88c979d2cf9c4df656b11b993a8 Mon Sep 17 00:00:00 2001 From: "Michael (Parker) Parker" Date: Mon, 18 Dec 2023 14:32:40 -0500 Subject: [PATCH] update to make passwd file path configurable --- config/config.go | 7 ++++--- server/mounts.go | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/config/config.go b/config/config.go index 317c057..7f2a5a1 100644 --- a/config/config.go +++ b/config/config.go @@ -171,7 +171,8 @@ type SystemConfiguration struct { // Passwd controls weather a passwd file is mounted in the container // at /etc/passwd to resolve missing user issues - Passwd bool `json:"mount_passwd" yaml:"mount_passwd" default:"true"` + Passwd bool `json:"mount_passwd" yaml:"mount_passwd" default:"true"` + PasswdFile string `json:"passwd_file" yaml:"passwd_file" default:"/etc/pterodactyl/passwd"` } `yaml:"user"` // The amount of time in seconds that can elapse before a server's disk space calculation is @@ -530,8 +531,8 @@ func ConfigureDirectories() error { return err } - log.WithField("filepath", "/etc/pterodactyl/passwd").Debug("ensuring passwd file exists") - if passwd, err := os.Create("/etc/pterodactyl/passwd"); err != nil { + log.WithField("filepath", _config.System.User.PasswdFile).Debug("ensuring passwd file exists") + if passwd, err := os.Create(_config.System.User.PasswdFile); err != nil { return err } else { // the WriteFile method returns an error if unsuccessful diff --git a/server/mounts.go b/server/mounts.go index 1b750e7..9d2d126 100644 --- a/server/mounts.go +++ b/server/mounts.go @@ -34,7 +34,7 @@ func (s *Server) Mounts() []environment.Mount { passwdMount := environment.Mount{ Default: true, Target: "/etc/passwd", - Source: "/etc/pterodactyl/passwd", + Source: config.Get().System.User.PasswdFile, ReadOnly: true, }