Setting initial LockState via clientsettings.cfg in v10 macOS broken?

In a post from a couple years ago, @JasonWalker helped me out with adding __LockState=True to the clientsettings.cfg file for a downloadable client package used by those who manage their own computer. (We still want to receive as much information about their computer as we can without actually managing its state ourselves.) The appears to have been broken with the move to the v10 client installer on macOS. I haven’t torn apart the pkg yet, but the installer appears to be putting the value from the cfg file in the GlobalOptions section of the com.bigfix.BESAgent.plist instead of the Client section where it belongs. Anyone else here doing work with the macOS client run into something like this yet?

(I’m about to tear into the pkg, so I may have my own answer soon… :smile: )

It appears that the CfgToPList.pl script used to create the plist from the cfg file hasn’t changed from the v9 client to the v10 client, so why have the results changed? :face_with_raised_eyebrow:

So, I started this, might as well continue, right?

Going back as far as I can on the macOS Catalina machine, the following clientsettings.cfg file:

__RelayServer1=http://server:52311/bfmirror/downloads
AdminUnit=SELF
__LockState=true

turns into the following XML plist file thanks to CfgToPlist.pl:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>Settings</key>
	<dict>
		<key>Client</key>
		<dict>
			<key>__RelayServer1</key>
			<dict>
				<key>Value</key>
				<string>http://server:52311/bfmirror/downloads</string>
			</dict>
			<key>AdminUnit</key>
			<dict>
				<key>Value</key>
				<string>SELF</string>
			</dict>
			<key>__LockState</key>
			<dict>
				<key>Value</key>
				<string>true</string>
			</dict>
		</dict>
	</dict>
</dict>
</plist>

And, after the client is launched for the first time, it turns into this:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>Options</key>
	<dict>
		<key>GlobalOptions</key>
		<dict>
			<key>5.1_Options_Updated</key>
			<dict>
				<key>Date</key>
				<date>2020-07-30T02:40:09Z</date>
				<key>Value</key>
				<string>1</string>
			</dict>
			<key>ActionLockController</key>
			<dict>
				<key>Date</key>
				<date>2020-07-30T02:40:10Z</date>
				<key>Value</key>
				<string>console</string>
			</dict>
			<key>LastClientVersion</key>
			<dict>
				<key>Date</key>
				<date>2020-07-30T02:40:09Z</date>
				<key>Value</key>
				<string>9.5.14.73</string>
			</dict>
			<key>LastKnownClockShift</key>
			<dict>
				<key>Date</key>
				<date>2020-07-30T02:45:50Z</date>
				<key>Value</key>
				<string>0</string>
			</dict>
			<key>LibPath</key>
			<dict>
				<key>Date</key>
				<date>2020-07-30T02:40:09Z</date>
				<key>Value</key>
				<string>/Library/BESAgent/BESAgent.app/Contents/MacOS</string>
			</dict>
			<key>RegCount</key>
			<dict>
				<key>Date</key>
				<date>2020-07-30T02:45:50Z</date>
				<key>Value</key>
				<string>2</string>
			</dict>
			<key>StoragePath</key>
			<dict>
				<key>Date</key>
				<date>2020-07-30T02:40:09Z</date>
				<key>Value</key>
				<string>/Library/Application Support/BigFix/BES Agent</string>
			</dict>
		</dict>
	</dict>
	<key>Settings</key>
	<dict>
		<key>Client</key>
		<dict>
			<key>AdminUnit</key>
			<dict>
				<key>Value</key>
				<string>SELF</string>
			</dict>
			<key>_BESClient_Upgrade_UTF8Settings</key>
			<dict>
				<key>Date</key>
				<date>2020-07-30T02:40:09Z</date>
				<key>Value</key>
				<string>1</string>
			</dict>
			<key>__LockState</key>
			<dict>
				<key>Value</key>
				<string>true</string>
			</dict>
			<key>__RelayServer1</key>
			<dict>
				<key>Value</key>
				<string>http://server:52311/bfmirror/downloads</string>
			</dict>
			<key>__Relay_Control_RootServer</key>
			<dict>
				<key>Date</key>
				<date>2020-07-30T02:40:10Z</date>
				<key>Value</key>
				<string>http://server:52311/cgi-bin/bfgather.exe/actionsite</string>
			</dict>
			<key>__Relay_Control_Server1</key>
			<dict>
				<key>Date</key>
				<date>2020-07-30T02:45:50Z</date>
				<key>Value</key>
				<string>http://server:52311</string>
			</dict>
			<key>__Relay_Control_Server2</key>
			<dict>
				<key>Date</key>
				<date>2020-07-30T02:45:50Z</date>
				<key>Value</key>
				<string></string>
			</dict>
		</dict>
	</dict>
</dict>
</plist>

For the sake of analysis, this next bit is the post-launch plist with keys NOT related to the cfg file removed:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>Options</key>
	<dict>
		<key>GlobalOptions</key>
		<dict>
			<...>
		</dict>
	</dict>
	<key>Settings</key>
	<dict>
		<key>Client</key>
		<dict>
			<key>AdminUnit</key>
			<dict>
				<key>Value</key>
				<string>SELF</string>
			</dict>
			<...>
			<key>__LockState</key>
			<dict>
				<key>Value</key>
				<string>true</string>
			</dict>
			<key>__RelayServer1</key>
			<dict>
				<key>Value</key>
				<string>http://bf01.aas.duke.edu:52311/bfmirror/downloads</string>
			</dict>
			<...>
		</dict>
	</dict>
</dict>
</plist>

Everything looks peachy, right? Well, now we try it with the 10.0.0 client and end up, after starting, with (similarly trimmed):

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>Options</key>
	<dict>
		<key>GlobalOptions</key>
		<dict>
			<...>
			<key>__LockState</key>
			<dict>
				<key>Value</key>
				<string>true</string>
			</dict>
		</dict>
	</dict>
	<key>Settings</key>
	<dict>
		<key>Client</key>
		<dict>
			<key>AdminUnit</key>
			<dict>
				<key>Value</key>
				<string>SELF</string>
			</dict>
			<...>__LockState</key>
			<dict>
				<key>Date</key>
				<date>2020-07-30T03:00:34Z</date>
			</dict>
			<key>__RelayServer1</key>
			<dict>
				<key>Value</key>
				<string>http://server:52311/bfmirror/downloads</string>
			</dict>
			<...>
		</dict>
	</dict>
</dict>
</plist>

The __LockState=true part ends up in GlobalOptions with a datestamped empty stub in Client.

This makes me sad. :frowning_face:

If we lock this client from the Console, the GlobalOptions __LockState remains unchanged and ignored and the Client __LockState gets an identical Value=true keypair:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>EnterpriseServer</key>
	<dict/>
	<key>Options</key>
	<dict>
		<key>GlobalOptions</key>
		<dict>
			<...>
			<key>__LockState</key>
			<dict>
				<key>Value</key>
				<string>true</string>
			</dict>
		</dict>
	</dict>
	<key>Settings</key>
	<dict>
		<...>
		</dict>
		<key>Client</key>
		<dict>
			<...>
			<key>__LockState</key>
			<dict>
				<key>Date</key>
				<date>2020-07-30T03:15:10Z</date>
				<key>Value</key>
				<string>true</string>
			</dict>
			<...>
		</dict>
	</dict>
</dict>
</plist>

So, what happened? What now? :frowning_face: