@@ -182,7 +182,7 @@ type SystemConfiguration struct {
182182 // files into containers.
183183 Enable bool `yaml:"enabled" default:"false"`
184184
185- // Directory is the directory on disk where the generated files will be stored.
185+ // Directory is the directory on disk where the generated passwd files will be stored.
186186 // This directory may be temporary as it will be re-created whenever Elytra is started.
187187 //
188188 // This path **WILL** be both written to by Elytra and mounted into containers created by
@@ -193,6 +193,26 @@ type SystemConfiguration struct {
193193 Directory string `yaml:"directory" default:"/run/elytra/etc"`
194194 } `yaml:"passwd"`
195195
196+ // MachineID controls the mounting of a generated `/etc/machine-id` file into containers started by Wings.
197+ MachineID struct {
198+ // Enable controls whether a generated machine-id file should be mounted
199+ // into containers.
200+ //
201+ // By default this option is enabled and Wings will mount an additional
202+ // machine-id file into containers.
203+ Enable bool `yaml:"enabled" default:"true"`
204+
205+ // Directory is the directory on disk where the generated machine-id files will be stored.
206+ // This directory may be temporary as it will be re-created whenever Wings is started.
207+ //
208+ // This path **WILL** be both written to by Wings and mounted into containers created by
209+ // Wings. If you are running Wings itself in a container, this path will need to be mounted
210+ // into the Wings container as the exact path on the host, which should match the value
211+ // specified here. If you are using SELinux, you will need to make sure this file has the
212+ // correct SELinux context in order for containers to use it.
213+ Directory string `yaml:"directory" default:"/run/elytra/machine-id"`
214+ } `yaml:"machine_id"`
215+
196216 // The amount of time in seconds that can elapse before a server's disk space calculation is
197217 // considered stale and a re-check should occur. DANGER: setting this value too low can seriously
198218 // impact system performance and cause massive I/O bottlenecks and high CPU usage for the Elytra
@@ -744,6 +764,11 @@ func ConfigureDirectories() error {
744764 return err
745765 }
746766
767+ log .WithField ("path" , _config .System .TmpDirectory ).Debug ("ensuring temporary data directory exists" )
768+ if err := os .MkdirAll (_config .System .TmpDirectory , 0o700 ); err != nil {
769+ return err
770+ }
771+
747772 log .WithField ("path" , _config .System .ArchiveDirectory ).Debug ("ensuring archive data directory exists" )
748773 if err := os .MkdirAll (_config .System .ArchiveDirectory , 0o700 ); err != nil {
749774 return err
@@ -761,6 +786,13 @@ func ConfigureDirectories() error {
761786 }
762787 }
763788
789+ if _config .System .MachineID .Enable {
790+ log .WithField ("path" , _config .System .MachineID .Directory ).Debug ("ensuring machine-id directory exists" )
791+ if err := os .MkdirAll (_config .System .MachineID .Directory , 0o755 ); err != nil {
792+ return err
793+ }
794+ }
795+
764796 return nil
765797}
766798
0 commit comments