lithnet / ad-password-protection

Active Directory password filter featuring breached password checking and custom complexity rules
MIT License
494 stars 52 forks source link

Import of password list fails with undetailed error #126

Open BerndAbb opened 8 months ago

BerndAbb commented 8 months ago

Hi, I encountered an error, whilst importing password lists into the solution. Environment was one time a DC Server 2022 in German, VM and next try I used another DC Server 2022 English which is a physical machine, getting the same error.

The first password list was the rockyou repository, the second I tried had about 8mb.

Error: Import-CompromisedPasswords : Mindestens ein Fehler ist aufgetreten. In Zeile:1 Zeichen:1

Any idea on this..? BR Bernd

ryannewington commented 8 months ago

Hi @BerndAbb

Can you reproduce the issue, and immediately run this command after to dump the whole exception for us to see

$Error[0].Exception.ToString()
BerndAbb commented 8 months ago

Hi @ryannewington Thank you very much for your quick response, did as you requested and digged out the following error:

PS C:\Windows\system32> $Error[0].Exception.ToString() System.AggregateException: One or more errors occurred. ---> System.IO.IOException: The process cannot access the file 'c:\pwrep\v3\p\AC9B.db.bin' because it is being used by another process. at System.IO.Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share) at Lithnet.ActiveDirectory.PasswordProtection.BinaryStoreInstance.WriteStoreFile(String file, Boolean append, IEnumerable1 hashes) at Lithnet.ActiveDirectory.PasswordProtection.BinaryStoreInstance.AddHashRangeToTempStore(HashSet1 hashes, String range) at Lithnet.ActiveDirectory.PasswordProtection.Store.<>c__DisplayClass32_0.b0(KeyValuePair2 group) at System.Threading.Tasks.Parallel.<>c__DisplayClass42_02.b1() at System.Threading.Tasks.Task.InnerInvokeWithArg(Task childTask) at System.Threading.Tasks.Task.<>cDisplayClass176_0.b0(Object ) --- End of inner exception stack trace --- at Lithnet.ActiveDirectory.PasswordProtection.PowerShell.Global.UnwrapAndThrow(Exception ex) at Lithnet.ActiveDirectory.PasswordProtection.PowerShell.Global.ThrowIfFaulted(Task t) at Lithnet.ActiveDirectory.PasswordProtection.PowerShell.ImportCompromisedPasswords.ProcessRecord() at System.Management.Automation.CommandProcessor.ProcessRecord() ---> (Inner Exception #0) System.IO.IOException: The process cannot access the file 'c:\pwrep\v3\p\AC9B.db.bin' because it is being used by another process. at System.IO.Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share) at Lithnet.ActiveDirectory.PasswordProtection.BinaryStoreInstance.WriteStoreFile(String file, Boolean append, IEnumerable1 hashes) at Lithnet.ActiveDirectory.PasswordProtection.BinaryStoreInstance.AddHashRangeToTempStore(HashSet1 hashes, String range) at Lithnet.ActiveDirectory.PasswordProtection.Store.<>cDisplayClass32_0.b0(KeyValuePair`2 group) at System.Threading.Tasks.Parallel.<>cDisplayClass42_0`2.b1() at System.Threading.Tasks.Task.InnerInvokeWithArg(Task childTask) at System.Threading.Tasks.Task.<>c__DisplayClass176_0.b__0(Object )<---

I am going to erase the complete store content and will try a new import, will let you know then.

BR Bernd

ryannewington commented 8 months ago

Something has locked open your store database while LPP is trying to read it.

If it's replicated with DFS-R, pause the replication group.

Try add an exclusion for your antivirus for the store folder.

BerndAbb commented 8 months ago

Am with you, I suspect DFS-R, will let you know the comeout. BR Bernd

BerndAbb commented 8 months ago

Alright, DFS-R was the issue, paused the replication, recreated the p folder for the passwords and brew a fresh hash repository, all went perfectly fine. Thank you very much and kudos for the great solution and support here!

BerndAbb commented 8 months ago

DFS-R had a file in access, pausing the replication solved the issue

ryannewington commented 8 months ago

Glad you got it sorted

I'll leave this one open as a task to improve that error message in a future version.

BerndAbb commented 8 months ago

Perfectly fine, good idea to improve the error message! All the best and thanks again!