<div dir='auto'><div>Forwarding this, as it didn't seem to come through to tech@ last night, when I sent it.</div><div dir="auto"><br><div class="gmail_quote" dir="auto">---------- Forwarded message ----------<br>From: Dylan Hicks <dylanh333@ucc.gu.uwa.edu.au><br>Date: 28 Nov 2023 23:28<br>Subject: Yunolan has been added to Winadmin<br>To: tech@ucc.asn.au<br>Cc: Joe Thorpe <yunolan@ucc.gu.uwa.edu.au><br><br type="attribution"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi All,<br><br>Just an FYI, I have now added Yunolan to Winadmin, following a request on #ucc - "Any chance I can get local admin on the UCC PC's? Ive bugged Cormac 5 times today while installing node".<br>[BLU] and [BRD] also confirmed this was okay, before I made the change.<br><br>In terms of how I did this, I deliberately did <em><u><strong>not</strong></u></em> log into Samson as `root` and use ye old `samba-tool` cowboy method.<br>Instead, I went with the much more painful (but secure) approach of using LDAP with `ldapsearch` and `ldapodify` - authenticated as me via kerberos - to update the member list of `winadmin`.<br><br>Steps to do this as follows:<ul><li>Get a Kerberos (ticket-generating-)ticket (TGT), if you don't already have one:<ul><li>Run `klist` to see what kerberos tickets you currently possess.</li><li>Run `kinit` to get a fresh TGT.</li></ul></li><li>Get distinguished name (dn) of the target group:<ul><li>Query: `ldapsearch -H 'ldap://ad.ucc.gu.uwa.edu.au' '(sAMAccountName=winadmin)' dn`</li><li>Result: "CN=winadmin,OU=Groups,DC=ad,DC=ucc,DC=gu,DC=uwa,DC=edu,DC=au"</li></ul></li><li>Get dn of target user:<ul><li>Query: `ldapsearch -H 'ldap://ad.ucc.gu.uwa.edu.au' '(sAMAccountName=yunolan)' dn`</li><li>Result: "CN=yunolan,CN=Users,DC=ad,DC=ucc,DC=gu,DC=uwa,DC=edu,DC=au"</li></ul></li><li>Write an LDIF (script?) to add Yunolan as a member, e.g. "~/add-yunolan-to-winadmin.ldif", using the below format (see `man ldif`):<br>```<br><em>dn: CN=winadmin,OU=Groups,DC=ad,DC=ucc,DC=gu,DC=uwa,DC=edu,DC=au<br>changetype: modify<br>add: member<br>member: CN=yunolan,CN=Users,DC=ad,DC=ucc,DC=gu,DC=uwa,DC=edu,DC=au</em><br>```</li><li>Modify the "winadmin" group with the above LDIF script:<ul><li>`ldapmodify -H 'ldap://ad.ucc.gu.uwa.edu.au' -f add-yunolan-to-winadmin.ldif`</li></ul></li><li>Check that Yunolan now shows as a member:<ul><li>LDAP Query: `ldapsearch -H 'ldap://ad.ucc.gu.uwa.edu.au' '(sAMAccountName=winadmin)' | less`</li><li>AD integration on Motsudo:<ul><li>Run: `id yunolan`</li><li>If "winadmin" doesn't show up, clear the cached AD info SSSD has on Yunolan with `sudo sss_cache -u yunolan`</li><li>Run `id yunolan` again</li></ul></li></ul></li></ul><br>Is this harder? Yes... but only because the `ldap(search|modify)` tooling kinda sucks - there are better tools out there that let you run things like `Add-ADGroupMember -Identity winadmin -Members yunolan` and call it a day, but that particular example doesn't work with SAMBA (it needs Active Directory Web Services >:( ).<br>in either case, I'd say this is a better and much more secure practice than running `samba-tool` as root on Samson.<br><br>--<br>Kind regards,<br>Dylan Hicks [333]
</blockquote></div><br></div></div>