Skip to content

Commit d712d42

Browse files
TravisEz13iSazonov
andcommitted
Update RFCXXXX-Policy.md
Apply suggestions from code review Co-Authored-By: Ilya <[email protected]> Update 1-Draft/RFCXXXX-Policy.md Update 1-Draft/RFCXXXX-Policy.md Co-Authored-By: Ilya <[email protected]>
1 parent 4eed701 commit d712d42

File tree

1 file changed

+33
-52
lines changed

1 file changed

+33
-52
lines changed

1-Draft/RFCXXXX-Policy.md

Lines changed: 33 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Comments Due: 6/30/2019
1212

1313
## Motivation
1414

15-
Consumers, developers, and enterprise system administrators should be able to flexibly and reliable way to configure PowerShell 7.
15+
Consumers, developers, and enterprise system administrators should be able to flexibly and reliable configure PowerShell 7.
1616

1717
## Acknowledgement
1818

@@ -43,9 +43,12 @@ PowerShell 7 has hard-coded defaults for all configuration options.
4343

4444
The default values must be `secure-by-default`.
4545

46-
For release versions hard-coded defaults must be the same as ones in re-installed configuration files. For preview versions they may vary (ex., enable experimental features and so on).
46+
For release versions hard-coded defaults must be the same as ones in pre-installed configuration files. For preview versions they may vary (ex., enable experimental features and so on).
4747

48-
If during startup PowerShell 7 cannot read system configuration files it fails to startup.
48+
System configuration includes security sensitive setting,
49+
and failing to read those setting could result in an insecure system.
50+
So, if during startup, PowerShell 7 cannot read files read from the Computer-Wide scope,
51+
it fails to startup.
4952

5053
If during startup PowerShell 7 cannot read user configuration files it uses _hardcoded_ defaults.
5154

@@ -55,27 +58,28 @@ If during operation PowerShell 7 cannot read configuration files it continue to
5558

5659
`PowerShell 7` settings are grouped into `Policy settings` and `Regular settings`.
5760
Regular settings are normal configuration settings.
58-
Regular settings can be treated as default values.
59-
Policy settings is high priority and overlap regular settings.
60-
Policy settings are used by administrators to centrally manage applications.
61+
Regular settings can be treated as default and recommended values.
62+
Policy settings is higher precedence.
63+
See [Precedence for Policy settings in descending order](#precedence-for-policy-settings-in-descending-order).
64+
Policy settings are used by administrators to centrally manage PowerShell and hosted applications.
6165

6266
| Location | Policy settings | Regular settings |
6367
|--------------|-----------------------------------------------------------|------------------------------------------------------------|
6468
| File section | "PowerShell": { "PolicySettings": {...} } | "PowerShell": { "RegularSettings": {...} } |
65-
| File section | "OtherPowerShellApplication": { "PolicySettings": {...} } | "OtherPowerShellApplication": { "RegularSettings": {...} } |
6669
| Registry key | Software\Policies\PowerShellCore | Software\PowerShellCore |
6770

6871
### Policy settings Setting Fall-Back
6972

7073
#### Motivation - Policy Setting Fall-Back
7174

72-
This is to allow Fall-back to Windows PowerShell policies.
75+
This is to allow fall-back to Windows PowerShell policies.
7376

7477
#### Implementation
7578

7679
For Policy Settings,
7780
each policy should have a `Use Windows PowerShell Policy` which will indicate that the policy should the read from
7881
`SOFTWARE\Policies\Microsoft\Windows\PowerShell` instead of `Software\Policies\PowerShellCore`.
82+
The default in Group Policy is to have no policy, so it would not fall back to Windows PowerShell Policy, or apply PowerShell 7 policy.
7983

8084
### Precedence of applying settings
8185

@@ -85,25 +89,30 @@ Because a configuration setting can be in several schemes, the setting wins acco
8589

8690
| Scheme | Windows | Unix |
8791
|-----------------------------|------------------------------------------------------|------------------------------------------------------|
88-
| GPO -> Computer Policy | HKLM\Software\Policies\PowerShellCore | /etc/powershell.config.json |
89-
| GPO -> User Policy | HKCU\Software\Policies\PowerShellCore | See `Comment A` below |
90-
| File -> Computer-Wide | %ProgramFiles%/PowerShell/powershell.config.json | /opt/Microsoft/powershell/powershell.config.json |
92+
| GPO -> Computer Policy | HKLM\Software\Policies\PowerShellCore | /etc/powershell/powershell.config.json |
93+
| GPO -> User Policy | HKCU\Software\Policies\PowerShellCore | See [`Comment A`](#comment-a) below |
94+
| File -> Computer-Wide | %ProgramFiles%/PowerShell/powershell.config.json | /etc/powershell/powershell.config.json |
9195
| File -> Application-Startup | pwsh -settingsfile `somepath/powershell.config.json` | pwsh -settingsfile `somepath/powershell.config.json` |
9296
| File -> User-Wide | %APPDATA%/powershell.config.json | %XDG_CONFIG_HOME%/powershell.config.json |
93-
| File -> Application-Wide | $apphome/powershell.config.json | $apphome/powershell.config.json |
97+
| File -> Application-Wide | $PSHome/powershell.config.json | $PSHome/powershell.config.json |
9498

9599
Defaults:
96100

97101
`%APPDATA%` - `C:\Users\useraccount\AppData\Roaming`
98102

99103
`%XDG_CONFIG_HOME%` - `HOME/.config`
100104

105+
`$PSHome` definition from [about_powershell_config](https://docs.microsoft.com/powershell/module/microsoft.powershell.core/about/about_powershell_config?view=powershell-6) - The $PSHOME location is defined as the same directory as the executing System.Management.Automation.dll assembly.
106+
This applies to hosted PowerShell SDK instances as well.
101107
#### Parameter `-settingsfile`
102108

103109
With `-settingsfile` parameter users can assign custom settings from the config file and overwrite user-wide and application-wide settings.
104110

105111
##### Computer-wide and user policy settings
106112

113+
Definitions:
114+
- System Lock-down mode: When Windows Defender Application Control or AppLocker force PowerShell into Constrained Language mode and only trusted code runs in Full Language mode. See [PowerShell Constrained Language Mode](https://devblogs.microsoft.com/powershell/powershell-constrained-language-mode/)
115+
107116
Admin/root users can overwrite computer-wide and user policy settings using `-settingsfile`,
108117
only when not in System Lock-down mode.
109118

@@ -115,9 +124,9 @@ This will have performance impact on startup, but only when `-settingsfile` is s
115124
|-----------------------------|------------------------------------------------------|------------------------------------------------------|
116125
| File -> Application-Startup | pwsh -settingsfile `somepath/powershell.config.json` | pwsh -settingsfile `somepath/powershell.config.json` |
117126
| File -> Application-Wide | $apphome\powershell.config.json | $apphome/powershell.config.json |
118-
| File -> User-Wide | %APPDATA%\powershell.config.json | ~/powershell.config.json |
127+
| File -> User-Wide | %APPDATA%\powershell.config.json | ~/.config/powershell/powershell.config.json |
119128
| File -> Computer-Wide | %ProgramFiles%\PowerShell\powershell.config.json | /opt/Microsoft/powershell/powershell.config.json |
120-
| GPO -> User Config | HKCU\Software\PowerShellCore | See `Comment A` below |
129+
| GPO -> User Config | HKCU\Software\PowerShellCore | ~/.config/powershell/powershell.config.json | |
121130
| GPO -> Computer Config | HKLM\Software\PowerShellCore | /etc/powershell.config.json |
122131

123132
### Configuration settings
@@ -182,53 +191,25 @@ I filed [#9632](https://github.com/PowerShell/PowerShell/issues/9632) on Updatab
182191
"PoliciesSettings": {
183192
...
184193
}
185-
},
186-
187-
"OtherPowerShellApplication": {
188-
"RegularSettings": {
189-
...
190-
},
191-
"PolicySettings": {
192-
...
193-
}
194+
}
194195
}
195196
```
196197

197198
## Alternate Proposals and Considerations
198199

199200
### Automatically resolve Windows PowerShell policy conflicts
200201

201-
We could attempt to resolve policy conflicts between PowerShell 7 policy and Windows PowerShell policy.
202-
This would make the `Precedence for Policy settings` not just a simple list but a complex set of rules that would not be easily understood. See [this conversation](https://github.com/PowerShell/PowerShell/issues/9309?#issuecomment-480643922).
202+
#### Motivation
203203

204-
### Allowing environment variable in the JSON
204+
This is a description of the alternative to [Policy settings Setting Fall-Back](#policy-settings-setting-fall-back).
205+
The main purpose of describing the alternative is to describe why it should not be pursued.
205206

206-
A new RFC should be drafted about how to allow environment variables in the JSON.
207-
This would allow consistent files across platforms.
207+
#### Description
208208

209-
### Comment A
209+
PowerShell could attempt to resolve policy conflicts between PowerShell 7 policy and Windows PowerShell policy.
210+
This would make the `Precedence for Policy settings` not just a simple list but a complex set of rules that would not be easily understood. See [this conversation](https://github.com/PowerShell/PowerShell/issues/9309?#issuecomment-480643922).
210211

211-
Mainly for Unix we'd add `Users` section to computer wide JSON file (`/etc/powershell.config.json`) to allow administrators set policies and regular settings on user level base
212+
### Allowing environment variable in the JSON
212213

213-
```json
214-
{
215-
"PowerShell": {
216-
"RegularSettings": {
217-
...
218-
},
219-
"PolicySettings": {
220-
...
221-
},
222-
"Users": {
223-
"Smith": {
224-
"PowerShell": {
225-
"RegularSettings": {
226-
...
227-
},
228-
"PolicySettings": {
229-
...
230-
}
231-
}
232-
}
233-
}
234-
```
214+
A new RFC should be drafted about how to allow environment variables in the values in the JSON.
215+
This would allow consistent files across platforms.

0 commit comments

Comments
 (0)