Skip to end of metadata
Go to start of metadata

You are viewing an old version of this content. View the current version.

Compare with Current View Version History

« Previous Version 18 Next »

A Windows user account can be renamed. You almost certainly never want to do it, and changing your Yale Netids is almost impossible because of all the systems that use it, but Windows does allow it. What doesn’t change is a unique binary identifier created when the account was defined: the Security ID or SID. When you login, Windows identifies you through your SID. Access to files and directories are through the SID. Each group you are a member of also has its own SID.

There are three sources for SIDs:

  1. Microsoft generates some built in “factory installed” SIDs for standard Windows components, and many of these built in accounts also have a dummy User name.

  2. As an administrator, you create Local User accounts on your own machine. The SID for a Local User is unique and exists only on the one computer, even if you create an account with the same User name on another computer.

  3. Microsoft’s Active Directory creates SIDs that can be shared across machines. All computers that are members of the same AD, including all the Managed Workstations at Yale, share the SIDs in the yu.yale.edu domain also known by the nickname YALE. This is where your Netid and its password are saved.

Factory Installed SIDs

The Microsoft TrustedInstaller identity is built into Windows and has permission to update the most sensitive files in the operating system. It installs the monthly maintenance and optional components of Windows. You do not have and do not want to have direct access to it.

SYSTEM is an anonymous identity for most of the programs that run as background Services. There are some special versions of SYSTEM for SQL Server and Hyper-V. SYSTEM identities can access any file on a local hard disk but this SID is meaningless to other computers, so programs that run under this SID have no access to anything on another computer. There are two practical consequences of this:

  • SQL Server can only backup and restore databases to files on a local disk. When you run SSMS you can build a backup or restore request for a *.bak file on a network disk you have access to, but when that request is sent to the SQL Server it cannot access the network share so the backup fails.

  • Hyper-V runs as System and only has access to files on local disks. Every VHDX that you attach to a VM and every ISO DVD image that you mount has to be local. To import a previously exported VM, the files generated by the export have to be on local disk.

Typically, an administrator has to do a Remote Desktop login to a machine and copy network files to a local disk before a restore, import, or mount operation or copy/move files from local to network disk after a backup or export operation.

Local User SIDs created on your Computer

Yale Security Policy expects users to login with their Yale Netid to Yale Managed Workstations and other computers that are Yale owned and on the Yale network. This section describes the security procedures for personally owned computers on a home network.

A Local User is an account you create when you are acting as an administrator of your Windows 10 or 11 computer. You assign a name and a password to the account and then add it to local groups. A local user can login to the machine, own files, and can be given various permissions.

The SID for a Local User account is unique on one machine and is meaningless on other machines. You can see this by logging in as a non-admin Local User, creating a file on an NTFS formatted thumb drive, and then move the drive to another computer. The other computer has no idea who owns or created the file because the Local SID generated by that computer is meaningless to other machines.

When you login to a computer, it runs everything in your session under your SID.

Workgroup Authentication

Personally owned machines or VMs are not members of an AD Domain, but they can be on the same home or small business network. To allow simple administration and file sharing between Windows 11 computers on such networks, Microsoft has a form of Network Authentication for a “workgroup” with only Local Users.

If you create two Local Users on two personally owned computers and give each the same username and password, then the two accounts have different SIDs on each machine. If you put a file on a USB disk and move it between machines, the SID will not be recognized on the machine that did not create it.

However, if one machine shares a directory and the other machine maps that shared disk to an unused disk letter, “workgroup” authentication now applies.

Traditionally workgroup authentication has used a protocol called NTLM (or NTLMv2 in its latest version). Starting with some future version of Windows 11 after 24H2 Microsoft will be adding a new protocol based on Kerberos called LocalKDC. The difference between the two will be transparent to end users.

Either way, the two computers, without transmitting the password, agree that the server computer has a userid with the same name as the user currently logged into the client machine, and the password associated with this userid is the same on both machines. The Server end of the connection assigns it matching Local User SID to the session, and the client computer has access to the same files and services that are permitted to that Local User.

Normally, users just learn to install their same userid and password as a Local User (typically in the Administrators group) on all of the computers and VMs that they install or their home network and then they have access across the network to all services and files on all machines. They may never bother to learn terms like “workgroup”, “SID”, or “NTLM”.

