Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

[10.5] detecter par script les logins infructueux

7 réponses
Avatar
patpro ~ patrick proniewski
Bonjour,

je suis en train de tester la possibilité de lancer des scripts en cas
de tentative de login sur ma machine (faire une photo avec la webcam,
l'uploader, tout ça tout ça).
Je suis en 10.5, donc je n'ai plus de fichier de log asl.log, mais une
base de données à la place.

J'ai tourné un peu autour de la commande syslog, et je suis arrivé à
quelque chose de pas très satisfaisant :

syslog -w 1 -k Sender SecurityAgent \
-k Level Nle 3 \
-k Message Seq Login \
-o -k Message Seq user

ce qui me permet normalement d'afficher les lignes de log qui
remplissent ces critères :

provient de SecurityAgent
niveau Error au minimum
Message contenant "Login" ou "user"

Je constate que, étrangement, le système tente de trouver sur le réseau
(ou dans l'espace) les logins d'utilisateurs non reconnus. Cela cause
des délais impressionnants dans la fenêtre de login.
J'ai alors ceci :

... SecurityAgent[9464] <Error>: Could not get the user record from
DirectoryServices.
... SecurityAgent[9464] <Error>: Could not get the user record from
DirectoryServices.
... SecurityAgent[9464] <Error>: Could not get the user record from
DirectoryServices.
... SecurityAgent[9464] <Error>: Could not get the user record from
DirectoryServices.
... SecurityAgent[9464] <Error>: Could not get the user record from
DirectoryServices.

Avec 3 secondes entre chaque tentative du système pour trouver
l'utilisateur.

Par contre, avec un login valide mais un mot de passe invalide je log
ceci :

... authorizationhost[9463] <Error>: Failed to authenticate user patpro
(tDirStatus: -14090).\n

Ma question est triple :

- comment optimiser ma commande syslog pour obtenir quelque chose de
plus précis ? (toutes les tentatives de login avec éventuellement le
login testé, que cela passe ou pas).

- est ce que la série de 5 "Could not get the user record from
DirectoryServices" à 3 secondes d'intervalle est un comportement normal ?

- comment faire pour injecter la sortie standard de ma commande syslog
dans un pipe ? (chez moi cela ne donne rien, aucune ligne ne semble
arriver de l'autre coté du pipe).

patpro

--
http://www.patpro.net/

7 réponses

Avatar
laurent.pertois
patpro ~ patrick proniewski wrote:

- est ce que la série de 5 "Could not get the user record from
DirectoryServices" à 3 secondes d'intervalle est un comportement normal ?


Tu n'aurais pas un service d'authentification activé pour
DirectoryService qui serait injoignable au moment des tests ? (LDAP, AD,
NIS...)

Ici, je viens de tester avec ta commande, rien de tel, j'ai deux échecs
d'authentification sur erreur de mot de passe, rien d'autre.

$ dscl localhost -read /Search
CSPSearchPath: /Local/Default /BSD/local
DHCPLDAPDefault: off
LSPSearchPath: /Local/Default /BSD/local
NSPSearchPath: /Local/Default /BSD/local
ReadOnlyNode: ReadOnly
SearchPath: /Local/Default /BSD/local
SearchPolicy: dsAttrTypeStandard:CSPSearchPath


--
Politically Correct Unix - UTILITIES
The "touch" command has been removed from the standard distribution due
to its inappropriate use by high-level managers.

Avatar
patpro ~ patrick proniewski
In article <1ia3tbp.1thihz11pgkdnaN%,
(Laurent Pertois) wrote:

patpro ~ patrick proniewski wrote:

- est ce que la série de 5 "Could not get the user record from
DirectoryServices" à 3 secondes d'intervalle est un comportement normal ?


Tu n'aurais pas un service d'authentification activé pour
DirectoryService qui serait injoignable au moment des tests ? (LDAP, AD,
NIS...)


rien, ce sont deux install par défaut, sur disque formaté, avec
migration des users ensuite.

Ici, je viens de tester avec ta commande, rien de tel, j'ai deux échecs
d'authentification sur erreur de mot de passe, rien d'autre.

$ dscl localhost -read /Search
CSPSearchPath: /Local/Default /BSD/local
DHCPLDAPDefault: off
LSPSearchPath: /Local/Default /BSD/local
NSPSearchPath: /Local/Default /BSD/local
ReadOnlyNode: ReadOnly
SearchPath: /Local/Default /BSD/local
SearchPolicy: dsAttrTypeStandard:CSPSearchPath


j'ai pareil...

$ dscl localhost -read /Search
CSPSearchPath: /Local/Default /BSD/local
DHCPLDAPDefault: off
LSPSearchPath: /Local/Default /BSD/local
NSPSearchPath: /Local/Default /BSD/local
ReadOnlyNode: ReadOnly
SearchPath: /Local/Default /BSD/local
SearchPolicy: dsAttrTypeStandard:CSPSearchPath

étrange.

patpro

--
http://www.patpro.net/


Avatar
laurent.pertois
patpro ~ patrick proniewski wrote:

Tu n'aurais pas un service d'authentification activé pour
DirectoryService qui serait injoignable au moment des tests ? (LDAP, AD,
NIS...)


rien, ce sont deux install par défaut, sur disque formaté, avec
migration des users ensuite.


Ok, mauvaise piste alors :-)

--
Politically Correct Unix - UTILITIES
The "touch" command has been removed from the standard distribution due
to its inappropriate use by high-level managers.


Avatar
patpro ~ Patrick Proniewski
In article ,
patpro ~ patrick proniewski wrote:

In article <1ia3tbp.1thihz11pgkdnaN%,
(Laurent Pertois) wrote:

patpro ~ patrick proniewski wrote:

- est ce que la série de 5 "Could not get the user record from
DirectoryServices" à 3 secondes d'intervalle est un comportement normal ?


Tu n'aurais pas un service d'authentification activé pour
DirectoryService qui serait injoignable au moment des tests ? (LDAP, AD,
NIS...)


rien, ce sont deux install par défaut, sur disque formaté, avec
migration des users ensuite.


je reviens à la charge. j'ai testé sur une 10.5 client prise au hasard
au boulot, et j'ai le même truc.
Si je tente de me connecter (boite de login) avec un login inconnu du
système, j'ai 15 secondes de délai avant de récupérer la main.

Mais bon... j'aimerai bien avancer sur le sujet principal quand même :)

Toujours personne pour ces deux questions ?

- comment optimiser ma commande syslog pour obtenir quelque chose de
plus précis ? (toutes les tentatives de login avec éventuellement le
login testé, que cela passe ou pas).

syslog -w 1 -k Sender SecurityAgent
-k Level Nle 3
-k Message Seq Login
-o -k Message Seq user


- comment faire pour injecter la sortie standard de ma commande syslog
dans un pipe ? (chez moi cela ne donne rien, aucune ligne ne semble
arriver de l'autre coté du pipe).

Après il me restera à comprendre comment fonctionne launchd avec les
prelogin scripts. Et c'est pas gagné.

patpro

--
http://www.patpro.net/



Avatar
laurent.pertois
patpro ~ Patrick Proniewski wrote:

Si je tente de me connecter (boite de login) avec un login inconnu du
système, j'ai 15 secondes de délai avant de récupérer la main.


Et en activant le log de debug de DirectoryService tu as quelque chose ?

# killall -USR1 DirectoryService

et ensuite le log est dans /Library/Logs/DirectoryService/

--
Politically Correct Unix - UTILITIES
The "touch" command has been removed from the standard distribution due
to its inappropriate use by high-level managers.

Avatar
patpro ~ Patrick Proniewski
In article <1iacskk.ooswhs1d7b77mN%,
(Laurent Pertois) wrote:

patpro ~ Patrick Proniewski wrote:

Si je tente de me connecter (boite de login) avec un login inconnu du
système, j'ai 15 secondes de délai avant de récupérer la main.


Et en activant le log de debug de DirectoryService tu as quelque chose ?

# killall -USR1 DirectoryService

et ensuite le log est dans /Library/Logs/DirectoryService/


c'est hyper verbeux, et en plus je ne connais pas vraiment DS.

Je te colle à tout hasard ce que j'ai identifié comme 2 des boucles de 3
secondes dues à un login foireux (totototo) :

2008-01-07 16:10:20 CET - T[0xB0185000] - Client: SecurityAgent, PID:
1014, API: dsFindDirNodes(), Server Used : DAC : Dir Ref 16777561 : Data
buffer size = 1024
2008-01-07 16:10:20 CET - T[0xB0185000] - Client: SecurityAgent, PID:
1014, API: dsFindDirNodes(), Server Used : DAR : 1 : Dir Ref = 16777561
: Requested nodename = /Search
2008-01-07 16:10:20 CET - T[0xB0185000] - Client: SecurityAgent, PID:
1014, API: dsFindDirNodes(), Server Used : DAR : 2 : Dir Ref = 16777561
: Result code = 0
2008-01-07 16:10:20 CET - T[0xB0103000] - Client: Requesting
dsOpenDirNode with PID = 1014, UID = 92, and EUID = 92
2008-01-07 16:10:20 CET - T[0xB0103000] - Client: SecurityAgent, PID:
1014, API: dsOpenDirNode(), Search Used : DAC : Dir Ref = 16777561 :
Node Name = /Search
2008-01-07 16:10:20 CET - T[0xB0103000] - Client: SecurityAgent, PID:
1014, API: dsOpenDirNode(), Search Used : DAR : Dir Ref = 16777561 :
Node Ref = 16777574 : Result code = 0
2008-01-07 16:10:20 CET - T[0xB0185000] - Client: SecurityAgent, PID:
1014, API: dsGetRecordList(), Search Used : DAC : 1 : Node Ref =
16777574 : Requested Rec Names = totototo : Rec Name Pattern Match:8449
= eDSiExact : Requested Rec Types = dsRecTypeStandard:Users
2008-01-07 16:10:20 CET - T[0xB0185000] - Client: SecurityAgent, PID:
1014, API: dsGetRecordList(), Search Used : DAC : 2 : Node Ref =
16777574 : Requested Attrs =
dsAttrTypeStandard:AppleMetaNodeLocation;dsAttrTypeStandard:Authenticatio
nAuthority;dsAttrTypeStandard:HomeDirectory;dsAttrTypeStandard:NFSHomeDir
ectory;dsAttrTypeStandard:Password;dsAttrTypeStandard:Picture;dsAttrTypeS
tandard:JPEGPhoto;dsAttrTypeStandard:PrimaryGroupID;dsAttrTypeStandard:Re
alName;dsAttrTypeStandard:RecordName;dsAttrTypeStandard:UniqueID;dsAttrTy
peStandard:UserShell;dsAttrTypeStandard:GeneratedUID;dsAttrTypeStandard:C
opyTimestamp;dsAttrTypeStandard:OriginalNodeName;dsAttrTypeStandard:Passw
ordPolicyOptions;dsAttrTypeNative:_guest;dsAttrTypeStandard:MCXSettings;d
sAttrTypeNative:external : Attr Type Only Flag = 0 : Record Count Limit
= 0 : Continue Data = 0
2008-01-07 16:10:20 CET - T[0xB0185000] - Client: Requesting
dsOpenDirNode with PID = 0, UID = 0, and EUID = 0
2008-01-07 16:10:20 CET - T[0xB0185000] - Internal Dispatch, API:
dsOpenDirNode(), Local Used : DAC : Dir Ref = 16777218 : Node Name =
/Local/Default
2008-01-07 16:10:20 CET - T[0xB0185000] - Internal Dispatch, API:
dsOpenDirNode(), Local Used : DAR : Dir Ref = 16777218 : Node Ref =
16777575 : Result code = 0
2008-01-07 16:10:20 CET - T[0xB0185000] - Internal Dispatch, API:
dsGetRecordList(), Local Used : DAC : 1 : Node Ref = 16777575 :
Requested Rec Names = totototo : Rec Name Pattern Match:8449 = eDSiExact
: Requested Rec Types = dsRecTypeStandard:Users
2008-01-07 16:10:20 CET - T[0xB0185000] - Internal Dispatch, API:
dsGetRecordList(), Local Used : DAC : 2 : Node Ref = 16777575 :
Requested Attrs =
dsAttrTypeStandard:AppleMetaNodeLocation;dsAttrTypeStandard:Authenticatio
nAuthority;dsAttrTypeStandard:HomeDirectory;dsAttrTypeStandard:NFSHomeDir
ectory;dsAttrTypeStandard:Password;dsAttrTypeStandard:Picture;dsAttrTypeS
tandard:JPEGPhoto;dsAttrTypeStandard:PrimaryGroupID;dsAttrTypeStandard:Re
alName;dsAttrTypeStandard:RecordName;dsAttrTypeStandard:UniqueID;dsAttrTy
peStandard:UserShell;dsAttrTypeStandard:GeneratedUID;dsAttrTypeStandard:C
opyTimestamp;dsAttrTypeStandard:OriginalNodeName;dsAttrTypeStandard:Passw
ordPolicyOptions;dsAttrTypeNative:_guest;dsAttrTypeStandard:MCXSettings;d
sAttrTypeNative:external : Attr Type Only Flag = 0 : Record Count Limit
= 0 : Continue Data = 0
2008-01-07 16:10:20 CET - T[0xB0185000] - Internal Dispatch, API:
dsGetRecordList(), Local Used : DAR : Node Ref = 16777575 : Number of
Found Records = 0 : Continue Data = 0 : Result code = 0
2008-01-07 16:10:20 CET - T[0xB0185000] -
CInternalDispatchThread::ResetHandlerInternalMsgData buffer was
excessive size 135168
2008-01-07 16:10:20 CET - T[0xB0185000] - Client: Requesting
dsOpenDirNode with PID = 0, UID = 0, and EUID = 0
2008-01-07 16:10:20 CET - T[0xB0185000] - Internal Dispatch, API:
dsOpenDirNode(), BSD Used : DAC : Dir Ref = 16777218 : Node Name =
/BSD/local
2008-01-07 16:10:20 CET - T[0xB0185000] - Internal Dispatch, API:
dsOpenDirNode(), BSD Used : DAR : Dir Ref = 16777218 : Node Ref =
16777576 : Result code = 0
2008-01-07 16:10:20 CET - T[0xB0185000] - Internal Dispatch, API:
dsGetRecordList(), BSD Used : DAC : Failed during argument validity or
record search restriction checking
2008-01-07 16:10:20 CET - T[0xB0185000] - Plug-in call
"dsGetRecordList()" failed with error = -14138.
2008-01-07 16:10:20 CET - T[0xB0185000] - Client: SecurityAgent, PID:
1014, API: dsGetRecordList(), Search Used : DAR : Node Ref = 16777574 :
Number of Found Records = 0 : Continue Data = 0 : Result code = 0
2008-01-07 16:10:20 CET - T[0xB0103000] - Internal Dispatch, API:
dsCloseDirNode(), Local Used : DAC : Node Ref = 16777575
2008-01-07 16:10:20 CET - T[0xB0103000] - Internal Dispatch, API:
dsCloseDirNode(), Local Used : DAR : Node Ref = 16777575 : Result code =
0
2008-01-07 16:10:20 CET - T[0xB0103000] - Internal Dispatch, API:
dsCloseDirNode(), BSD Used : DAC : Node Ref = 16777576
2008-01-07 16:10:20 CET - T[0xB0103000] - Internal Dispatch, API:
dsCloseDirNode(), BSD Used : DAR : Node Ref = 16777576 : Result code = 0
2008-01-07 16:10:20 CET - T[0xB0103000] - Client: SecurityAgent, PID:
1014, API: dsCloseDirNode(), Search Used : DAC : Node Ref = 16777574
2008-01-07 16:10:20 CET - T[0xB0103000] - Client: SecurityAgent, PID:
1014, API: dsCloseDirNode(), Search Used : DAR : Node Ref = 16777574 :
Result code = 0
2008-01-07 16:10:23 CET - T[0xB0103000] - Client: SecurityAgent, PID:
1014, API: dsFindDirNodes(), Server Used : DAC : Dir Ref 16777561 : Data
buffer size = 1024
2008-01-07 16:10:23 CET - T[0xB0103000] - Client: SecurityAgent, PID:
1014, API: dsFindDirNodes(), Server Used : DAR : 1 : Dir Ref = 16777561
: Requested nodename = /Search
2008-01-07 16:10:23 CET - T[0xB0103000] - Client: SecurityAgent, PID:
1014, API: dsFindDirNodes(), Server Used : DAR : 2 : Dir Ref = 16777561
: Result code = 0
2008-01-07 16:10:23 CET - T[0xB0185000] - Client: Requesting
dsOpenDirNode with PID = 1014, UID = 92, and EUID = 92
2008-01-07 16:10:23 CET - T[0xB0185000] - Client: SecurityAgent, PID:
1014, API: dsOpenDirNode(), Search Used : DAC : Dir Ref = 16777561 :
Node Name = /Search
2008-01-07 16:10:23 CET - T[0xB0185000] - Client: SecurityAgent, PID:
1014, API: dsOpenDirNode(), Search Used : DAR : Dir Ref = 16777561 :
Node Ref = 16777577 : Result code = 0
2008-01-07 16:10:23 CET - T[0xB0103000] - Client: SecurityAgent, PID:
1014, API: dsGetRecordList(), Search Used : DAC : 1 : Node Ref =
16777577 : Requested Rec Names = totototo : Rec Name Pattern Match:8449
= eDSiExact : Requested Rec Types = dsRecTypeStandard:Users
2008-01-07 16:10:23 CET - T[0xB0103000] - Client: SecurityAgent, PID:
1014, API: dsGetRecordList(), Search Used : DAC : 2 : Node Ref =
16777577 : Requested Attrs =
dsAttrTypeStandard:AppleMetaNodeLocation;dsAttrTypeStandard:Authenticatio
nAuthority;dsAttrTypeStandard:HomeDirectory;dsAttrTypeStandard:NFSHomeDir
ectory;dsAttrTypeStandard:Password;dsAttrTypeStandard:Picture;dsAttrTypeS
tandard:JPEGPhoto;dsAttrTypeStandard:PrimaryGroupID;dsAttrTypeStandard:Re
alName;dsAttrTypeStandard:RecordName;dsAttrTypeStandard:UniqueID;dsAttrTy
peStandard:UserShell;dsAttrTypeStandard:GeneratedUID;dsAttrTypeStandard:C
opyTimestamp;dsAttrTypeStandard:OriginalNodeName;dsAttrTypeStandard:Passw
ordPolicyOptions;dsAttrTypeNative:_guest;dsAttrTypeStandard:MCXSettings;d
sAttrTypeNative:external : Attr Type Only Flag = 0 : Record Count Limit
= 0 : Continue Data = 0
2008-01-07 16:10:23 CET - T[0xB0103000] - Client: Requesting
dsOpenDirNode with PID = 0, UID = 0, and EUID = 0
2008-01-07 16:10:23 CET - T[0xB0103000] - Internal Dispatch, API:
dsOpenDirNode(), Local Used : DAC : Dir Ref = 16777218 : Node Name =
/Local/Default
2008-01-07 16:10:23 CET - T[0xB0103000] - Internal Dispatch, API:
dsOpenDirNode(), Local Used : DAR : Dir Ref = 16777218 : Node Ref =
16777578 : Result code = 0
2008-01-07 16:10:23 CET - T[0xB0103000] - Internal Dispatch, API:
dsGetRecordList(), Local Used : DAC : 1 : Node Ref = 16777578 :
Requested Rec Names = totototo : Rec Name Pattern Match:8449 = eDSiExact
: Requested Rec Types = dsRecTypeStandard:Users
2008-01-07 16:10:23 CET - T[0xB0103000] - Internal Dispatch, API:
dsGetRecordList(), Local Used : DAC : 2 : Node Ref = 16777578 :
Requested Attrs =
dsAttrTypeStandard:AppleMetaNodeLocation;dsAttrTypeStandard:Authenticatio
nAuthority;dsAttrTypeStandard:HomeDirectory;dsAttrTypeStandard:NFSHomeDir
ectory;dsAttrTypeStandard:Password;dsAttrTypeStandard:Picture;dsAttrTypeS
tandard:JPEGPhoto;dsAttrTypeStandard:PrimaryGroupID;dsAttrTypeStandard:Re
alName;dsAttrTypeStandard:RecordName;dsAttrTypeStandard:UniqueID;dsAttrTy
peStandard:UserShell;dsAttrTypeStandard:GeneratedUID;dsAttrTypeStandard:C
opyTimestamp;dsAttrTypeStandard:OriginalNodeName;dsAttrTypeStandard:Passw
ordPolicyOptions;dsAttrTypeNative:_guest;dsAttrTypeStandard:MCXSettings;d
sAttrTypeNative:external : Attr Type Only Flag = 0 : Record Count Limit
= 0 : Continue Data = 0
2008-01-07 16:10:23 CET - T[0xB0103000] - Internal Dispatch, API:
dsGetRecordList(), Local Used : DAR : Node Ref = 16777578 : Number of
Found Records = 0 : Continue Data = 0 : Result code = 0
2008-01-07 16:10:23 CET - T[0xB0103000] -
CInternalDispatchThread::ResetHandlerInternalMsgData buffer was
excessive size 135168
2008-01-07 16:10:23 CET - T[0xB0103000] - Client: Requesting
dsOpenDirNode with PID = 0, UID = 0, and EUID = 0
2008-01-07 16:10:23 CET - T[0xB0103000] - Internal Dispatch, API:
dsOpenDirNode(), BSD Used : DAC : Dir Ref = 16777218 : Node Name =
/BSD/local
2008-01-07 16:10:23 CET - T[0xB0103000] - Internal Dispatch, API:
dsOpenDirNode(), BSD Used : DAR : Dir Ref = 16777218 : Node Ref =
16777579 : Result code = 0
2008-01-07 16:10:23 CET - T[0xB0103000] - Internal Dispatch, API:
dsGetRecordList(), BSD Used : DAC : Failed during argument validity or
record search restriction checking
2008-01-07 16:10:23 CET - T[0xB0103000] - Plug-in call
"dsGetRecordList()" failed with error = -14138.
2008-01-07 16:10:23 CET - T[0xB0103000] - Client: SecurityAgent, PID:
1014, API: dsGetRecordList(), Search Used : DAR : Node Ref = 16777577 :
Number of Found Records = 0 : Continue Data = 0 : Result code = 0
2008-01-07 16:10:23 CET - T[0xB0185000] - Internal Dispatch, API:
dsCloseDirNode(), Local Used : DAC : Node Ref = 16777578
2008-01-07 16:10:23 CET - T[0xB0185000] - Internal Dispatch, API:
dsCloseDirNode(), Local Used : DAR : Node Ref = 16777578 : Result code =
0
2008-01-07 16:10:23 CET - T[0xB0185000] - Internal Dispatch, API:
dsCloseDirNode(), BSD Used : DAC : Node Ref = 16777579
2008-01-07 16:10:23 CET - T[0xB0185000] - Internal Dispatch, API:
dsCloseDirNode(), BSD Used : DAR : Node Ref = 16777579 : Result code = 0
2008-01-07 16:10:23 CET - T[0xB0185000] - Client: SecurityAgent, PID:
1014, API: dsCloseDirNode(), Search Used : DAC : Node Ref = 16777577
2008-01-07 16:10:23 CET - T[0xB0185000] - Client: SecurityAgent, PID:
1014, API: dsCloseDirNode(), Search Used : DAR : Node Ref = 16777577 :
Result code = 0


moi ça ne me parle pas :)

patpro

--
http://www.patpro.net/


Avatar
laurent.pertois
patpro ~ Patrick Proniewski wrote:

c'est hyper verbeux, et en plus je ne connais pas vraiment DS.


Mais bon, je ne pense pas que le problème soit côté DS :

$ dscl /Search -authonly jkdshf
Password:
Authentication for node /Search failed. (-14090, eDSAuthFailed)
<dscl_cmd> DS Error: -14090 (eDSAuthFailed)

J'ai la réponse immédiatement. LoginWindow semble mal gérer ça donc...

--
Politically Correct Unix - UTILITIES
The "touch" command has been removed from the standard distribution due
to its inappropriate use by high-level managers.