-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
LinuxSshServerSecurityBaseline_AINE.json
478 lines (478 loc) · 20.7 KB
/
LinuxSshServerSecurityBaseline_AINE.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
{
"properties": {
"displayName": "[Preview]: Audit SSH Posture Control on Linux machines",
"policyType": "BuiltIn",
"mode": "Indexed",
"description": "Requires that prerequisites are deployed to the policy assignment scope. For details, visit https://aka.ms/gcpol. Machines are non-compliant if SSH Server is not securely configured on the Linux machines.",
"metadata": {
"version": "1.0.0-preview",
"category": "Guest Configuration",
"preview": true,
"requiredProviders": [
"Microsoft.GuestConfiguration"
],
"guestConfiguration": {
"name": "LinuxSshServerSecurityBaseline",
"version": "1.*",
"configurationParameter": {
"accessPermissionsForSshdConfig": "Ensure that permissions on /etc/ssh/sshd_config are configured;DesiredObjectValue",
"ignoreHosts": "Ensure that the SSH IgnoreRhosts is configured;DesiredObjectValue",
"logLevel": "Ensure that the SSH LogLevel is configured;DesiredObjectValue",
"maxAuthTries": "Ensure that the SSH MaxAuthTries is configured;DesiredObjectValue",
"allowUsers": "Ensure that the allowed users for SSH access are configured;DesiredObjectValue",
"denyUsers": "Ensure that the denied users for SSH are configured;DesiredObjectValue",
"allowGroups": "Ensure that the allowed groups for SSH are configured;DesiredObjectValue",
"denyGroups": "Ensure that the denied groups for SSH are configured;DesiredObjectValue",
"hostBasedAuthentication": "Ensure that the SSH HostBasedAuthentication is configured;DesiredObjectValue",
"permitRootLogin": "Ensure that the SSH PermitRootLogin is configured;DesiredObjectValue",
"permitEmptyPasswords": "Ensure that the SSH PermitEmptyPasswords is configured;DesiredObjectValue",
"clientAliveCountMax": "Ensure that the SSH ClientAliveCountMax is configured;DesiredObjectValue",
"clientAliveInterval": "Ensure that the SSH ClientAliveInterval is configured;DesiredObjectValue",
"loginGraceTime": "Ensure that the SSH LoginGraceTime is configured;DesiredObjectValue",
"messageAuthenticationCodeAlgorithms": "Ensure that only approved MAC algorithms are used;DesiredObjectValue",
"banner": "Ensure that the SSH warning banner is configured;DesiredObjectValue",
"permitUserEnvironment": "Ensure that the SSH PermitUserEnvironment is configured;DesiredObjectValue",
"ciphers": "Ensure that appropriate ciphers are used for SSH;DesiredObjectValue",
"port": "Ensure that the SSH port is configured;DesiredObjectValue"
}
}
},
"version": "1.0.0-preview",
"parameters": {
"IncludeArcMachines": {
"type": "string",
"metadata": {
"displayName": "Include Arc connected servers",
"description": "By selecting this option, you agree to be charged monthly per Arc connected machine.",
"portalReview": "true"
},
"allowedValues": [
"true",
"false"
],
"defaultValue": "false"
},
"effect": {
"type": "string",
"metadata": {
"displayName": "Effect",
"description": "Enable or disable the execution of this policy"
},
"allowedValues": [
"AuditIfNotExists",
"Disabled"
],
"defaultValue": "AuditIfNotExists"
},
"accessPermissionsForSshdConfig": {
"type": "string",
"metadata": {
"displayName": "Access permissions for sshd_config",
"description": "File access permissions for /etc/ssh/sshd_config. Default is '600'"
},
"defaultValue": "600"
},
"ignoreHosts": {
"type": "string",
"metadata": {
"displayName": "Ignore rhosts and shosts",
"description": "Whether to ignore per-user .rhosts and .shosts files during HostbasedAuthentication. Default is 'yes'"
},
"defaultValue": "yes"
},
"logLevel": {
"type": "string",
"metadata": {
"displayName": "Log verbosity level",
"description": "The verbosity level for the sshd logging. Default is 'INFO'"
},
"defaultValue": "INFO"
},
"maxAuthTries": {
"type": "string",
"metadata": {
"displayName": "Maximum number of authentication attempts",
"description": "The maximum number of authentication attempts permitted per connection. Default is '6'"
},
"defaultValue": "6"
},
"allowUsers": {
"type": "string",
"metadata": {
"displayName": "Allowed users for SSH",
"description": "List of users to be allowed to connect with SSH. Default is all authenticated users ('*@*')"
},
"defaultValue": "*@*"
},
"denyUsers": {
"type": "string",
"metadata": {
"displayName": "Denied users for SSH",
"description": "List of users to be denied to connect with SSH. Default is 'root'"
},
"defaultValue": "root"
},
"allowGroups": {
"type": "string",
"metadata": {
"displayName": "Allowed groups for SSH",
"description": "List of user groups to be allowed to connect with SSH. Default is all groups ('*')"
},
"defaultValue": "*"
},
"denyGroups": {
"type": "string",
"metadata": {
"displayName": "Denied groups for SSH",
"description": "List of user groups to be denied to connect with SSH. Default is 'root'"
},
"defaultValue": "root"
},
"hostBasedAuthentication": {
"type": "string",
"metadata": {
"displayName": "Host-based authentication",
"description": "Host-based authentication. Default is 'no'"
},
"defaultValue": "no"
},
"permitRootLogin": {
"type": "string",
"metadata": {
"displayName": "Whether root can log in using ssh",
"description": "Whether root can log in using ssh. Default is 'no'"
},
"defaultValue": "no"
},
"permitEmptyPasswords": {
"type": "string",
"metadata": {
"displayName": "Whether the server allows login to accounts with empty password strings",
"description": "Whether the server allows login to accounts with empty password strings. Default is 'no'"
},
"defaultValue": "no"
},
"clientAliveCountMax": {
"type": "string",
"metadata": {
"displayName": "The number of client alive messages which may be sent without sshd receiving any messages back from the client",
"description": "The number of client alive messages which may be sent without sshd receiving any messages back from the client. Default is '0'"
},
"defaultValue": "0"
},
"clientAliveInterval": {
"type": "string",
"metadata": {
"displayName": "Timeout interval in seconds after which if no data has been received from the client, sshd will send a message to request a response",
"description": "Timeout interval in seconds after which if no data has been received from the client, sshd will send a message to request a response. Default is 1 hour ('3600')"
},
"defaultValue": "3600"
},
"loginGraceTime": {
"type": "string",
"metadata": {
"displayName": "The time in seconds after which the server disconnects if the user has not successfully logged in",
"description": "The time in seconds after which the server disconnects if the user has not successfully logged in. Default is 1 minute ('60')"
},
"defaultValue": "60"
},
"messageAuthenticationCodeAlgorithms": {
"type": "string",
"metadata": {
"displayName": "The list of available message authentication code (MAC) algorithms",
"description": "The list of available message authentication code (MAC) algorithms. Default is 'hmac-sha2-256,hmac-sha2-256-etm@openssh.com,hmac-sha2-512,hmac-sha2-512-etm@openssh.com'"
},
"defaultValue": "hmac-sha2-256,hmac-sha2-256-etm@openssh.com,hmac-sha2-512,hmac-sha2-512-etm@openssh.com"
},
"banner": {
"type": "string",
"metadata": {
"displayName": "The contents of the banner file that is sent to the remote user before authentication is allowed",
"description": "The contents of the banner file that is sent to the remote user before authentication is allowed. Default is '#######################################################################\n\nAuthorized access only!\n\nIf you are not authorized to access or use this system, disconnect now!\n\n#######################################################################\n'"
},
"defaultValue": "#######################################################################\n\nAuthorized access only!\n\nIf you are not authorized to access or use this system, disconnect now!\n\n#######################################################################\n"
},
"permitUserEnvironment": {
"type": "string",
"metadata": {
"displayName": "Whether ~/.ssh/environment and environment= options in ~/.ssh/authorized_keys are processed by sshd",
"description": "Whether ~/.ssh/environment and environment= options in ~/.ssh/authorized_keys are processed by sshd. Default is 'no'"
},
"defaultValue": "no"
},
"ciphers": {
"type": "string",
"metadata": {
"displayName": "The list of allowed ciphers",
"description": "The list of allowed ciphers. Default is 'aes128-ctr,aes192-ctr,aes256-ctr'"
},
"defaultValue": "aes128-ctr,aes192-ctr,aes256-ctr"
},
"port": {
"type": "string",
"metadata": {
"displayName": "The SSH port",
"description": "The SSH port. Default is '22'"
},
"defaultValue": "22"
}
},
"policyRule": {
"if": {
"anyOf": [
{
"allOf": [
{
"anyOf": [
{
"field": "type",
"equals": "Microsoft.Compute/virtualMachines"
},
{
"field": "type",
"equals": "Microsoft.Compute/virtualMachineScaleSets"
}
]
},
{
"field": "tags['aks-managed-orchestrator']",
"exists": false
},
{
"field": "tags['aks-managed-poolName']",
"exists": false
},
{
"anyOf": [
{
"field": "Microsoft.Compute/imagePublisher",
"in": [
"microsoft-aks",
"qubole-inc",
"datastax",
"couchbase",
"scalegrid",
"checkpoint",
"paloaltonetworks",
"debian",
"credativ"
]
},
{
"allOf": [
{
"field": "Microsoft.Compute/imagePublisher",
"equals": "OpenLogic"
},
{
"field": "Microsoft.Compute/imageSKU",
"notLike": "6*"
}
]
},
{
"allOf": [
{
"field": "Microsoft.Compute/imagePublisher",
"equals": "Oracle"
},
{
"field": "Microsoft.Compute/imageSKU",
"notLike": "6*"
}
]
},
{
"allOf": [
{
"field": "Microsoft.Compute/imagePublisher",
"equals": "RedHat"
},
{
"field": "Microsoft.Compute/imageSKU",
"notLike": "6*"
}
]
},
{
"allOf": [
{
"field": "Microsoft.Compute/imagePublisher",
"equals": "center-for-internet-security-inc"
},
{
"field": "Microsoft.Compute/imageOffer",
"notLike": "cis-win*"
}
]
},
{
"allOf": [
{
"field": "Microsoft.Compute/imagePublisher",
"equals": "Suse"
},
{
"field": "Microsoft.Compute/imageSKU",
"notLike": "11*"
}
]
},
{
"allOf": [
{
"field": "Microsoft.Compute/imagePublisher",
"equals": "Canonical"
},
{
"field": "Microsoft.Compute/imageSKU",
"notLike": "12*"
}
]
},
{
"allOf": [
{
"field": "Microsoft.Compute/imagePublisher",
"equals": "microsoft-dsvm"
},
{
"field": "Microsoft.Compute/imageOffer",
"notLike": "dsvm-win*"
}
]
},
{
"allOf": [
{
"field": "Microsoft.Compute/imagePublisher",
"equals": "cloudera"
},
{
"field": "Microsoft.Compute/imageSKU",
"notLike": "6*"
}
]
},
{
"allOf": [
{
"field": "Microsoft.Compute/imagePublisher",
"equals": "microsoft-ads"
},
{
"field": "Microsoft.Compute/imageOffer",
"like": "linux*"
}
]
},
{
"allOf": [
{
"anyOf": [
{
"field": "Microsoft.Compute/virtualMachines/osProfile.linuxConfiguration",
"exists": true
},
{
"field": "Microsoft.Compute/virtualMachines/storageProfile.osDisk.osType",
"like": "Linux*"
}
]
},
{
"anyOf": [
{
"field": "Microsoft.Compute/imagePublisher",
"exists": false
},
{
"field": "Microsoft.Compute/imagePublisher",
"notIn": [
"OpenLogic",
"RedHat",
"credativ",
"Suse",
"Canonical",
"microsoft-dsvm",
"cloudera",
"microsoft-ads",
"center-for-internet-security-inc",
"Oracle",
"AzureDatabricks",
"azureopenshift"
]
}
]
}
]
}
]
}
]
},
{
"allOf": [
{
"value": "[parameters('IncludeArcMachines')]",
"equals": true
},
{
"anyOf": [
{
"allOf": [
{
"field": "type",
"equals": "Microsoft.HybridCompute/machines"
},
{
"field": "Microsoft.HybridCompute/imageOffer",
"like": "linux*"
}
]
},
{
"allOf": [
{
"field": "type",
"equals": "Microsoft.ConnectedVMwarevSphere/virtualMachines"
},
{
"field": "Microsoft.ConnectedVMwarevSphere/virtualMachines/osProfile.osType",
"like": "linux*"
}
]
}
]
}
]
}
]
},
"then": {
"effect": "[parameters('effect')]",
"details": {
"type": "Microsoft.GuestConfiguration/guestConfigurationAssignments",
"name": "[concat('LinuxSshServerSecurityBaseline$pid', uniqueString(policy().assignmentId, policy().definitionReferenceId))]",
"existenceCondition": {
"allOf": [
{
"field": "Microsoft.GuestConfiguration/guestConfigurationAssignments/complianceStatus",
"equals": "Compliant"
},
{
"field": "Microsoft.GuestConfiguration/guestConfigurationAssignments/parameterHash",
"equals": "[base64(concat('Ensure that permissions on /etc/ssh/sshd_config are configured;DesiredObjectValue', '=', parameters('accessPermissionsForSshdConfig'), ',', 'Ensure that the SSH IgnoreRhosts is configured;DesiredObjectValue', '=', parameters('ignoreHosts'), ',', 'Ensure that the SSH LogLevel is configured;DesiredObjectValue', '=', parameters('logLevel'), ',', 'Ensure that the SSH MaxAuthTries is configured;DesiredObjectValue', '=', parameters('maxAuthTries'), ',', 'Ensure that the allowed users for SSH access are configured;DesiredObjectValue', '=', parameters('allowUsers'), ',', 'Ensure that the denied users for SSH are configured;DesiredObjectValue', '=', parameters('denyUsers'), ',', 'Ensure that the allowed groups for SSH are configured;DesiredObjectValue', '=', parameters('allowGroups'), ',', 'Ensure that the denied groups for SSH are configured;DesiredObjectValue', '=', parameters('denyGroups'), ',', 'Ensure that the SSH HostBasedAuthentication is configured;DesiredObjectValue', '=', parameters('hostBasedAuthentication'), ',', 'Ensure that the SSH PermitRootLogin is configured;DesiredObjectValue', '=', parameters('permitRootLogin'), ',', 'Ensure that the SSH PermitEmptyPasswords is configured;DesiredObjectValue', '=', parameters('permitEmptyPasswords'), ',', 'Ensure that the SSH ClientAliveCountMax is configured;DesiredObjectValue', '=', parameters('clientAliveCountMax'), ',', 'Ensure that the SSH ClientAliveInterval is configured;DesiredObjectValue', '=', parameters('clientAliveInterval'), ',', 'Ensure that the SSH LoginGraceTime is configured;DesiredObjectValue', '=', parameters('loginGraceTime'), ',', 'Ensure that only approved MAC algorithms are used;DesiredObjectValue', '=', parameters('messageAuthenticationCodeAlgorithms'), ',', 'Ensure that the SSH warning banner is configured;DesiredObjectValue', '=', parameters('banner'), ',', 'Ensure that the SSH PermitUserEnvironment is configured;DesiredObjectValue', '=', parameters('permitUserEnvironment'), ',', 'Ensure that appropriate ciphers are used for SSH;DesiredObjectValue', '=', parameters('ciphers'), ',', 'Ensure that the SSH port is configured;DesiredObjectValue', '=', parameters('port')))]"
}
]
}
}
}
},
"versions": [
"1.0.0-PREVIEW"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/a8f3e6a6-dcd2-434c-b0f7-6f309ce913b4",
"name": "a8f3e6a6-dcd2-434c-b0f7-6f309ce913b4"
}