1From 2e8060f9ade13ba18ae5930c0781227bfcce11a5 Mon Sep 17 00:00:00 2001
2From: Nikolay Amiantov <ab@fmap.me>
3Date: Mon, 10 Jan 2022 22:16:38 +0300
4Subject: [PATCH] Disable accounts setup phase and oslogin
5
6On NixOS we set up necessary groups and sudoers rules declaratively,
7and have most of `/etc` directory read-only. This creates (harmless)
8error messages when trying to create google-sudoers file.
9
10"oslogin" daemon sets up configuration necessary for OS Login to
11work, including PAM, NSS and sudoers. On NixOS we perform all this
12configuration declaratively and have most of /etc mounted read-only.
13This creates (harmless) error messages when running the daemon.
14---
15 google_guest_agent/non_windows_accounts.go | 9 ---------
16 google_guest_agent/oslogin.go | 2 +-
17 2 files changed, 1 insertion(+), 10 deletions(-)
18
19diff --git a/google_guest_agent/non_windows_accounts.go b/google_guest_agent/non_windows_accounts.go
20index 81013e3..05b830f 100644
21--- a/google_guest_agent/non_windows_accounts.go
22+++ b/google_guest_agent/non_windows_accounts.go
23@@ -104,15 +104,6 @@ func (a *accountsMgr) set() error {
24 sshKeys = make(map[string][]string)
25 }
26
27- logger.Debugf("create sudoers file if needed")
28- if err := createSudoersFile(); err != nil {
29- logger.Errorf("Error creating google-sudoers file: %v.", err)
30- }
31- logger.Debugf("create sudoers group if needed")
32- if err := createSudoersGroup(); err != nil {
33- logger.Errorf("Error creating google-sudoers group: %v.", err)
34- }
35-
36 mdkeys := newMetadata.Instance.Attributes.SSHKeys
37 if !newMetadata.Instance.Attributes.BlockProjectKeys {
38 mdkeys = append(mdkeys, newMetadata.Project.Attributes.SSHKeys...)
39diff --git a/google_guest_agent/oslogin.go b/google_guest_agent/oslogin.go
40index d05f733..980e84c 100644
41--- a/google_guest_agent/oslogin.go
42+++ b/google_guest_agent/oslogin.go
43@@ -76,7 +76,7 @@ func (o *osloginMgr) timeout() bool {
44 }
45
46 func (o *osloginMgr) disabled(os string) bool {
47- return os == "windows"
48+ return true
49 }
50
51 func (o *osloginMgr) set() error {
52--
532.34.1
54