Fully Qualified Usernames

While two userids with the same password match each other and allow access over the network, they still have different SIDs, and this may be important when you move disks from one computer to another. There is a Windows notation to explicitly prefix a username with the machine or AD domain where it was defined.

Assume there are two computers named SNARK and BOOJUM and each has an account named “bellman” with the same password on both machines. The notation “SNARK\bellman” means the account (and SID) for bellman on SNARK and “BOOJUM\bellman” means the account on BOOJUM.

If bellman logged into SNARK contacts BOOJUM through the network, then BOOJUM verifies that it has a local user also named “bellman” and that the password for “bellman” is the same on both BOOJUM and SNARK. So, it assigns the SID of BOOJUM\bellman to this network session and allows the remote client to access files as BOOJUM\bellman.

Active Directory Domain User SIDs

University and corporate systems assign centrally defined Domain User accounts through Active Directory. AD provides a set of central servers where administrators can create User accounts with a userid (the Netid), password, and a Domain generated SID. Administrators also join computers to the AD. Once a computer joins a Domain, it can login Domain Users, run programs under the Domain SID, and assign file and directory ownership and permissions to that SID. Everything that can be done with a Local User SID can also be done with a Domain SID, but Domain SIDs are the same on all computers that are a member of the Domain.

Yale Security Policy requires you to use your Yale AD account to login to Managed Workstations and other Yale owned computers performing Yale business. This allows the University to enforce minimal security standards.

Active Directory provides a set of accounts and SIDs that are shared between machines. When a computer joins the AD, it continues to have local user account but in addition can allow AD SIDs to login, create, and access files. The AD has its own nickname, and the nickname of the Yale AD is “YALE”. So to extend this example, assume that “bellman” is also the Netid (Userid in the Yale AD) of the person who owns the computers SNARK and BOOJUM, and he joins both machines to the Yale AD.

The account in the Yale AD for Userid “bellman” is identified as “YALE\bellman” and is a SID that is different from both SNARK\bellman and BOOJUM\bellman. However, once the two computers are joined to the AD, they can have logins, user profile directories, and file permissions for “YALE\bellman” as well as their own local “bellman” user.

The user can login to SNARK as either the domain account YALE\bellman or the local account SNARK\bellman. These are, however, two completely different users with different SIDs and there is no way to connect them. Even if YALE\bellman has the same password as SNARK\bellman, when the user is logged in as YALE\bellman he has no access to SNARK\bellman files, unless he logs on as SNARK\bellman first and grants permission to his Yale Domain user account to also access his local files. Even then, they are two separate users who have just granted each other permission to use each other’s files.

However, files created and permissions granted to YALE\bellman on either SNARK or BOOJUM are assigned to the same YALE Domain SID and they do work across machines. If YALE\bellman creates files or grant permissions to a file on an NTFS thumb drive attached to SNARK, then moves the drive to BOOJUM, then BOOJUM knows these files and permissions belong to YALE\bellman and will grant permission to access those files when YALE\bellman logs in or accesses the files over the network.

Your Own Domain Controller

Creating your own private AD is something that ordinary people don’t do. Anyone at Yale has a license to use Windows Server, and if they create a Windows Server VM, then with a few commands they can create their own AD Domain. When you create your own Domain this way, there is a special interaction between what were previously Local Users (before you created the Domain) who then also become Domain account (particularly Admins). This article would not be complete without documenting this special case.

Start with a spare computer or a VM running Windows Server. It needs a computer host name, so we will call it FIT (not an acronym, a word from the Louis Carroll Snark book). Our previous userid “bellman” is added as a local Administrator of this computer when the system is installed and is given the same password it had on the other machines. This means, of course, that it gets yet another SID (FIT\bellman) that local to and initially only meaningful on FIT, and “bellman” on other computers can access this account using Workgroup authentication.

Now two PowerShell commands documented elsewhere can transform the FIT machine into the Domain Controller of a new AD. The AD has its own name, which we will call “HUNTING”.

When the AD is created, the local administrators of the FIT Server now become administrators of the HUNTING AD Domain. Because an unknown amount of time has passed since the Server was installed, and because many files and directories may be owned or permitted to the SID of the local user FIT\bellman, it is not possible to change that SID when FIT\bellman also becomes HUNTING\bellman. So, the old Local User SID is copied to the AD and becomes the AD SID of HUNTING\bellman.

