Skip to content

Conversation

@tgauth
Copy link
Collaborator

@tgauth tgauth commented Jan 3, 2022

PowerShell/Win32-OpenSSH#1900

  • During sshd install, if ssh folder already exists, set permissions to the same settings as when folder is initially created in wmain_sshd.c. Essentially, ensure folder and any existing files, with few exceptions, are set to these permissions: owner: System or Admins; full access: System, Admins; read or readandexecute/synchronize: Authenticated Users
  • Any existing private key files are given the following permissions: owner: System or Admins; full access: System, Admins

@tgauth tgauth requested a review from bagajjal January 3, 2022 17:37
Copy link

@bagajjal bagajjal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.

# Folder permission is FullAccess to System and Builtin/Admins and read only access to Authenticated users, if user allows
Repair-SshFolderFilePermission -FilePath $sshProgDataPath @psBoundParameters
# All files besides private key files and log folder/files should have same permissions as ssh folder, if user allows
$restricted_files = @("ssh_host_dsa_key", "ssh_host_ecdsa_key", "ssh_host_ed25519_key", "ssh_host_rsa_key", "*.logs")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

log files can have read only permissions for authenticated users

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok - I think the log files inherit from the log folder.
When the log folder is created by SSHD, it only allows Full Access to System & Admins.

I think either situation is permissible. Having a separate check for the log files/folders that permits read access for users, but won't add read access to users, if it has not already been granted might work best?

@tgauth tgauth requested a review from bagajjal February 2, 2022 22:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants