Closed slapcat closed 2 years ago
Hey @slapcat, thanks for reporting this bug and help making adsys better.
Can you share a little bit more about your Active Directory configuration and version? We haven’t encountered a samba share for Active Directory with all capitals. Do you have anything in the local samba config or on the Active Directory SYSVOL resulting in this?
Before making it more flexible, it would be good for us to be able to reproduce this configuration, so that we can create non regression tests based on this. Thanks!
Thanks for the quick reply! My Windows Server 2019 is very basic and I only set it up to test ADSys. I followed the white paper on best practices and only have DNS and AD DS running on the server.
Below I've added my system information, configuration of all GPOs, and some of my sysvol directory structure. I noticed that some policy folders have the correct title case subfolders (Machine/User) while others do not. Please let me know if you need any other info!
sysinfo.txt GPOs.pdf PowerShell_transcript.EXAMPLE.cgyMVdWD.20220615083150.txt
I reproduced the same behavior on a fresh install of 20.04 (focal) using the same AD server.
I've also tried manually renaming the folders on the Windows side, purging adsys and reinstalling, then running an update. A different error appears:
root@adsys:/# adsysctl update -m -vvv
INFO github.com/ubuntu/adsys/internal/config/config.go:62 Init() No configuration file: Config File "adsys" Not Found in "[/ /root /etc]".
We will only use the defaults, env variables or flags.
DEBUG Connecting as [[5090:416727]]
DEBUG github.com/ubuntu/adsys/internal/grpc/logconnections/logconnections.go:27 StreamServerInterceptor.func1() New request /service/UpdatePolicy
DEBUG github.com/ubuntu/adsys/internal/grpc/logconnections/logconnections.go:60 loggedServerStream.RecvMsg() Requesting with parameters: IsComputer: true, All: false, Target: adsys, Krb5Cc:
DEBUG github.com/ubuntu/adsys/internal/ad/ad.go:533 (*AD).NormalizeTargetName() NormalizeTargetName for "adsys", type "computer"
DEBUG github.com/ubuntu/adsys/internal/authorizer/authorizer.go:111 Authorizer.IsAllowedFromContext() Check if grpc request peer is authorized
DEBUG github.com/ubuntu/adsys/internal/authorizer/authorizer.go:150 Authorizer.isAllowed() Authorized as being administrator
DEBUG github.com/ubuntu/adsys/internal/ad/ad.go:210 (*AD).GetPolicies() GetPolicies for "adsys", type "computer"
DEBUG github.com/ubuntu/adsys/internal/ad/ad.go:278 (*AD).GetPolicies() Getting gpo list with arguments: "--objectclass computer ldap://example.example.com adsys"
DEBUG github.com/ubuntu/adsys/internal/ad/ad.go:300 (*AD).GetPolicies() GPO "Default Domain Policy" for "adsys" available at "smb://example.com/sysvol/example.com/Policies/{31B2F340-016D-11D2-945F-00C04FB984F9}"
DEBUG github.com/ubuntu/adsys/internal/ad/download.go:113 (*AD).fetch.func2() Analyzing "assets"
DEBUG github.com/ubuntu/adsys/internal/ad/download.go:113 (*AD).fetch.func2() Analyzing "Default Domain Policy"
INFO github.com/ubuntu/adsys/internal/ad/download.go:124 (*AD).fetch.func2() No assets directory with GPT.INI file found on AD, skipping assets download
DEBUG github.com/ubuntu/adsys/internal/ad/ad.go:449 (*AD).parseGPOs.func1() Parsing GPO "Default Domain Policy"
ERRORgithub.com/ubuntu/adsys/cmd/adsysd/main.go:50 main.run() Error from server: error while updating policy: can't get policies for "adsys": one or more error while parsing downloaded elements: /var/cache/adsys/sysvol/Policies/{31B2F340-016D-11D2-945F-00C04FB984F9}/Machine/Registry.pol :can't parse policy: 3 type is not supported for key EFSBlob
Ok, let’s separate issues, shall we? This one will be on the case and we’ll fix it once we get time to work back on this project (we have several deploiements and never had that strangely).
I’m puzzled on the second issue and I think you should attach the .pol file to a new bug report so that we can analyze (the type 3 is indeed, not supported, but shouldn’t be part of the keys we analyze as we don’t ship any in our namespace. So how does the EFSBlob key is now part of it?)
A question on the path content itself (on this bug): can you list the whole content (recursively) of \\Example\sysvol\example.com\Policies\{31B2F340-016D-11D2-945F-00C04FB984F9}
? I want to check in particular if Registry.pol
is all capital letters or not.
Sounds good. I think the second issue was just because I was monkeying around with the Windows directory structure, so I'm less concerned about that than the first/primary issues. I've attached a recursive list of the directory as well as the .pol
files if they are of any use.
I don’t see any MACHINE capitalized in fileSystem::\\Example\sysvol\example.com\Policies\{31B2F340-016D-11D2-945F-00C04FB984F9}> ls -r
. Are you sure you listed the right directories ?
Ah, you're right. Sorry, that was grabbed after I made the manual renames. Here is a similar output from 2 days prior showing multiple GPOs with uppercase folder names:
PS Microsoft.PowerShell.Core\FileSystem::\\Example\sysvol\example.com\Policies> ls
Directory: \\Example\sysvol\example.com\Policies
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 6/10/2022 4:42 PM PolicyDefinitions
d----- 6/10/2022 4:43 PM {08F1535F-46D8-4E5C-A869-9A706EF90BF7}
d----- 6/6/2022 4:56 PM {31B2F340-016D-11D2-945F-00C04FB984F9}
d----- 6/6/2022 4:56 PM {6AC1786C-016F-11D2-945F-00C04fB984F9}
d----- 6/10/2022 3:51 PM {DED62756-47DB-4B28-862A-613E3996446E}
d----- 6/10/2022 4:40 PM {E6AA66F7-6D3B-4E00-BACD-6C0BAED39BCD}
PS Microsoft.PowerShell.Core\FileSystem::\\Example\sysvol\example.com\Policies> ls .\PolicyDefinitions\
Directory: \\Example\sysvol\example.com\Policies\PolicyDefinitions
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 6/10/2022 4:42 PM en-US
-a---- 6/10/2022 4:22 PM 158682 ALL.admx
PS Microsoft.PowerShell.Core\FileSystem::\\Example\sysvol\example.com\Policies> ls "{08F1535F-46D8-4E5C-A869-9A706EF90BF7}"
Directory: \\Example\sysvol\example.com\Policies\{08F1535F-46D8-4E5C-A869-9A706EF90BF7}
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 6/10/2022 4:45 PM Machine
d----- 6/10/2022 4:45 PM User
-a---- 6/10/2022 4:43 PM 0 GPO.cmt
-a---- 6/10/2022 4:45 PM 64 GPT.INI
PS Microsoft.PowerShell.Core\FileSystem::\\Example\sysvol\example.com\Policies> ls "{31B2F340-016D-11D2-945F-00C04FB984F9}"
Directory: \\Example\sysvol\example.com\Policies\{31B2F340-016D-11D2-945F-00C04FB984F9}
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 6/10/2022 4:26 PM MACHINE
d----- 6/10/2022 4:26 PM USER
-a---- 6/10/2022 4:26 PM 27 GPT.INI
PS Microsoft.PowerShell.Core\FileSystem::\\Example\sysvol\example.com\Policies> ls "{6AC1786C-016F-11D2-945F-00C04fB984F9}"
Directory: \\Example\sysvol\example.com\Policies\{6AC1786C-016F-11D2-945F-00C04fB984F9}
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 6/6/2022 4:56 PM MACHINE
d----- 6/6/2022 4:56 PM USER
-a---- 6/6/2022 4:56 PM 22 GPT.INI
PS Microsoft.PowerShell.Core\FileSystem::\\Example\sysvol\example.com\Policies> ls "{DED62756-47DB-4B28-862A-613E3996446E}"
Directory: \\Example\sysvol\example.com\Policies\{DED62756-47DB-4B28-862A-613E3996446E}
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 6/10/2022 3:52 PM Machine
d----- 6/10/2022 3:51 PM User
-a---- 6/10/2022 3:52 PM 63 GPT.INI
PS Microsoft.PowerShell.Core\FileSystem::\\Example\sysvol\example.com\Policies> ls "{E6AA66F7-6D3B-4E00-BACD-6C0BAED39BCD}"
Directory: \\Example\sysvol\example.com\Policies\{E6AA66F7-6D3B-4E00-BACD-6C0BAED39BCD}
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 6/10/2022 4:40 PM Machine
d----- 6/10/2022 4:40 PM User
-a---- 6/10/2022 4:40 PM 59 GPT.INI
Excellent! This is what we needed :) So, GPT.INI is always capitale, only Machine vs MACHINE and User vs USER.
I wonder if we do something completely case independent or just support those 2 cases (avoid listing every directories for lowercase string match). This will be easy to fix anyway.
Glad to hear it!
Adding one more detail: I reinstalled the Windows server and noticed that the Default Domain Policy and Default Domain Controllers Policy directories both had UPPERCASE folder names, but as soon as I created a new GPO from scratch, it used TitleCase names. Hope this helps.
This issue still happens, only now it's restricted to the pol file, some policies are sent from AD as (User|Machine)/Registry.pol which is what adsys expects, while other policies are sent as (User|Machine)/registry.pol which are not read by adsys, a symbolic link to the expected filename is a workaround.
@falencastro do you mind opening another bug report for that one as it’s a different issue? It’s true that adsys expect Registry.pol
as samba and other services, so we may have multiple code impacts.
Description
Reproduction
Environment
Installed versions
Additional context
User running
adsysctl update -vvv
:Admin running
sudo adsysctl update -a -vvv
:sudo ls -lh /var/cache/adsys/sysvol/Policies/{31B2F340-016D-11D2-945F-00C04FB984F9}/
:Important errors: