This is an old revision of the document!
Table of Contents
OPSI ohne LoginBlocker
Dies soll ein Konzept für OPSI ohne dauerhaft installierten LoginBlocker darstellen. Dadurch werden Benutzer niemals grundlos an der Anmeldung am Betriebssystem gehindert. Der LoginBlocker wird dabei bedarfsweise im System registriert und blockt somit nur bei anstehenden Softwareinstallationen.
Funktionsprinzip:
- PREinstallation: Dabei wird der PC auf die anstehende Softwareinstallation vorbereitet. Das bedeutet das event_gui_startup wird von active = false auf active = true gesetzt, der LoginBlocker im Systemregistriert und anschließend der PC neugestartet.
- SETUP: Nun startet noch vor der Anmeldung die eigentliche Installation.
- POSTinstallation: Wenn alle anstehenden Produktaktionen abgearbeitet wurden, wird der vorherige Zustand wieder hergestellt. Das bedeutet der LoginBlocker wird entfernt und gui_startup wird deaktiviert.
Da PRE- und POSTinstallation als normales OPSI-Paket realisiert werden muss hier mit Prioritäten gearbeitet werden. Das PREinstallation Paket hat eine hohe Priorität und wird vor allen anderen ausgeführt. Das POSTinstallation Paket hat die niedrigste Priorität und wird als letztes ausgeführt. Dadurch ist sichergestellt, dass die Reihenfolge auf jeden Fall korrekt ist.
Eine Installation enthält also immer mindestens einen Neustart.
Software bei denen bekannt ist, dass eine Installation mit angemeldetem Benutzer nicht funktioniert da es zu Konflikten kommen kann bekommen das PRE- und das POSTinstallationspaket als Abhängigkeit eingetragen.
Interessant wird dies System vor allem mit dem VPN/WAN Plugin bei dem das so lästiges abwarten der TimeOuts beim Systemstart entfällt.
Damit überhaupt eine Verbindung zum OPSI Server stattfindet (beim Systemstart wird ja kein Connect durchgeführt) wird ein weiteres Event benötigt welches gelegentlich auf Software prüft. Dazu eignet sich am besten ein Timer Event (Beschreibung folgt)
Ein erster Versuch
Ich habe aus den bestehenden Skripten von UIB einige Codezeilen übernommen. Unter anderem die Zeilen aus der Installation des opsi-client-agents bei dem der LoginBlocker installiert wird. Dazu wird aus diesem außerdem Paket der Ordner OpsiLoginBlocker benötigt. Dieser muss dem PREinstallation Paket hinzugefügt werden.
PREinstallation
control
[Package] version: 1 depends: incremental: False [Product] type: localboot id: preinstallation name: PREinstallation description: PREinstallation Package advice: Passt die Hostparameter an version: 3 priority: 93 licenseRequired: False productClasses: setupScript: PREinstallation.ins uninstallScript: updateScript: alwaysScript: onceScript: customScript: userLoginScript: [ProductProperty] type: unicode name: install_loginblocker multivalue: False editable: False description: install_loginblocker values: ["false", "true"] default: ["true"] [Changelog]
PREinstallation.ins
; This script is based on Code from UIB GmbH with some modifications from Tobias Friede
; This script comes with ABSOLUTELY NO WARRANTY
; Die Benutzung erfolgt auf eigene Verantwortung.
[Actions]
requiredWinstVersion >= "4.10.8.6"
DefVar $ProductId$
DefStringList $configStates$
DefVar $install_loginblocker$
set $install_loginblocker$ = GetProductProperty("install_loginblocker", "false")
; ---------------------------------------
Set $ProductId$ = "PREinstallation"
; ---------------------------------------
ShowBitmap "%SCRIPTPATH%\opsi.png" $ProductId$
if $install_loginblocker$ = "true"
sub_install_loginblocker
;registry_write_loginblocker_flag !!noch nicht implementiert!! Dient dazu damit das Postinstallation Script erkennen kann ob der LoginBlocker durch ein Preinstallation Script installiert wurde.
else
message "Run installation without LoginBlocker"
endif
; ---------------------------------------
; Enable gui_startup
; ---------------------------------------
set $configStates$ = addtolist($configStates$, "[newmap]")
set $configStates$ = addtolist($configStates$, "type=ConfigState")
set $configStates$ = addtolist($configStates$, "configId=opsiclientd.event_gui_startup.active")
set $configStates$ = addtolist($configStates$, "values= true")
set $configStates$ = addtolist($configStates$, "objectId=%opsiserviceUser%")
markErrorNumber
OpsiServiceHashList_configState_updateObjects
if errorsOccuredSinceMark > 0
isFatalError
endif
[OpsiServiceHashList_configState_updateObjects]
"method": "configState_updateObjects"
"HashList": "$configStates$"
"params": [
]
ExitWindows /Reboot
[sub_install_loginblocker]
DefVar $INST_NTVersion$
DefVar $INST_SystemType$
Set $INST_SystemType$ = GetSystemType
set $INST_NTVersion$ = GetMsVersionInfo
comment "copying loginblocker"
if $INST_NTVersion$ >= "6.0"
if ($INST_SystemType$ = "64 Bit System")
Files_copy_vista_loginblocker_64 /Sysnative
else
Files_copy_vista_loginblocker_32
endif
endif
; Registriere LogInBlocker
if ($INST_NTVersion$ >= "6.0")
Registry_vista_loginblocker /Sysnative
else
message "Sorry, I can not install the CredentialProvider on XP"
endif
[Files_copy_vista_loginblocker_64]
copy -Vc "%SCRIPTPATH%\opsiloginblocker\64bit\*.dll" "%SYSTEM%"
[Files_copy_vista_loginblocker_32]
copy -Vc "%SCRIPTPATH%\opsiloginblocker\32bit\*.dll" "%SYSTEM%"
[Registry_vista_loginblocker]
;openkey [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\Credential Providers\{d2028e19-82fe-44c6-ad64-51497c97a02a}]
;set ""="OpsiLoginBlocker"
openkey [HKEY_CLASSES_ROOT\CLSID\{d2028e19-82fe-44c6-ad64-51497c97a02a}]
set ""="OpsiLoginBlocker"
openkey [HKEY_CLASSES_ROOT\CLSID\{d2028e19-82fe-44c6-ad64-51497c97a02a}\InprocServer32]
set ""="OpsiLoginBlocker.dll"
set "ThreadingModel"="Apartment"
openkey [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\Credential Provider Filters\{d2028e19-82fe-44c6-ad64-51497c97a02a}]
set ""="OpsiLoginBlocker"
set "LoginBlockerTimeoutConnect"=reg_dword:120
set "StartOpsiCredentialProvider"=reg_dword:0x00000000
set "LoginBlockerLogLevel"=reg_dword:6
POSTinstallation
control
[Package] version: 1 depends: incremental: False [Product] type: localboot id: postinstallation name: POSTinstallation description: POSTinstallation Package advice: version: 2.0 priority: -91 licenseRequired: False productClasses: setupScript: POSTinstallation.ins uninstallScript: updateScript: alwaysScript: onceScript: customScript: userLoginScript: [Changelog]
POSTinstallation.ins
; This script is based on Code from UIB GmbH with some modifications from Tobias Friede
; This script comes with ABSOLUTELY NO WARRANTY
; Die Benutzung erfolgt auf eigene Verantwortung.
[Actions]
requiredWinstVersion >= "4.10.8.6"
DefVar $ProductId$
DefStringList $configStates$
; ----------------------------------------------------------------
Set $ProductId$ = "POSTinstallation"
; ----------------------------------------------------------------
ShowBitmap "%SCRIPTPATH%\opsi.png" $ProductId$
Registry_vista_del_loginblocker /Sysnative
set $configStates$ = addtolist($configStates$, "[newmap]")
set $configStates$ = addtolist($configStates$, "type=ConfigState")
set $configStates$ = addtolist($configStates$, "configId=opsiclientd.event_gui_startup.active")
set $configStates$ = addtolist($configStates$, "values= false")
set $configStates$ = addtolist($configStates$, "objectId=%opsiserviceUser%")
markErrorNumber
OpsiServiceHashList_configState_updateObjects
if errorsOccuredSinceMark > 0
isFatalError
endif
[OpsiServiceHashList_configState_updateObjects]
"method": "configState_updateObjects"
"HashList": "$configStates$"
"params": [
]
[Registry_vista_del_loginblocker]
deletekey [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\Credential Providers\{d2028e19-82fe-44c6-ad64-51497c97a02a}]
deletekey [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\Credential Provider Filters\{d2028e19-82fe-44c6-ad64-51497c97a02a}]
deletekey [HKEY_CLASSES_ROOT\CLSID\{d2028e19-82fe-44c6-ad64-51497c97a02a}]
