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: docs/linux/sql-server-linux-security-selinux.md
+58-11Lines changed: 58 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,8 @@ title: Get Started with SQL Server on SELinux
3
3
description: Learn about installing and configuring SQL Server on SELinux, using a Red Hat Enterprise Linux distribution.
4
4
author: rwestMSFT
5
5
ms.author: randolphwest
6
-
ms.date: 10/20/2025
6
+
ms.reviewer: amitkh
7
+
ms.date: 01/27/2026
7
8
ms.service: sql
8
9
ms.subservice: linux
9
10
ms.topic: how-to
@@ -12,7 +13,7 @@ ms.custom:
12
13
---
13
14
# Get started with SQL Server on SELinux
14
15
15
-
This article guides you in getting started with [!INCLUDE [ssnoversion-md](../includes/ssnoversion-md.md)] as a *confined service* on a Security-Enhanced Linux (SELinux) distribution based on Red Hat Enterprise Linux (RHEL).
16
+
This article helps you get started with [!INCLUDE [ssnoversion-md](../includes/ssnoversion-md.md)] as a *confined service* on a Security-Enhanced Linux (SELinux) distribution based on Red Hat Enterprise Linux (RHEL).
16
17
17
18
## What is Security-Enhanced Linux?
18
19
@@ -28,7 +29,7 @@ A *confined service* with SELinux means that it's restricted by security rules,
28
29
29
30
## Prerequisites
30
31
31
-
1. SELinux should be enabled and in `enforcing` mode. You can check the SELinux status by running the command `sestatus`.
32
+
1.Enable SELinux and set it to `enforcing` mode. Check the SELinux status by running the `sestatus` command.
32
33
33
34
```bash
34
35
sestatus
@@ -54,6 +55,52 @@ A *confined service* with SELinux means that it's restricted by security rules,
54
55
> [!NOTE]
55
56
> If any of the prerequisites aren't met, [!INCLUDE [ssnoversion-md](../includes/ssnoversion-md.md)] runs as an *unconfined service*.
56
57
58
+
### Minimum RHEL minor version requirement
59
+
60
+
To run [!INCLUDE [ssnoversion-md](../includes/ssnoversion-md.md)] as a confined application on RHEL 9, you must use a minimum RHEL minor version. This requirement exists because of point-release dependencies in SELinux packages. The `mssql-server-selinux` package, which you need to run [!INCLUDE [ssnoversion-md](../includes/ssnoversion-md.md)] in confined mode, depends on the `selinux-policy` and `selinux-policy-base` packages.
61
+
62
+
#### Steps to identify minimum RHEL minor version
63
+
64
+
1. Add the [!INCLUDE [ssnoversion-md](../includes/ssnoversion-md.md)] repository that contains `mssql-server-selinux`.
65
+
66
+
For [!INCLUDE [sssql25-md](../includes/sssql25-md.md)] on RHEL 9:
1. The output includes the minimum SELinux policy version required, indicated by a suffix such as `.el9_6`. This suffix represents the minimum RHEL 9 minor release that the policy was built for. For example, `.el9_6` corresponds to RHEL 9.6.
88
+
89
+
If no such suffix appears in the output, refer to Red Hat documentation to determine the minimum RHEL minor version associated with that SELinux policy build. In the following example, the required SELinux base version is `38.1.53-5`.
In this example, the highest minor-version-tagged requirement is `38.1.53-5.el9_6`. So, you need at least RHEL 9.6 to install [!INCLUDE [ssnoversion-md](../includes/ssnoversion-md.md)] with SELinux (`mssql-server-selinux`), and run it as a confined application on RHEL 9.
103
+
57
104
## Install SQL Server as a confined service
58
105
59
106
By default, the `mssql-server` package installs [!INCLUDE [ssnoversion-md](../includes/ssnoversion-md.md)] without the SELinux policy, and [!INCLUDE [ssnoversion-md](../includes/ssnoversion-md.md)] runs as an unconfined service. The `mssql-server` package installation automatically enables the `selinux_execmode` Boolean. You can verify that [!INCLUDE [ssnoversion-md](../includes/ssnoversion-md.md)] is running unconfined using the following command:
Once you install the `mssql-server-selinux` package, it enables a custom SELinux policy that confines the `sqlservr` process. When you install this policy, the `selinuxuser_execmod` Boolean is reset, and is replaced by a policy named `mssql`, which confines the `sqlservr` process in the new `mssql_server_t` domain.
118
+
When you install the `mssql-server-selinux` package, it enables a custom SELinux policy that confines the `sqlservr` process. When you install this policy, the `selinuxuser_execmod` Boolean is reset, and is replaced by a policy named `mssql`. This policy confines the `sqlservr` process in the new `mssql_server_t` domain.
When the optional SELinux policy is installed with the `mssql-server-selinux` package, some new types are defined:
132
+
When you install the optional SELinux policy using the `mssql-server-selinux` package, it defines some new types:
86
133
87
134
| SELinux policy | Description |
88
135
| --- | --- |
89
136
|`mssql_opt_t`| Install files of mssql-server to `/opt/mssql`|
90
137
|`mssql_server_exec_t`| Executable files at `/opt/mssql/bin/`|
91
-
|`mssql_paldumper_exec_t`| Executables and scripts which require special permissions to manage core dumps |
138
+
|`mssql_paldumper_exec_t`| Executables and scripts that require special permissions to manage core dumps |
92
139
|`mssql_conf_exec_t`| Management tool at `/opt/mssql/bin/mssql-conf`|
93
140
|`mssql_var_t`| Label for files at `/var/opt/mssql`|
94
141
|`mssql_db_t`| Label for the database files at `/var/opt/mssql/data`|
95
142
96
143
## Examples
97
144
98
-
The following example demonstrates changing the database location when [!INCLUDE [ssnoversion-md](../includes/ssnoversion-md.md)]is running as a confined service.
145
+
The following example demonstrates changing the database location when [!INCLUDE [ssnoversion-md](../includes/ssnoversion-md.md)]runs as a confined service.
99
146
100
147
1. Create the desired directories and label them as `mssql_db_t`.
101
148
@@ -106,7 +153,7 @@ The following example demonstrates changing the database location when [!INCLUDE
106
153
sudo restorecon -R -v /opt/mydb
107
154
```
108
155
109
-
The command `semanage fcontext` manages the SELinux file context mapping. The `-a` parameter adds a new file context rule, and the `-t` parameter defines the SELinux type to be applied, which in this case is `mssql_db_t` for [!INCLUDE [ssnoversion-md](../includes/ssnoversion-md.md)] database files. Finally, the path pattern is specified, which is `/opt/mydb` in this example, and all the files and subdirectories within it.
156
+
The command `semanage fcontext` manages the SELinux file context mapping. The `-a` parameter adds a new file context rule, and the `-t` parameter defines the SELinux type to apply, which in this case is `mssql_db_t` for [!INCLUDE [ssnoversion-md](../includes/ssnoversion-md.md)] database files. Finally, the command specifies the path pattern, which is `/opt/mydb` in this example, and includes all the files and subdirectories within it.
110
157
111
158
1. Set the default database location using **mssql-conf**, and run the setup.
112
159
@@ -136,10 +183,10 @@ The following example demonstrates changing the database location when [!INCLUDE
136
183
-rw-rw----. 1 mssql mssql system_u:object_r:mssql_db_t:s0 8388608 Aug 2 14:27 TestDatabase.mdf
137
184
```
138
185
139
-
In the previous example, you can see the file has the `mssql_db_t`(type) associated with the new files created.
186
+
In the previous example, you can see the file has the `mssql_db_t` type associated with the new files created.
140
187
141
188
## Related content
142
189
143
-
-[Security limitations for SQL Server on Linux](sql-server-linux-security-overview.md)
190
+
-[Security considerations for SQL Server on Linux](sql-server-linux-security-overview.md)
144
191
-[Walkthrough for the security features of SQL Server on Linux](sql-server-linux-security-get-started.md)
145
-
-[Quickstart: Install SQL Server and create a database on Red Hat](quickstart-install-connect-red-hat.md)
192
+
-[Quickstart: Install SQL Server and create a database on Red Hat Enterprise Linux](quickstart-install-connect-red-hat.md)
0 commit comments