[macOS] enable automationmode without authentication (#5417)
This commit is contained in:
@@ -60,6 +60,44 @@ done
|
|||||||
|
|
||||||
rm -f ./add-certificate
|
rm -f ./add-certificate
|
||||||
|
|
||||||
|
# enable-automationmode-without-authentication
|
||||||
|
if is_Monterey; then
|
||||||
|
retry=10
|
||||||
|
while [ $retry -gt 0 ]; do
|
||||||
|
{
|
||||||
|
osascript <<EOF
|
||||||
|
tell application "Terminal"
|
||||||
|
activate
|
||||||
|
do script "automationmodetool enable-automationmode-without-authentication"
|
||||||
|
delay 2
|
||||||
|
tell application "System Events"
|
||||||
|
keystroke "${PASSWORD}"
|
||||||
|
keystroke return
|
||||||
|
end tell
|
||||||
|
end tell
|
||||||
|
delay 5
|
||||||
|
EOF
|
||||||
|
} && break
|
||||||
|
|
||||||
|
retry=$((retry-1))
|
||||||
|
if [ $retry -eq 0 ]; then
|
||||||
|
echo "No retry attempts left"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
sleep 10
|
||||||
|
done
|
||||||
|
|
||||||
|
term_service=$(launchctl list | grep -i terminal | cut -f3)
|
||||||
|
echo "Close terminal windows: gui/501/${term_service}"
|
||||||
|
launchctl bootout gui/501/${term_service} && sleep 5
|
||||||
|
|
||||||
|
# test enable-automationmode-without-authentication
|
||||||
|
if [[ ! "$(automationmodetool)" =~ "DOES NOT REQUIRE" ]]; then
|
||||||
|
echo "Failed to enable enable-automationmode-without-authentication option"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# Create symlink for tests running
|
# Create symlink for tests running
|
||||||
if [ ! -d "/usr/local/bin" ];then
|
if [ ! -d "/usr/local/bin" ];then
|
||||||
sudo mkdir -p -m 775 /usr/local/bin
|
sudo mkdir -p -m 775 /usr/local/bin
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ userValuesArray=(
|
|||||||
"'kTCCServiceUbiquity','com.apple.PassKitCore',0,2,5,1,NULL,NULL,NULL,'UNUSED',NULL,0,1619516250"
|
"'kTCCServiceUbiquity','com.apple.PassKitCore',0,2,5,1,NULL,NULL,NULL,'UNUSED',NULL,0,1619516250"
|
||||||
"'kTCCServiceAppleEvents','/Library/Application Support/Veertu/Anka/addons/ankarund',1,2,3,1,X'fade0c00000000ac0000000100000006000000020000001e636f6d2e7665657274752e616e6b612e6164646f6e732e616e6b6172756e0000000000060000000f000000060000000e000000010000000a2a864886f76364060206000000000000000000060000000e000000000000000a2a864886f7636406010d0000000000000000000b000000000000000a7375626a6563742e4f550000000000010000000a545439464157503656340000',NULL,0,'com.apple.finder',X'fade0c000000002c00000001000000060000000200000010636f6d2e6170706c652e66696e64657200000003',NULL,1629294900"
|
"'kTCCServiceAppleEvents','/Library/Application Support/Veertu/Anka/addons/ankarund',1,2,3,1,X'fade0c00000000ac0000000100000006000000020000001e636f6d2e7665657274752e616e6b612e6164646f6e732e616e6b6172756e0000000000060000000f000000060000000e000000010000000a2a864886f76364060206000000000000000000060000000e000000000000000a2a864886f7636406010d0000000000000000000b000000000000000a7375626a6563742e4f550000000000010000000a545439464157503656340000',NULL,0,'com.apple.finder',X'fade0c000000002c00000001000000060000000200000010636f6d2e6170706c652e66696e64657200000003',NULL,1629294900"
|
||||||
"'kTCCServiceAppleEvents','/Library/Application Support/Veertu/Anka/addons/ankarund',1,2,3,1,X'fade0c00000000ac0000000100000006000000020000001e636f6d2e7665657274752e616e6b612e6164646f6e732e616e6b6172756e0000000000060000000f000000060000000e000000010000000a2a864886f76364060206000000000000000000060000000e000000000000000a2a864886f7636406010d0000000000000000000b000000000000000a7375626a6563742e4f550000000000010000000a545439464157503656340000',NULL,0,'com.apple.systemevents',X'fade0c000000003400000001000000060000000200000016636f6d2e6170706c652e73797374656d6576656e7473000000000003',NULL,164456761"
|
"'kTCCServiceAppleEvents','/Library/Application Support/Veertu/Anka/addons/ankarund',1,2,3,1,X'fade0c00000000ac0000000100000006000000020000001e636f6d2e7665657274752e616e6b612e6164646f6e732e616e6b6172756e0000000000060000000f000000060000000e000000010000000a2a864886f76364060206000000000000000000060000000e000000000000000a2a864886f7636406010d0000000000000000000b000000000000000a7375626a6563742e4f550000000000010000000a545439464157503656340000',NULL,0,'com.apple.systemevents',X'fade0c000000003400000001000000060000000200000016636f6d2e6170706c652e73797374656d6576656e7473000000000003',NULL,164456761"
|
||||||
|
"'kTCCServiceAppleEvents','/usr/libexec/sshd-keygen-wrapper',1,2,3,1,X'fade0c000000003c0000000100000006000000020000001d636f6d2e6170706c652e737368642d6b657967656e2d7772617070657200000000000003',NULL,0,'com.apple.Terminal',X'fade0c000000003000000001000000060000000200000012636f6d2e6170706c652e5465726d696e616c000000000003',NULL,1650386089"
|
||||||
)
|
)
|
||||||
for values in "${userValuesArray[@]}"; do
|
for values in "${userValuesArray[@]}"; do
|
||||||
configure_user_tccdb "$values"
|
configure_user_tccdb "$values"
|
||||||
|
|||||||
@@ -121,7 +121,8 @@
|
|||||||
],
|
],
|
||||||
"environment_vars": [
|
"environment_vars": [
|
||||||
"IMAGE_VERSION={{user `build_id`}}",
|
"IMAGE_VERSION={{user `build_id`}}",
|
||||||
"IMAGE_OS={{user `image_os`}}"
|
"IMAGE_OS={{user `image_os`}}",
|
||||||
|
"PASSWORD={{user `vm_password`}}"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -54,3 +54,9 @@ Describe "Open windows" {
|
|||||||
$openWindows.Split(",").Trim() | Where-Object { $_ -notmatch "NotificationCenter" } | Should -BeNullOrEmpty
|
$openWindows.Split(",").Trim() | Where-Object { $_ -notmatch "NotificationCenter" } | Should -BeNullOrEmpty
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Describe "AutomationModeTool" {
|
||||||
|
It "Does not require user authentication" -Skip:(-not $os.IsMonterey) {
|
||||||
|
automationmodetool | Out-String | Should -Match "DOES NOT REQUIRE"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user