@@ -177,11 +177,11 @@ type SystemConfiguration struct {
177177 Passwd struct {
178178 // Enable controls whether generated passwd files should be mounted into containers.
179179 //
180- // By default this option is disabled and Wings will not mount any additional passwd
181- // files into containers.
180+ // By default this option is disabled and Wings will not mount any
181+ // additional passwd files into containers.
182182 Enable bool `yaml:"enabled" default:"false"`
183183
184- // Directory is the directory on disk where the generated files will be stored.
184+ // Directory is the directory on disk where the generated passwd files will be stored.
185185 // This directory may be temporary as it will be re-created whenever Wings is started.
186186 //
187187 // This path **WILL** be both written to by Wings and mounted into containers created by
@@ -192,6 +192,26 @@ type SystemConfiguration struct {
192192 Directory string `yaml:"directory" default:"/run/wings/etc"`
193193 } `yaml:"passwd"`
194194
195+ // MachineID controls the mounting of a generated `/etc/machine-id` file into containers started by Wings.
196+ MachineID struct {
197+ // Enable controls whether a generated machine-id file should be mounted
198+ // into containers.
199+ //
200+ // By default this option is enabled and Wings will mount an additional
201+ // machine-id file into containers.
202+ Enable bool `yaml:"enabled" default:"true"`
203+
204+ // Directory is the directory on disk where the generated machine-id files will be stored.
205+ // This directory may be temporary as it will be re-created whenever Wings is started.
206+ //
207+ // This path **WILL** be both written to by Wings and mounted into containers created by
208+ // Wings. If you are running Wings itself in a container, this path will need to be mounted
209+ // into the Wings container as the exact path on the host, which should match the value
210+ // specified here. If you are using SELinux, you will need to make sure this file has the
211+ // correct SELinux context in order for containers to use it.
212+ Directory string `yaml:"directory" default:"/run/wings/machine-id"`
213+ } `yaml:"machine_id"`
214+
195215 // The amount of time in seconds that can elapse before a server's disk space calculation is
196216 // considered stale and a re-check should occur. DANGER: setting this value too low can seriously
197217 // impact system performance and cause massive I/O bottlenecks and high CPU usage for the Wings
@@ -634,6 +654,11 @@ func ConfigureDirectories() error {
634654 return err
635655 }
636656
657+ log .WithField ("path" , _config .System .TmpDirectory ).Debug ("ensuring temporary data directory exists" )
658+ if err := os .MkdirAll (_config .System .TmpDirectory , 0o700 ); err != nil {
659+ return err
660+ }
661+
637662 log .WithField ("path" , _config .System .ArchiveDirectory ).Debug ("ensuring archive data directory exists" )
638663 if err := os .MkdirAll (_config .System .ArchiveDirectory , 0o700 ); err != nil {
639664 return err
@@ -651,6 +676,13 @@ func ConfigureDirectories() error {
651676 }
652677 }
653678
679+ if _config .System .MachineID .Enable {
680+ log .WithField ("path" , _config .System .MachineID .Directory ).Debug ("ensuring machine-id directory exists" )
681+ if err := os .MkdirAll (_config .System .MachineID .Directory , 0o755 ); err != nil {
682+ return err
683+ }
684+ }
685+
654686 return nil
655687}
656688
0 commit comments