Skip to content

Commit

Permalink
Add build-time configuration for user's group list
Browse files Browse the repository at this point in the history
Add a new build-time environment variable, USERADD_GROUPS, to allow the
list of supplementary groups a provisioned user is added to be tweaked
at built time.
  • Loading branch information
jeremycline committed Jul 5, 2024
1 parent 56ddd3f commit 966ae29
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions libazureinit/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@ fn main() {
// crates by `env!` macros.
println!("cargo:rustc-env=PATH_HOSTNAMECTL=hostnamectl");
println!("cargo:rustc-env=PATH_USERADD=useradd");
// The list of supplementary groups to add a provisioned user to.
println!("cargo:rustc-env=USERADD_GROUPS=adm,audio,cdrom,dialout,dip,floppy,lxd,netdev,plugdev,sudo,video");
println!("cargo:rustc-env=PATH_PASSWD=passwd");
}
2 changes: 1 addition & 1 deletion libazureinit/src/provision/user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ fn useradd(name: &str) -> Result<(), Error> {
"Provisioning agent created this user based on username provided in IMDS",
)
.arg("--groups")
.arg("adm,audio,cdrom,dialout,dip,floppy,lxd,netdev,plugdev,sudo,video")
.arg(env!("USERADD_GROUPS"))
.arg("-d")
.arg(home_path)
.arg("-m")
Expand Down

0 comments on commit 966ae29

Please sign in to comment.