From 1a47c92d90416670910c149d81ed0b4906f5f7b2 Mon Sep 17 00:00:00 2001 From: Chris Long Date: Mon, 16 Nov 2020 16:51:23 -0800 Subject: [PATCH] Update bootstrap.sh with fleet fixes, remove duplicate registry key code --- ESXi/ansible/roles/logger/tasks/main.yml | 2 -- Vagrant/logger_bootstrap.sh | 6 ++---- Vagrant/scripts/configure-ou.ps1 | 5 ----- Vagrant/scripts/join-domain.ps1 | 5 ----- Vagrant/scripts/provision.ps1 | 5 +++++ 5 files changed, 7 insertions(+), 16 deletions(-) diff --git a/ESXi/ansible/roles/logger/tasks/main.yml b/ESXi/ansible/roles/logger/tasks/main.yml index 1d5bcec71..1e40f13c5 100644 --- a/ESXi/ansible/roles/logger/tasks/main.yml +++ b/ESXi/ansible/roles/logger/tasks/main.yml @@ -383,8 +383,6 @@ fleetctl get options > /tmp/options.yaml /usr/bin/yq w -i /tmp/options.yaml 'spec.config.options.enroll_secret' 'enrollmentsecret' /usr/bin/yq w -i /tmp/options.yaml 'spec.config.options.logger_snapshot_event_type' 'true' - # Fleet 3.0 requires the "kind" to be "options" instead of "option" - # sed -i 's/kind: option/kind: options/g' /tmp/options.yaml # Not needed with change to fleetdm/fleet fleetctl apply -f /tmp/options.yaml # Use fleetctl to import YAML files diff --git a/Vagrant/logger_bootstrap.sh b/Vagrant/logger_bootstrap.sh index 95741cef4..60e75f379 100644 --- a/Vagrant/logger_bootstrap.sh +++ b/Vagrant/logger_bootstrap.sh @@ -307,8 +307,6 @@ install_fleet_import_osquery_config() { fleetctl get options >/tmp/options.yaml /usr/bin/yq w -i /tmp/options.yaml 'spec.config.options.enroll_secret' 'enrollmentsecret' /usr/bin/yq w -i /tmp/options.yaml 'spec.config.options.logger_snapshot_event_type' 'true' - # Fleet 3.0 requires the "kind" to be "options" instead of "option" - sed -i 's/kind: option/kind: options/g' /tmp/options.yaml fleetctl apply -f /tmp/options.yaml # Use fleetctl to import YAML files @@ -322,8 +320,8 @@ install_fleet_import_osquery_config() { # Files must exist before splunk will add a monitor touch /var/log/fleet/osquery_result touch /var/log/fleet/osquery_status - /opt/splunk/bin/splunk add monitor "/var/log/fleet/osquery_result" -index osquery -sourcetype 'osquery:json' -auth 'admin:changeme' - /opt/splunk/bin/splunk add monitor "/var/log/fleet/osquery_status" -index osquery-status -sourcetype 'osquery:status' -auth 'admin:changeme' + /opt/splunk/bin/splunk add monitor "/var/log/fleet/osquery_result" -index osquery -sourcetype 'osquery:json' -auth 'admin:changeme' --accept-license --answer-yes --no-prompt + /opt/splunk/bin/splunk add monitor "/var/log/fleet/osquery_status" -index osquery-status -sourcetype 'osquery:status' -auth 'admin:changeme' --accept-license --answer-yes --no-prompt fi } diff --git a/Vagrant/scripts/configure-ou.ps1 b/Vagrant/scripts/configure-ou.ps1 index 41a1c1265..fa5551aa6 100644 --- a/Vagrant/scripts/configure-ou.ps1 +++ b/Vagrant/scripts/configure-ou.ps1 @@ -49,8 +49,3 @@ Write-Host "$('[{0:HH:mm}]' -f (Get-Date)) Creating Workstations OU..." Write-Host "$('[{0:HH:mm}]' -f (Get-Date)) Something went wrong attempting to reach AD or create the OU." } } - -# Sysprep breaks auto-login. Let's restore it here: -Set-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" -Name AutoAdminLogon -Value 1 -Set-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" -Name DefaultUserName -Value "vagrant" -Set-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" -Name DefaultPassword -Value "vagrant" diff --git a/Vagrant/scripts/join-domain.ps1 b/Vagrant/scripts/join-domain.ps1 index f0bc59e22..552eac2a1 100755 --- a/Vagrant/scripts/join-domain.ps1 +++ b/Vagrant/scripts/join-domain.ps1 @@ -32,11 +32,6 @@ If ($hostname -eq "wef") { Add-Computer -DomainName "windomain.local" -credential $DomainCred -PassThru } -# Set auto login -Set-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" -Name AutoAdminLogon -Value 1 -Set-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" -Name DefaultUserName -Value "vagrant" -Set-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" -Name DefaultPassword -Value "vagrant" - # Stop Windows Update Write-Host "$('[{0:HH:mm}]' -f (Get-Date)) Disabling Windows Updates and Windows Module Services" Set-Service wuauserv -StartupType Disabled diff --git a/Vagrant/scripts/provision.ps1 b/Vagrant/scripts/provision.ps1 index 61eb30bae..86f030e61 100644 --- a/Vagrant/scripts/provision.ps1 +++ b/Vagrant/scripts/provision.ps1 @@ -65,5 +65,10 @@ if ($env:COMPUTERNAME -imatch 'vagrant') { Write-Host "$('[{0:HH:mm}]' -f (Get-Date)) Installing bginfo..." . c:\vagrant\scripts\install-bginfo.ps1 } + + Write-Host "$('[{0:HH:mm}]' -f (Get-Date)) Setting the registry for auto-login..." + Set-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" -Name AutoAdminLogon -Value 1 -Type String + Set-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" -Name DefaultUserName -Value "vagrant" + Set-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" -Name DefaultPassword -Value "vagrant" Write-Host "$('[{0:HH:mm}]' -f (Get-Date)) Provisioning after joining domain..." }