2FA enabled when new user is created
Posted: Mon Feb 03, 2025 10:00 am
Hello,
So i found this script on a new local user created when logging in via LDAP first time - is there any way to enable 2FA by default vi scripting aswell - and maybe give me a guiding hand on how to do it?
Script below:
local strDomain = "%Domain"
local strRootDir = "c:/Test"
local strADUser = "%Name"
local strLocalUser = "local_".."%Name"
local strMapping = c_GetOptionStr(strDomain,DOPTION_ADUSER_MAPPING_STR)
if not string.find(strMapping, "%Name"..":", 0, true) then
if c_UserExist(strDomain,strLocalUser) == false then
local strPassword = md5( (c_GetTimeUS() + c_GetRandom())..c_GetServerID().."mypassword" )
c_AddUser(strDomain,strLocalUser, strPassword, 63, 1, 1)
c_AddUserDirectory(strDomain,strLocalUser, strRootDir.."/"..strADUser, "/", true, true, true, true, true, true, false, false, false, true, false, false)
c_MkDir(strRootDir.."/"..strADUser)
end
c_SetOptionStr(strDomain,DOPTION_LDAP_MAPPING_STR,strMapping.."\r\n"..strADUser..":"..strLocalUser)
end
So i found this script on a new local user created when logging in via LDAP first time - is there any way to enable 2FA by default vi scripting aswell - and maybe give me a guiding hand on how to do it?
Script below:
local strDomain = "%Domain"
local strRootDir = "c:/Test"
local strADUser = "%Name"
local strLocalUser = "local_".."%Name"
local strMapping = c_GetOptionStr(strDomain,DOPTION_ADUSER_MAPPING_STR)
if not string.find(strMapping, "%Name"..":", 0, true) then
if c_UserExist(strDomain,strLocalUser) == false then
local strPassword = md5( (c_GetTimeUS() + c_GetRandom())..c_GetServerID().."mypassword" )
c_AddUser(strDomain,strLocalUser, strPassword, 63, 1, 1)
c_AddUserDirectory(strDomain,strLocalUser, strRootDir.."/"..strADUser, "/", true, true, true, true, true, true, false, false, false, true, false, false)
c_MkDir(strRootDir.."/"..strADUser)
end
c_SetOptionStr(strDomain,DOPTION_LDAP_MAPPING_STR,strMapping.."\r\n"..strADUser..":"..strLocalUser)
end