One machine knows everyone
A college has hundreds of staff and students. One system holds every account and decides who may sign in where, and on a Windows network that system is Active Directory.
Your lab is a machine that runs one, built with Samba. Before you can keep it safe, you need to read it: the accounts, the groups and what each one is allowed to be.
The one rule
Warning
Read and change only your own lab directory. Running these checks against a real directory needs the owner's written permission. Without it, in the UK, it can break the Computer Misuse Act 1990. Your lab has no route to anyone else's machine.
Quick check: the rule
Have a go
Quick check: the rule
3 questionsBy the end of this lesson
Note
I can list the accounts and groups in my own directory and read one account's attributes.
Key words
| Word | What it means | Example |
|---|---|---|
| Directory | the store of a network's accounts, groups and machines | |
| Domain controller | the machine that runs the directory and checks sign-ins | DC01 |
| Account | a user such as jadams, or a computer such as WEB01$ | |
| Attribute | one fact stored on an account | sAMAccountName |
| Group | a set of accounts given rights together | Domain Admins |
| Service account | an account a program signs in as, not a person |
The cells students fill in are left blank in this preview.
Starter
Have a go
Starter
3 questionsList the accounts
Your tool is samba-tool. Reading the directory needs administrator rights on the machine, so each command runs with sudo.
samba-tool user list prints every account. You should see six names. Two are built in: krbtgt, which Kerberos uses, and Guest.
List every account
sudo samba-tool user list | sortShown here, not run. Press Start lab to type it into your own lab’s terminal.
Read one account's attributes
sudo ldbsearch -H /var/lib/samba/private/sam.ldb '(sAMAccountName=jadams)' sAMAccountName givenName sn userPrincipalNameShown here, not run. Press Start lab to type it into your own lab’s terminal.
Check
Have a go
Check
3 questionsGroups and service accounts
A group gives rights to its members together. samba-tool group list prints them, and the one to watch is Domain Admins: a member of it controls the whole directory.
Then find the service accounts: accounts a program signs in as. The filter asks for any account with a service name set, leaving out krbtgt. There is one, svc-sql.
List the groups
sudo samba-tool group list | sortShown here, not run. Press Start lab to type it into your own lab’s terminal.
List the user service accounts
sudo ldbsearch -H /var/lib/samba/private/sam.ldb '(&(servicePrincipalName=*)(objectCategory=person)(!(sAMAccountName=krbtgt)))' sAMAccountName servicePrincipalNameShown here, not run. Press Start lab to type it into your own lab’s terminal.
A common mistake
Warning
Many people think the risk in a directory is a user with a weak password. That matters, but the bigger risks are an account in a powerful group that should not be there, and a service account nobody watches. The rest of this module is about finding and fixing those.
What you found
Six accounts, the Domain Admins group, and one service account, svc-sql, with a service name. Each of those is a thread the next lessons pull: how sign-in works, why that service account is dangerous, and who really holds the keys.
Open README.md in your home folder any time: it lists the accounts and the rule.
Exit quiz
Have a go