Skip to contentSkip to conversation

libselinux: add selinux_openssh_contexts_path()

PATCH Applied Petr Lautrbach 3 participants 8 messages May 21, 2015 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libselinux: add selinux_openssh_contexts_path()

openssh in Fedora uses "sshd_net_t" type for privilege separated processes in the preauthentication phase. Similarly, openssh portable uses "sftp_t" for internal-sftp processes. Both type are hardcoded what is not ideal. Therefore selinux_openssh_contexts_path() was created to get a path where sshd can get a correct types prepared by a distribution or an administrator.

---
 libselinux/include/selinux/selinux.h |  1 +
 libselinux/src/file_path_suffixes.h  |  1 +
 libselinux/src/selinux_config.c      | 12 ++++++++++--
 libselinux/src/selinux_internal.h    |  1 +
 4 files changed, 13 insertions(+), 2 deletions(-)
libselinux/include/selinux/selinux.h +1 -0
index d0eb5c6..4beb170 100644
@@ -543,6 +543,7 @@ extern const char *selinux_virtual_image_context_path(void);
 extern const char *selinux_lxc_contexts_path(void);
 extern const char *selinux_x_context_path(void);
 extern const char *selinux_sepgsql_context_path(void);
+extern const char *selinux_openssh_contexts_path(void);
 extern const char *selinux_systemd_contexts_path(void);
 extern const char *selinux_contexts_path(void);
 extern const char *selinux_securetty_types_path(void);
libselinux/src/file_path_suffixes.h +1 -0
index 3c92424..d1f9b48 100644
@@ -23,6 +23,7 @@ S_(BINPOLICY, "/policy/policy")
     S_(VIRTUAL_DOMAIN, "/contexts/virtual_domain_context")
     S_(VIRTUAL_IMAGE, "/contexts/virtual_image_context")
     S_(LXC_CONTEXTS, "/contexts/lxc_contexts")
+    S_(OPENSSH_CONTEXTS, "/contexts/openssh_contexts")
     S_(SYSTEMD_CONTEXTS, "/contexts/systemd_contexts")
     S_(FILE_CONTEXT_SUBS, "/contexts/files/file_contexts.subs")
     S_(FILE_CONTEXT_SUBS_DIST, "/contexts/files/file_contexts.subs_dist")
libselinux/src/selinux_config.c +10 -2
index 0a80141..bec5f3b 100644
@@ -48,8 +48,9 @@
 #define FILE_CONTEXT_SUBS_DIST 25
 #define LXC_CONTEXTS      26
 #define BOOLEAN_SUBS      27
-#define SYSTEMD_CONTEXTS  28
-#define NEL               29
+#define OPENSSH_CONTEXTS  28
+#define SYSTEMD_CONTEXTS  29
+#define NEL               30
 
 /* Part of one-time lazy init */
 static pthread_once_t once = PTHREAD_ONCE_INIT;
@@ -491,6 +492,13 @@ const char *selinux_lxc_contexts_path(void)
 
 hidden_def(selinux_lxc_contexts_path)
 