This connection aliasing Local and Domain accounts occurs only during the creation of the AD, so before you create the AD you should create all the Local User accounts that you need to behave this way.

As long as the AD continues to exist, there is no meaningful difference between a network session that authenticated to the computer through NTLM/LocalKDC as FIT\bellman and a network session that authenticated through the AD as HUNTING\bellman. Both sessions have the privileges of a Local User, Local Administrator, and Domain Admin. All programs in the sessions run under the same SID, and all operations they perform and commands they issue have both Local and Domain privileges.

This is, however, quite useful to a developer Sandbox because it means that computers and VMs that are not members of the Domain can interact with the Domain using NTLM/LocalKDC authentication as the Local User account.

Impersonate

All programs run under a SID. Some programs run in the background under Microsoft built in SIDs like SYSTEM. Other programs inherit from the session the SID of the User that authenticated to the computer.

Ordinary users can run a new program under a different userid by triggering a new Login for that program where they enter the new userid and its password. This is typically called “doing a RunAs”.

However, components that are part of Windows or run as part of the System can call a service that lets them temporarily change the SID a program is running under. This is called “impersonation”.

A program that is normally running as System may change its SID to user “bellman”, but it does not then know the password of user “bellman”, nor does it have any credentials from the AD Domain. As a result, it cannot make network requests to other computers using either “workgroup” or AD Kerberos. It can access local files and local services as “bellman”.

SSH Server

When you install OpenSSH Server (sshd.exe) on Windows, it runs as a service under a System ID.

If an SSH client logs in through SSH with a userid and password, then sshd.exe can use them to do a secondary Login. This generates a user session that has a full credential that can be used for “workgroup” or AD domain authentication to remote network services including shared disks and SQL Server databases.

However, if you use public key authentication to SSH, then no password is provided. Then sshd.exe can only do an “impersonation” and create a process to run the command passed by the remote user under the local SID of the userid specified in the SSH client connection. The SSH session can access local files permitted to that user, and SQL Server databases on that one machine, but there is no access to network services and files on other machines.

The SSH client can connect using public key authentication to either a local user account or a domain user account. The client private key simply has to match an entry in the authorized_keys file of the .ssh subdirectory of the home/profile directory of the local or domain user. The sshd.exe program can impersonate the local SID or the domain SID. However, creating a session with the domain SID does not generate Kerberos login credentials (a TGT object) just as impersonating a local SID does not provide a password for workgroup resource access. An impersonated domain SID can access local files permitted to that domain user, and can connect to a Login in a SQL Server instance on the local machine, but no access outside the machine is provided. Of course, the client could force a userid/password authentication instead of using the public keys, and then there would be a TGT granting access from the domain account to other computers on the network.

Sandbox Administration

A Developer Sandbox is a set of VMs, some Linux and some Windows, that are used to test applications. An IAM developer may have a Windows Server VM in the Sandbox with an Active Directory. Typically, a Sandbox AD is called yu.yale.sandbox (alias SANDBOX)

No computer or VM can be a member of two Domains, and a Sandbox AD cannot be configured to know about and “trust” the production yu.yale.edu (alias YALE) AD domain. This means that the developers laptop managed workstation is a member of the YALE domain, while other VMs in the sandbox may be unaffiliated “workgroup” computer or members of the SANDBOX domain.

The Windows tools that allow administration across the network are designed to work easily when both machines are members of the same Domain. They work a bit less simply if both machines are in a “workgroup” connected to the same LAN and the same Administrator userid and password are defined on all machines.

However, Windows admin tools do not work when one machine is in a Domain and the other machine is in a Workgroup, or when the two machines are members of different Domains such as YALE and SANDBOX. However, the PowerShell remote commands and sessions (Invoke-Command, New-PSSession) now support SSH between computers and can use public key authentication that works even when the client is the laptop on the YALE Domain and the remote target is either a standalone workgroup VM or a member of the SANDBOX Domain. Generally there is a PowerShell command for any administrative action you want to perform, so you can build PowerShell admin scripts that use
Invoke-Command -UserName bellman -HostName SNARK {…}
in cases where the normal
Invoke-Command -Computer SNARK {…}
doesn’t work because of mismatch between the current logged in user and the affiliation of the target machine.

  • No labels