You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/security-center/security-center-just-in-time.md
+56-76Lines changed: 56 additions & 76 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,73 +7,40 @@ manager: rkarlin
7
7
8
8
ms.service: security-center
9
9
ms.topic: conceptual
10
-
ms.date: 09/10/2019
10
+
ms.date: 02/25/2020
11
11
ms.author: memildin
12
12
13
13
---
14
-
# Manage virtual machine access using just-in-time
15
-
16
-
Just-in-time (JIT) virtual machine (VM) access can be used to lock down inbound traffic to your Azure VMs, reducing exposure to attacks while providing easy access to connect to VMs when needed.
17
-
18
-
> [!NOTE]
19
-
> The just-in-time feature is available on the Standard tier of Security Center. See [Pricing](security-center-pricing.md) to learn more about Security Center's pricing tiers.
14
+
# Secure your management ports with just-in-time access
20
15
16
+
If you're on Security Center's standard pricing tier (see [pricing](/azure/security-center/security-center-pricing)), you can lock down inbound traffic to your Azure VMs with just-in-time (JIT) virtual machine (VM) access. This reduces exposure to attacks while providing easy access to connect to VMs when needed.
21
17
22
18
> [!NOTE]
23
19
> Security Center just-in-time VM access currently supports only VMs deployed through Azure Resource Manager. To learn more about the classic and Resource Manager deployment models see [Azure Resource Manager vs. classic deployment](../azure-resource-manager/management/deployment-models.md).
24
20
25
-
## Attack scenario
26
-
27
-
Brute force attacks commonly target management ports as a means to gain access to a VM. If successful, an attacker can take control over the VM and establish a foothold into your environment.
28
-
29
-
One way to reduce exposure to a brute force attack is to limit the amount of time that a port is open. Management ports don't need to be open at all times. They only need to be open while you're connected to the VM, for example to perform management or maintenance tasks. When just-in-time is enabled, Security Center uses [network security group](../virtual-network/security-overview.md#security-rules) (NSG) and Azure Firewall rules, which restrict access to management ports so they cannot be targeted by attackers.
When just-in-time is enabled, Security Center locks down inbound traffic to your Azure VMs by creating an NSG rule. You select the ports on the VM to which inbound traffic will be locked down. These ports are controlled by the just-in-time solution.
36
-
37
-
When a user requests access to a VM, Security Center checks that the user has [Role-Based Access Control (RBAC)](../role-based-access-control/role-assignments-portal.md) permissions for that VM. If the request is approved, Security Center automatically configures the Network Security Groups (NSGs) and Azure Firewall to allow inbound traffic to the selected ports and requested source IP addresses or ranges, for the amount of time that was specified. After the time has expired, Security Center restores the NSGs to their previous states. Those connections that are already established are not being interrupted, however.
38
-
39
-
> [!NOTE]
40
-
> If a JIT access request is approved for a VM behind an Azure Firewall, then Security Center automatically changes both the NSG and firewall policy rules. For the amount of time that was specified, the rules allow inbound traffic to the selected ports and requested source IP addresses or ranges. After the time is over, Security Center restores the firewall and NSG rules to their previous states.
41
-
42
-
43
-
## Permissions needed to configure and use JIT
44
-
45
-
| To enable a user to: | Permissions to set|
46
-
| --- | --- |
47
-
| Configure or edit a JIT policy for a VM |*Assign these actions to the role:* <ul><li>On the scope of a subscription or resource group that is associated with the VM:<br/> `Microsoft.Security/locations/jitNetworkAccessPolicies/write` </li><li> On the scope of a subscription or resource group of VM: <br/>`Microsoft.Compute/virtualMachines/write`</li></ul> |
48
-
|Request JIT access to a VM |*Assign these actions to the user:* <ul><li>On the scope of a subscription or resource group that is associated with the VM:<br/> `Microsoft.Security/locations/jitNetworkAccessPolicies/initiate/action` </li><li>On the scope of a subscription or resource group that is associated with the VM:<br/> `Microsoft.Security/locations/jitNetworkAccessPolicies/*/read` </li><li> On the scope of a subscription or resource group or VM:<br/> `Microsoft.Compute/virtualMachines/read` </li><li> On the scope of a subscription or resource group or VM:<br/> `Microsoft.Network/networkInterfaces/*/read` </li></ul>|
**Just-in-time VM access** provides information on the state of your VMs:
43
+
The **Just-in-time VM access** window opens and shows information on the state of your VMs:
77
44
78
45
-**Configured** - VMs that have been configured to support just-in-time VM access. The data presented is for the last week and includes for each VM the number of approved requests, last access date and time, and last user.
79
46
-**Recommended** - VMs that can support just-in-time VM access but haven't been configured to. We recommend that you enable just-in-time VM access control for these VMs.
@@ -82,26 +49,26 @@ From Security Center, you can configure a JIT policy and request access to a VM
82
49
- Classic VM - Security Center just-in-time VM access currently supports only VMs deployed through Azure Resource Manager. A classic deployment is not supported by the just-in-time solution.
83
50
- Other - A VM is in this category if the just-in-time solution is turned off in the security policy of the subscription or the resource group, or if the VM is missing a public IP and doesn't have an NSG in place.
84
51
85
-
3. Select the **Recommended** tab.
52
+
1. Select the **Recommended** tab.
86
53
87
-
4. Under **VIRTUAL MACHINE**, click the VMs that you want to enable. This puts a checkmark next to a VM.
54
+
1. Under **VIRTUAL MACHINE**, click the VMs that you want to enable. This puts a checkmark next to a VM.
88
55
89
-
5. Click **Enable JIT on VMs**.
90
-
-. This blade displays the default ports recommended by Azure Security Center:
1. Click **Add**. The **Add port configuration** window opens.
98
-
2. For each port you choose to configure, both default and custom, you can customize the following settings:
58
+
1. Click **Enable JIT on VMs**. A pane opens displaying the default ports recommended by Azure Security Center:
59
+
- 22 - SSH
60
+
- 3389 - RDP
61
+
- 5985 - WinRM
62
+
- 5986 - WinRM
63
+
1. Optionally, you can add custom ports to the list:
99
64
100
-
-**Protocol type**- The protocol that is allowed on this port when a request is approved.
101
-
-**Allowed source IP addresses**- The IP ranges that are allowed on this port when a request is approved.
102
-
-**Maximum request time**- The maximum time window during which a specific port can be opened.
65
+
1. Click **Add**. The **Add port configuration** window opens.
66
+
1. For each port you choose to configure, both default and custom, you can customize the following settings:
67
+
-**Protocol type**- The protocol that is allowed on this port when a request is approved.
68
+
-**Allowed source IP addresses**- The IP ranges that are allowed on this port when a request is approved.
69
+
-**Maximum request time**- The maximum time window during which a specific port can be opened.
103
70
104
-
3. Click **OK**.
71
+
1. Click **OK**.
105
72
106
73
1. Click **Save**.
107
74
@@ -115,43 +82,48 @@ To request access to a VM via Security Center:
115
82
116
83
1. Under **Just-in-time VM access**, select the **Configured** tab.
117
84
118
-
2. Under **Virtual Machine**, click the VMs that you want to request access for. This puts a checkmark next to the VM.
119
-
85
+
1. Under **Virtual Machine**, click the VMs that you want to request access for. This puts a checkmark next to the VM.
120
86
121
87
- The icon in the **Connection Details** column indicates whether JIT is enabled on the NSG or FW. If it’s enabled on both, only the Firewall icon appears.
122
88
123
89
- The **Connection Details** column provides the information required to connect the VM, and its open ports.
4. Under **Request access**, for each VM, configure the ports that you want to open and the source IP addresses that the port is opened on and the time window for which the port will be open. It will only be possible to request access to the ports that are configured in the just-in-time policy. Each port has a maximum allowed time derived from the just-in-time policy.
97
+
1. Under **Request access**, for each VM, configure the ports that you want to open and the source IP addresses that the port is opened on and the time window for which the port will be open. It will only be possible to request access to the ports that are configured in the just-in-time policy. Each port has a maximum allowed time derived from the just-in-time policy.
132
98
133
-
5. Click **Open ports**.
99
+
1. Click **Open ports**.
134
100
135
101
> [!NOTE]
136
102
> If a user who is requesting access is behind a proxy, the option **My IP** may not work. You may need to define the full IP address range of the organization.
137
103
104
+
105
+
138
106
## Edit a JIT access policy via Security Center
139
107
140
108
You can change a VM's existing just-in-time policy by adding and configuring a new port to protect for that VM, or by changing any other setting related to an already protected port.
141
109
142
110
To edit an existing just-in-time policy of a VM:
111
+
143
112
1. In the **Configured** tab, under **VMs**, select a VM to which to add a port by clicking on the three dots within the row for that VM.
144
113
145
114
1. Select **Edit**.
115
+
146
116
1. Under **JIT VM access configuration**, you can either edit the existing settings of an already protected port or add a new custom port.
147
117

148
118
119
+
120
+
149
121
## Audit JIT access activity in Security Center
150
122
151
123
You can gain insights into VM activities using log search. To view logs:
152
124
153
125
1. Under **Just-in-time VM access**, select the **Configured** tab.
154
-
2. Under **VMs**, select a VM to view information about by clicking on the three dots within the row for that VM and select **Activity Log**in the menu. The **Activity log** opens.
126
+
2. Under **VMs**, select a VM to view information about by clicking on the three dots within the row for that VM and select **Activity Log**from the menu. The **Activity log** opens.
@@ -174,7 +146,7 @@ To make it easy to roll out just-in-time access across your VMs, you can set a V
174
146
1. From the [Azure portal](https://ms.portal.azure.com), search for and select **Virtual machines**.
175
147
2. Select the virtual machine you want to limit to just-in-time access.
176
148
3. In the menu, select **Configuration**.
177
-
4. Under **Just-in-time-access**, select **Enable just-in-time policy**.
149
+
4. Under **Just-in-timeaccess**, select **Enable just-in-time**.
178
150
179
151
This enables just-in-time access for the VM using the following settings:
180
152
@@ -191,15 +163,15 @@ If a VM already has just-in-time enabled, when you go to its configuration page
191
163
192
164

193
165
194
-
### Request JIT access to a VM via the Azure VM blade
166
+
### Request JIT access to a VM via an Azure VM's page
195
167
196
168
In the Azure portal, when you try to connect to a VM, Azure checks to see if you have a just-in-time access policy configured on that VM.
197
169
198
-
- If you do have a JIT policy configured on the VM, you can click **Request access** to enable you to have access in accordance with the JIT policy set for the VM.
170
+
- If you have a JIT policy configured on the VM, you can click **Request access** to grant access in accordance with the JIT policy set for the VM.
The access is requested with the following default parameters:
174
+
Access is requested with the following default parameters:
203
175
204
176
-**source IP**: ‘Any’ (*) (cannot be changed)
205
177
-**time range**: Three hours (cannot be changed) <!--Isn't this set in the policy-->
@@ -208,19 +180,19 @@ In the Azure portal, when you try to connect to a VM, Azure checks to see if you
208
180
> [!NOTE]
209
181
> After a request is approved for a VM protected by Azure Firewall, Security Center provides the user with the proper connection details (the port mapping from the DNAT table) to use to connect to the VM.
210
182
211
-
- If you do not have JIT configured on a VM, you will be prompted to configure a JIT policy it.
183
+
- If you do not have JIT configured on a VM, you will be prompted to configure a JIT policy on it.
## Configure a JIT policy on a VM programmatically <aname="jit-program"></a>
216
188
217
189
You can set up and use just-in-time via REST APIs and via PowerShell.
218
190
219
-
## JIT VM access via REST APIs
191
+
###JIT VM access via REST APIs
220
192
221
193
The just-in-time VM access feature can be used via the Azure Security Center API. You can get information about configured VMs, add new ones, request access to a VM, and more, via this API. See [Jit Network Access Policies](https://docs.microsoft.com/rest/api/securitycenter/jitnetworkaccesspolicies), to learn more about the just-in-time REST API.
222
194
223
-
## JIT VM access via PowerShell
195
+
###JIT VM access via PowerShell
224
196
225
197
To use the just-in-time VM access solution via PowerShell, use the official Azure Security Center PowerShell cmdlets, and specifically `Set-AzJitNetworkAccessPolicy`.
226
198
@@ -256,7 +228,7 @@ Run the following in PowerShell to accomplish this:
In the following example, you can see a just-in-time VM access request to a specific VM in which port 22 is requested to be opened for a specific IP address and for a specific amount of time:
262
234
@@ -276,18 +248,26 @@ Run the following in PowerShell:
For more information, see the PowerShell cmdlet documentation.
251
+
For more information, see the [PowerShell cmdlet documentation](https://docs.microsoft.com/powershell/scripting/developer/cmdlet/cmdlet-overview).
252
+
253
+
254
+
## Automatic cleanup of redundant JIT rules
255
+
256
+
Whenever you update a JIT policy, a cleanup tool automatically runs to check the validity of your entire ruleset. The tool looks for mismatches between rules in your policy and rules in the NSG. If the cleanup tool finds a mismatch, it determines the cause and, when it's safe to do so, removes built-in rules that aren't needed any more. The cleaner never deletes rules that you've created.
257
+
258
+
Examples scenarios when the cleaner might remove a built-in rule:
259
+
260
+
- When two rules with identical definitions exist and one has a higher priority than the other (meaning, the lower priority rule will never be used)
261
+
- When a rule description includes the name of a VM which doesn't match the destination IP in the rule
262
+
280
263
281
264
## Next steps
265
+
282
266
In this article, you learned how just-in-time VM access in Security Center helps you control access to your Azure virtual machines.
283
267
284
268
To learn more about Security Center, see the following:
285
269
286
270
-[Setting security policies](tutorial-security-policy.md) — Learn how to configure security policies for your Azure subscriptions and resource groups.
287
271
-[Managing security recommendations](security-center-recommendations.md) — Learn how recommendations help you protect your Azure resources.
288
272
-[Security health monitoring](security-center-monitoring.md) — Learn how to monitor the health of your Azure resources.
289
-
-[Managing and responding to security alerts](security-center-managing-and-responding-alerts.md) — Learn how to manage and respond to security alerts.
290
-
-[Monitoring partner solutions](security-center-partner-solutions.md) — Learn how to monitor the health status of your partner solutions.
291
-
-[Security Center FAQ](security-center-faq.md) — Find frequently asked questions about using the service.
292
-
-[Azure Security blog](https://blogs.msdn.microsoft.com/azuresecurity/) — Find blog posts about Azure security and compliance.
293
-
273
+
-[Azure Security Center FAQ](security-center-faq.md) — Find frequently asked questions about using the service.
0 commit comments