Skip to content

Commit 42c5263

Browse files
amitkh-msftrwestMSFT
authored andcommitted
Update sql-server-linux-security-selinux.md
Adding minimum required version
1 parent 93ad4ec commit 42c5263

1 file changed

Lines changed: 64 additions & 11 deletions

File tree

docs/linux/sql-server-linux-security-selinux.md

Lines changed: 64 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ title: Get Started with SQL Server on SELinux
33
description: Learn about installing and configuring SQL Server on SELinux, using a Red Hat Enterprise Linux distribution.
44
author: rwestMSFT
55
ms.author: randolphwest
6-
ms.date: 10/20/2025
6+
ms.reviewer: amitkh
7+
ms.date: 01/23/2026
78
ms.service: sql
89
ms.subservice: linux
910
ms.topic: how-to
@@ -12,7 +13,7 @@ ms.custom:
1213
---
1314
# Get started with SQL Server on SELinux
1415

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).
1617

1718
## What is Security-Enhanced Linux?
1819

@@ -28,7 +29,7 @@ A *confined service* with SELinux means that it's restricted by security rules,
2829

2930
## Prerequisites
3031

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.
3233

3334
```bash
3435
sestatus
@@ -54,6 +55,58 @@ A *confined service* with SELinux means that it's restricted by security rules,
5455
> [!NOTE]
5556
> If any of the prerequisites aren't met, [!INCLUDE [ssnoversion-md](../includes/ssnoversion-md.md)] runs as an *unconfined service*.
5657
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)]:
67+
68+
```bash
69+
sudo curl -o /etc/yum.repos.d/mssql-server.repo https://packages.microsoft.com/config/rhel/9/mssql-server-2025.repo
70+
```
71+
72+
For [!INCLUDE [sssql22-md](../includes/sssql22-md.md)]:
73+
74+
```bash
75+
sudo curl -o /etc/yum.repos.d/mssql-server.repo https://packages.microsoft.com/config/rhel/9/mssql-server-2022.repo
76+
```
77+
78+
1. Run the following command to view the SELinux policy dependencies:
79+
80+
```bash
81+
sudo dnf repoquery --requires mssql-server-selinux | egrep '^selinux-policy(-base)?'
82+
```
83+
84+
1. In the output, find the highest distribution tag or point-release entry, such as `.el9_6`. The suffix shows the *minimum required* RHEL 9 minor release for that policy build. For example, `.el9_6` maps to RHEL 9.6.
85+
86+
Here's example output:
87+
88+
```bash
89+
$ sudo dnf repoquery --requires mssql-server-selinux | egrep '^selinux-policy(-base)?'
90+
selinux-policy >= 38.1.11-2.el9_2.4
91+
selinux-policy >= 38.1.23-1.el9
92+
selinux-policy >= 38.1.23-1.el9_3.2
93+
selinux-policy >= 38.1.35-2.el9_4
94+
selinux-policy >= 38.1.35-2.el9_4.2
95+
selinux-policy >= 38.1.45-3.el9_5
96+
selinux-policy >= 38.1.53-5.el9_6
97+
selinux-policy >= 38.1.65-1.el9
98+
selinux-policy-base >= 38.1.11-2.el9_2.4
99+
selinux-policy-base >= 38.1.23-1.el9
100+
selinux-policy-base >= 38.1.23-1.el9_3.2
101+
selinux-policy-base >= 38.1.35-2.el9_4
102+
selinux-policy-base >= 38.1.35-2.el9_4.2
103+
selinux-policy-base >= 38.1.45-3.el9_5
104+
selinux-policy-base >= 38.1.53-5.el9_6
105+
selinux-policy-base >= 38.1.65-1.el9
106+
```
107+
108+
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.
109+
57110
## Install SQL Server as a confined service
58111

59112
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:
@@ -68,7 +121,7 @@ Here's the expected output.
68121
system_u:system_r:unconfined_service_t:s0 48265 ? 00:00:02 sqlservr
69122
```
70123

71-
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.
124+
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.
72125

73126
```bash
74127
ps -eZ | grep sqlservr
@@ -82,20 +135,20 @@ system_u:system_r:mssql_server_t:s0 48941 ? 00:00:02 sqlservr
82135

83136
## SQL Server and SELinux types
84137

85-
When the optional SELinux policy is installed with the `mssql-server-selinux` package, some new types are defined:
138+
When you install the optional SELinux policy using the `mssql-server-selinux` package, it defines some new types:
86139

87140
| SELinux policy | Description |
88141
| --- | --- |
89142
| `mssql_opt_t` | Install files of mssql-server to `/opt/mssql` |
90143
| `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 |
144+
| `mssql_paldumper_exec_t` | Executables and scripts that require special permissions to manage core dumps |
92145
| `mssql_conf_exec_t` | Management tool at `/opt/mssql/bin/mssql-conf` |
93146
| `mssql_var_t` | Label for files at `/var/opt/mssql` |
94147
| `mssql_db_t` | Label for the database files at `/var/opt/mssql/data` |
95148

96149
## Examples
97150

98-
The following example demonstrates changing the database location when [!INCLUDE [ssnoversion-md](../includes/ssnoversion-md.md)] is running as a confined service.
151+
The following example demonstrates changing the database location when [!INCLUDE [ssnoversion-md](../includes/ssnoversion-md.md)] runs as a confined service.
99152

100153
1. Create the desired directories and label them as `mssql_db_t`.
101154

@@ -106,7 +159,7 @@ The following example demonstrates changing the database location when [!INCLUDE
106159
sudo restorecon -R -v /opt/mydb
107160
```
108161

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.
162+
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.
110163

111164
1. Set the default database location using **mssql-conf**, and run the setup.
112165

@@ -136,10 +189,10 @@ The following example demonstrates changing the database location when [!INCLUDE
136189
-rw-rw----. 1 mssql mssql system_u:object_r:mssql_db_t:s0 8388608 Aug 2 14:27 TestDatabase.mdf
137190
```
138191

139-
In the previous example, you can see the file has the `mssql_db_t` (type) associated with the new files created.
192+
In the previous example, you can see the file has the `mssql_db_t` type associated with the new files created.
140193

141194
## Related content
142195

143-
- [Security limitations for SQL Server on Linux](sql-server-linux-security-overview.md)
196+
- [Security considerations for SQL Server on Linux](sql-server-linux-security-overview.md)
144197
- [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)
198+
- [Quickstart: Install SQL Server and create a database on Red Hat Enterprise Linux](quickstart-install-connect-red-hat.md)

0 commit comments

Comments
 (0)