+const char *selinux_openssh_contexts_path(void)
+{
+    return get_path(OPENSSH_CONTEXTS);
+}
+
+hidden_def(selinux_openssh_contexts_path)
+
 const char *selinux_systemd_contexts_path(void)
 {
 	return get_path(SYSTEMD_CONTEXTS);
libselinux/src/selinux_internal.h +1 -0
index 0abf1b4..844e408 100644
@@ -83,6 +83,7 @@ hidden_proto(selinux_mkload_policy)
     hidden_proto(selinux_media_context_path)
     hidden_proto(selinux_x_context_path)
     hidden_proto(selinux_sepgsql_context_path)
+    hidden_proto(selinux_openssh_contexts_path)
     hidden_proto(selinux_systemd_contexts_path)
     hidden_proto(selinux_path)
     hidden_proto(selinux_check_passwd_access)
Signature · 1 line
2.4.1
#1 lore raw
Quoted 5 lines · Petr Lautrbach

openssh in Fedora uses "sshd_net_t" type for privilege separated processes in the preauthentication phase. Similarly, openssh portable uses "sftp_t" for internal-sftp processes. Both type are hardcoded what is not ideal. Therefore selinux_openssh_contexts_path() was created to get a path where sshd can get a correct types prepared by a distribution or an administrator.

I requested this feature and i am using this feature in my personal policy. So hereby my ACK for what it is worth.

However:

That SYSTEMD_CONTEXTS though, that must have been a mistake?

I do not believe that this is used or that it is needed/wanted.

Quoted 83 lines
---
 libselinux/include/selinux/selinux.h |  1 +
 libselinux/src/file_path_suffixes.h  |  1 +
 libselinux/src/selinux_config.c      | 12 ++++++++++--
 libselinux/src/selinux_internal.h    |  1 +
 4 files changed, 13 insertions(+), 2 deletions(-)
libselinux/include/selinux/selinux.h +1 -0
index d0eb5c6..4beb170 100644
@@ -543,6 +543,7 @@ extern const char *selinux_virtual_image_context_path(void);
 extern const char *selinux_lxc_contexts_path(void);
 extern const char *selinux_x_context_path(void);
 extern const char *selinux_sepgsql_context_path(void);
+extern const char *selinux_openssh_contexts_path(void);
 extern const char *selinux_systemd_contexts_path(void);
 extern const char *selinux_contexts_path(void);
 extern const char *selinux_securetty_types_path(void);
libselinux/src/file_path_suffixes.h +1 -0
index 3c92424..d1f9b48 100644
@@ -23,6 +23,7 @@ S_(BINPOLICY, "/policy/policy")
     S_(VIRTUAL_DOMAIN, "/contexts/virtual_domain_context")
     S_(VIRTUAL_IMAGE, "/contexts/virtual_image_context")
     S_(LXC_CONTEXTS, "/contexts/lxc_contexts")
+    S_(OPENSSH_CONTEXTS, "/contexts/openssh_contexts")
     S_(SYSTEMD_CONTEXTS, "/contexts/systemd_contexts")
     S_(FILE_CONTEXT_SUBS, "/contexts/files/file_contexts.subs")
     S_(FILE_CONTEXT_SUBS_DIST, "/contexts/files/file_contexts.subs_dist")
libselinux/src/selinux_config.c +10 -2
index 0a80141..bec5f3b 100644
@@ -48,8 +48,9 @@
 #define FILE_CONTEXT_SUBS_DIST 25
 #define LXC_CONTEXTS      26
 #define BOOLEAN_SUBS      27
-#define SYSTEMD_CONTEXTS  28
-#define NEL               29
+#define OPENSSH_CONTEXTS  28
+#define SYSTEMD_CONTEXTS  29
+#define NEL               30
 
 /* Part of one-time lazy init */
 static pthread_once_t once = PTHREAD_ONCE_INIT;
@@ -491,6 +492,13 @@ const char *selinux_lxc_contexts_path(void)
 
 hidden_def(selinux_lxc_contexts_path)
 
+const char *selinux_openssh_contexts_path(void)
+{
+    return get_path(OPENSSH_CONTEXTS);
+}
+
+hidden_def(selinux_openssh_contexts_path)
+
 const char *selinux_systemd_contexts_path(void)
 {
 	return get_path(SYSTEMD_CONTEXTS);
libselinux/src/selinux_internal.h +1 -0
index 0abf1b4..844e408 100644
@@ -83,6 +83,7 @@ hidden_proto(selinux_mkload_policy)
     hidden_proto(selinux_media_context_path)
     hidden_proto(selinux_x_context_path)
     hidden_proto(selinux_sepgsql_context_path)
+    hidden_proto(selinux_openssh_contexts_path)
     hidden_proto(selinux_systemd_contexts_path)
     hidden_proto(selinux_path)
     hidden_proto(selinux_check_passwd_access)
Signature · 7 lines
2.4.1

_______________________________________________
Selinux mailing list
[email protected]
To unsubscribe, send email to [email protected].
To get help, send an email containing "help" to [email protected].
Signature · 4 lines
02DFF788
4D30 903A 1CF3 B756 FB48  1514 3148 83A2 02DF F788
http://keys.gnupg.net/pks/lookup?op=vindex&search=0x314883A202DFF788
Dominick Grift
#2 lore raw
Quoted 7 lines · Dominick Grift
Quoted 5 lines · Petr Lautrbach

openssh in Fedora uses "sshd_net_t" type for privilege separated processes in the preauthentication phase. Similarly, openssh portable uses "sftp_t" for internal-sftp processes. Both type are hardcoded what is not ideal. Therefore selinux_openssh_contexts_path() was created to get a path where sshd can get a correct types prepared by a distribution or an administrator.

Quoted 5 lines

I requested this feature and i am using this feature in my personal policy. So hereby my ACK for what it is worth.

However:

That SYSTEMD_CONTEXTS though, that must have been a mistake?

As far as i am concerned this commit should be reverted:

https://github.com/SELinuxProject/selinux/commit/ce2a8848ad45e375cfdb58cebe28bc12431bb3db

I just did a grep -ri systemd_contexts in the systemd repository and nothing returned. I also cannot place that commit message.

Quoted 92 lines

I do not believe that this is used or that it is needed/wanted.

Quoted 83 lines
---
 libselinux/include/selinux/selinux.h |  1 +
 libselinux/src/file_path_suffixes.h  |  1 +
 libselinux/src/selinux_config.c      | 12 ++++++++++--
 libselinux/src/selinux_internal.h    |  1 +
 4 files changed, 13 insertions(+), 2 deletions(-)
libselinux/include/selinux/selinux.h +1 -0
index d0eb5c6..4beb170 100644
@@ -543,6 +543,7 @@ extern const char *selinux_virtual_image_context_path(void);
 extern const char *selinux_lxc_contexts_path(void);
 extern const char *selinux_x_context_path(void);
 extern const char *selinux_sepgsql_context_path(void);
+extern const char *selinux_openssh_contexts_path(void);
 extern const char *selinux_systemd_contexts_path(void);
 extern const char *selinux_contexts_path(void);
 extern const char *selinux_securetty_types_path(void);
libselinux/src/file_path_suffixes.h +1 -0
index 3c92424..d1f9b48 100644
@@ -23,6 +23,7 @@ S_(BINPOLICY, "/policy/policy")
     S_(VIRTUAL_DOMAIN, "/contexts/virtual_domain_context")
     S_(VIRTUAL_IMAGE, "/contexts/virtual_image_context")
     S_(LXC_CONTEXTS, "/contexts/lxc_contexts")
+    S_(OPENSSH_CONTEXTS, "/contexts/openssh_contexts")
     S_(SYSTEMD_CONTEXTS, "/contexts/systemd_contexts")
     S_(FILE_CONTEXT_SUBS, "/contexts/files/file_contexts.subs")
     S_(FILE_CONTEXT_SUBS_DIST, "/contexts/files/file_contexts.subs_dist")
libselinux/src/selinux_config.c +10 -2
index 0a80141..bec5f3b 100644
@@ -48,8 +48,9 @@
 #define FILE_CONTEXT_SUBS_DIST 25
 #define LXC_CONTEXTS      26
 #define BOOLEAN_SUBS      27
-#define SYSTEMD_CONTEXTS  28
-#define NEL               29
+#define OPENSSH_CONTEXTS  28
+#define SYSTEMD_CONTEXTS  29
+#define NEL               30
 
 /* Part of one-time lazy init */
 static pthread_once_t once = PTHREAD_ONCE_INIT;
@@ -491,6 +492,13 @@ const char *selinux_lxc_contexts_path(void)
 
 hidden_def(selinux_lxc_contexts_path)
 
+const char *selinux_openssh_contexts_path(void)
+{
+    return get_path(OPENSSH_CONTEXTS);
+}
+
+hidden_def(selinux_openssh_contexts_path)
+
 const char *selinux_systemd_contexts_path(void)
 {
 	return get_path(SYSTEMD_CONTEXTS);
libselinux/src/selinux_internal.h +1 -0
index 0abf1b4..844e408 100644
@@ -83,6 +83,7 @@ hidden_proto(selinux_mkload_policy)
     hidden_proto(selinux_media_context_path)
     hidden_proto(selinux_x_context_path)
     hidden_proto(selinux_sepgsql_context_path)
+    hidden_proto(selinux_openssh_contexts_path)
     hidden_proto(selinux_systemd_contexts_path)
     hidden_proto(selinux_path)
     hidden_proto(selinux_check_passwd_access)
Signature · 7 lines
2.4.1

_______________________________________________
Selinux mailing list
[email protected]
To unsubscribe, send email to [email protected].
To get help, send an email containing "help" to [email protected].
Signature · 4 lines
02DFF788
4D30 903A 1CF3 B756 FB48  1514 3148 83A2 02DF F788
http://keys.gnupg.net/pks/lookup?op=vindex&search=0x314883A202DFF788
Dominick Grift
Signature · 4 lines
02DFF788
4D30 903A 1CF3 B756 FB48  1514 3148 83A2 02DF F788
http://keys.gnupg.net/pks/lookup?op=vindex&search=0x314883A202DFF788
Dominick Grift
#3 lore raw
Quoted 12 lines · Dominick Grift
Quoted 11 lines · Dominick Grift
Quoted 5 lines · Petr Lautrbach

openssh in Fedora uses "sshd_net_t" type for privilege separated processes in the preauthentication phase. Similarly, openssh portable uses "sftp_t" for internal-sftp processes. Both type are hardcoded what is not ideal. Therefore selinux_openssh_contexts_path() was created to get a path where sshd can get a correct types prepared by a distribution or an administrator.

I requested this feature and i am using this feature in my personal policy. So hereby my ACK for what it is worth.

However:

Quoted 10 lines
Quoted 1 line

That SYSTEMD_CONTEXTS though, that must have been a mistake?

As far as i am concerned this commit should be reverted:

https://github.com/SELinuxProject/selinux/commit/ce2a8848ad45e375cfdb58cebe28bc12431bb3db

I just did a grep -ri systemd_contexts in the systemd repository and nothing returned. I also cannot place that commit message.

Quoted 2 lines

I do not believe that this is used or that it is needed/wanted.

We can remove it as a separate change, but only if there are no users, even in legacy distributions, as otherwise it would be an ABI break.

#4 lore raw
Quoted 19 lines · Stephen Smalley
Quoted 18 lines · Dominick Grift
Quoted 7 lines · Dominick Grift
Quoted 5 lines · Petr Lautrbach

openssh in Fedora uses "sshd_net_t" type for privilege separated processes in the preauthentication phase. Similarly, openssh portable uses "sftp_t" for internal-sftp processes. Both type are hardcoded what is not ideal. Therefore selinux_openssh_contexts_path() was created to get a path where sshd can get a correct types prepared by a distribution or an administrator.

Quoted 5 lines

I requested this feature and i am using this feature in my personal policy. So hereby my ACK for what it is worth.

However:

That SYSTEMD_CONTEXTS though, that must have been a mistake?

As far as i am concerned this commit should be reverted:

https://github.com/SELinuxProject/selinux/commit/ce2a8848ad45e375cfdb58cebe28bc12431bb3db

Quoted 9 lines
Quoted 4 lines

I just did a grep -ri systemd_contexts in the systemd repository and nothing returned. I also cannot place that commit message.

Quoted 2 lines

I do not believe that this is used or that it is needed/wanted.

We can remove it as a separate change, but only if there are no users, even in legacy distributions, as otherwise it would be an ABI break.

I do not believe this was ever used. Am i right, Dan?

Signature · 4 lines
02DFF788
4D30 903A 1CF3 B756 FB48  1514 3148 83A2 02DF F788
http://keys.gnupg.net/pks/lookup?op=vindex&search=0x314883A202DFF788
Dominick Grift
#5 lore raw
In reply to Petr Lautrbach
Quoted 43 lines · Petr Lautrbach

openssh in Fedora uses "sshd_net_t" type for privilege separated processes in the preauthentication phase. Similarly, openssh portable uses "sftp_t" for internal-sftp processes. Both type are hardcoded what is not ideal. Therefore selinux_openssh_contexts_path() was created to get a path where sshd can get a correct types prepared by a distribution or an administrator.

---
 libselinux/include/selinux/selinux.h |  1 +
 libselinux/src/file_path_suffixes.h  |  1 +
 libselinux/src/selinux_config.c      | 12 ++++++++++--
 libselinux/src/selinux_internal.h    |  1 +
 4 files changed, 13 insertions(+), 2 deletions(-)
libselinux/include/selinux/selinux.h +1 -0
index d0eb5c6..4beb170 100644
@@ -543,6 +543,7 @@ extern const char *selinux_virtual_image_context_path(void);
 extern const char *selinux_lxc_contexts_path(void);
 extern const char *selinux_x_context_path(void);
 extern const char *selinux_sepgsql_context_path(void);
+extern const char *selinux_openssh_contexts_path(void);
 extern const char *selinux_systemd_contexts_path(void);
 extern const char *selinux_contexts_path(void);
 extern const char *selinux_securetty_types_path(void);
libselinux/src/file_path_suffixes.h +1 -0
index 3c92424..d1f9b48 100644
@@ -23,6 +23,7 @@ S_(BINPOLICY, "/policy/policy")
     S_(VIRTUAL_DOMAIN, "/contexts/virtual_domain_context")
     S_(VIRTUAL_IMAGE, "/contexts/virtual_image_context")
     S_(LXC_CONTEXTS, "/contexts/lxc_contexts")
+    S_(OPENSSH_CONTEXTS, "/contexts/openssh_contexts")
     S_(SYSTEMD_CONTEXTS, "/contexts/systemd_contexts")
     S_(FILE_CONTEXT_SUBS, "/contexts/files/file_contexts.subs")
     S_(FILE_CONTEXT_SUBS_DIST, "/contexts/files/file_contexts.subs_dist")
libselinux/src/selinux_config.c +0 -0
index 0a80141..bec5f3b 100644

libselinux/src/selinux_config.c line 53

Quoted 8 lines
libselinux/src/selinux_config.c +3 -2
@@ -48,8 +48,9 @@
 #define FILE_CONTEXT_SUBS_DIST 25
 #define LXC_CONTEXTS      26
 #define BOOLEAN_SUBS      27
-#define SYSTEMD_CONTEXTS  28
-#define NEL               29
+#define OPENSSH_CONTEXTS  28
+#define SYSTEMD_CONTEXTS  29
+#define NEL               30

How come openssh_context becomes version 28 and systemd_contexts changes from 28 to 29?

Quoted 37 lines
libselinux/src/selinux_config.c +7 -0
 /* Part of one-time lazy init */
 static pthread_once_t once = PTHREAD_ONCE_INIT;
@@ -491,6 +492,13 @@ const char *selinux_lxc_contexts_path(void)
 
 hidden_def(selinux_lxc_contexts_path)
 
+const char *selinux_openssh_contexts_path(void)
+{
+    return get_path(OPENSSH_CONTEXTS);
+}
+
+hidden_def(selinux_openssh_contexts_path)
+
 const char *selinux_systemd_contexts_path(void)
 {
 	return get_path(SYSTEMD_CONTEXTS);
libselinux/src/selinux_internal.h +1 -0
index 0abf1b4..844e408 100644
@@ -83,6 +83,7 @@ hidden_proto(selinux_mkload_policy)
     hidden_proto(selinux_media_context_path)
     hidden_proto(selinux_x_context_path)
     hidden_proto(selinux_sepgsql_context_path)
+    hidden_proto(selinux_openssh_contexts_path)
     hidden_proto(selinux_systemd_contexts_path)
     hidden_proto(selinux_path)
     hidden_proto(selinux_check_passwd_access)
Signature · 7 lines
2.4.1

_______________________________________________
Selinux mailing list
[email protected]
To unsubscribe, send email to [email protected].
To get help, send an email containing "help" to [email protected].
Signature · 4 lines
02DFF788
4D30 903A 1CF3 B756 FB48  1514 3148 83A2 02DF F788
http://keys.gnupg.net/pks/lookup?op=vindex&search=0x314883A202DFF788
Dominick Grift
#6 lore raw

Dne 21.5.2015 v 18:31 Dominick Grift napsal(a):

Quoted 7 lines
Quoted 7 lines
libselinux/src/selinux_config.c +0 -0
index 0a80141..bec5f3b 100644
@@ -48,8 +48,9 @@
 #define FILE_CONTEXT_SUBS_DIST 25
 #define LXC_CONTEXTS      26
Quoted 8 lines

libselinux/src/selinux_config.c line 53

Quoted 6 lines
libselinux/src/selinux_config.c +3 -2
 #define BOOLEAN_SUBS      27
-#define SYSTEMD_CONTEXTS  28
-#define NEL               29
+#define OPENSSH_CONTEXTS  28
+#define SYSTEMD_CONTEXTS  29
+#define NEL               30

How come openssh_context becomes version 28 and systemd_contexts changes from 28 to 29?

It's just internal "index" in static file_path_suffixes_data. Since it's not exported and it's used only in libselinux/src/selinux_config.c, the idea was to have it an alphabetic order therefore it's put before SYSTEMD_CONTEXTS.

Maybe it would be better to just add a new values to the end of list.

Petr

Quoted 47 lines
Quoted 38 lines
libselinux/src/selinux_config.c +7 -0
 /* Part of one-time lazy init */
 static pthread_once_t once = PTHREAD_ONCE_INIT;
@@ -491,6 +492,13 @@ const char *selinux_lxc_contexts_path(void)
 
 hidden_def(selinux_lxc_contexts_path)
 
+const char *selinux_openssh_contexts_path(void)
+{
+    return get_path(OPENSSH_CONTEXTS);
+}
+
+hidden_def(selinux_openssh_contexts_path)
+
 const char *selinux_systemd_contexts_path(void)
 {
 	return get_path(SYSTEMD_CONTEXTS);
libselinux/src/selinux_internal.h +1 -0
index 0abf1b4..844e408 100644
@@ -83,6 +83,7 @@ hidden_proto(selinux_mkload_policy)
     hidden_proto(selinux_media_context_path)
     hidden_proto(selinux_x_context_path)
     hidden_proto(selinux_sepgsql_context_path)
+    hidden_proto(selinux_openssh_contexts_path)
     hidden_proto(selinux_systemd_contexts_path)
     hidden_proto(selinux_path)
     hidden_proto(selinux_check_passwd_access)
Signature · 7 lines
2.4.1

_______________________________________________
Selinux mailing list
[email protected]
To unsubscribe, send email to [email protected].
To get help, send an email containing "help" to [email protected].

_______________________________________________
Selinux mailing list
[email protected]
To unsubscribe, send email to [email protected].
To get help, send an email containing "help" to [email protected].

Signature · 1 line
Petr Lautrbach
#7 lore raw
In reply to Petr Lautrbach
Quoted 7 lines · Petr Lautrbach

openssh in Fedora uses "sshd_net_t" type for privilege separated processes in the preauthentication phase. Similarly, openssh portable uses "sftp_t" for internal-sftp processes. Both type are hardcoded what is not ideal. Therefore selinux_openssh_contexts_path() was created to get a path where sshd can get a correct types prepared by a distribution or an administrator.

Thanks, applied.

Quoted 74 lines
---
 libselinux/include/selinux/selinux.h |  1 +
 libselinux/src/file_path_suffixes.h  |  1 +
 libselinux/src/selinux_config.c      | 12 ++++++++++--
 libselinux/src/selinux_internal.h    |  1 +
 4 files changed, 13 insertions(+), 2 deletions(-)
libselinux/include/selinux/selinux.h +1 -0
index d0eb5c6..4beb170 100644
@@ -543,6 +543,7 @@ extern const char *selinux_virtual_image_context_path(void);
 extern const char *selinux_lxc_contexts_path(void);
 extern const char *selinux_x_context_path(void);
 extern const char *selinux_sepgsql_context_path(void);
+extern const char *selinux_openssh_contexts_path(void);
 extern const char *selinux_systemd_contexts_path(void);
 extern const char *selinux_contexts_path(void);
 extern const char *selinux_securetty_types_path(void);
libselinux/src/file_path_suffixes.h +1 -0
index 3c92424..d1f9b48 100644
@@ -23,6 +23,7 @@ S_(BINPOLICY, "/policy/policy")
     S_(VIRTUAL_DOMAIN, "/contexts/virtual_domain_context")
     S_(VIRTUAL_IMAGE, "/contexts/virtual_image_context")
     S_(LXC_CONTEXTS, "/contexts/lxc_contexts")
+    S_(OPENSSH_CONTEXTS, "/contexts/openssh_contexts")
     S_(SYSTEMD_CONTEXTS, "/contexts/systemd_contexts")
     S_(FILE_CONTEXT_SUBS, "/contexts/files/file_contexts.subs")
     S_(FILE_CONTEXT_SUBS_DIST, "/contexts/files/file_contexts.subs_dist")
libselinux/src/selinux_config.c +10 -2
index 0a80141..bec5f3b 100644
@@ -48,8 +48,9 @@
 #define FILE_CONTEXT_SUBS_DIST 25
 #define LXC_CONTEXTS      26
 #define BOOLEAN_SUBS      27
-#define SYSTEMD_CONTEXTS  28
-#define NEL               29
+#define OPENSSH_CONTEXTS  28
+#define SYSTEMD_CONTEXTS  29
+#define NEL               30
 
 /* Part of one-time lazy init */
 static pthread_once_t once = PTHREAD_ONCE_INIT;
@@ -491,6 +492,13 @@ const char *selinux_lxc_contexts_path(void)
 
 hidden_def(selinux_lxc_contexts_path)
 
+const char *selinux_openssh_contexts_path(void)
+{
+    return get_path(OPENSSH_CONTEXTS);
+}
+
+hidden_def(selinux_openssh_contexts_path)
+
 const char *selinux_systemd_contexts_path(void)
 {
 	return get_path(SYSTEMD_CONTEXTS);
libselinux/src/selinux_internal.h +1 -0
index 0abf1b4..844e408 100644
@@ -83,6 +83,7 @@ hidden_proto(selinux_mkload_policy)
     hidden_proto(selinux_media_context_path)
     hidden_proto(selinux_x_context_path)
     hidden_proto(selinux_sepgsql_context_path)
+    hidden_proto(selinux_openssh_contexts_path)
     hidden_proto(selinux_systemd_contexts_path)
     hidden_proto(selinux_path)
     hidden_proto(selinux_check_passwd_access)