sshd_selinux(8)
π NAME π
okay so this is sshd_selinux β the Security Enhanced Linux Policy for the sshd processes. that's the whole vibe. π
β¨ DESCRIPTION β¨
Security-Enhanced Linux secures the sshd processes via flexible mandatory access control. yes bestie, mandatory β not the cute optional kind. π
The sshd processes execute with the sshd_t SELinux type. wanna check if you've got these processes running? just run the ps command with the -Z qualifier. easy.
for example:
ps -eZ | grep sshd_t
that's it. that's the check. π«Ά
πͺ ENTRYPOINTS πͺ
The sshd_t SELinux type can be entered via the sshd_exec_t file type. that's the door, basically. πͺβ¨
the default entrypoint paths for the sshd_t domain are the following:
/usr/bin/sshd, /usr/bin/gsisshd
π PROCESS TYPES π
SELinux defines process types (domains) for each process running on the system. every process gets a little label, it's giving name-tag energy. π·οΈ
you can see the context of a process using the -Z option to ps.
Policy governs the access confined processes have to files. SELinux sshd policy is very flexible β it literally lets users set up their sshd processes in as secure a method as possible. obsessed. π
the following process types are defined for sshd:
sshd_t, sshd_sandbox_t, sshd_net_t, ssh_keygen_t, sshd_keygen_t, sshd_session_t, sshd_auth_t, ssh_t, ssh_keysign_t
Note:semanage permissive -a sshd_tcan be used to make the process typesshd_tpermissive. SELinux does not deny access to permissive process types, but the AVC (SELinux denials) messages are still generated. so like, it won't block anything but it will still be writing in its diary about it. π
π₯ BOOLEANS π₯
SELinux policy is customizable based on least access required. sshd policy is extremely flexible and has several booleans that allow you to manipulate the policy and run sshd with the tightest access possible. tightest access = main character energy, no cap. π₯
ssh_sysadm_loginβ if you want to allow ssh logins assysadm_r:sysadm_t, you must turn on thessh_sysadm_loginboolean. Disabled by default.
setsebool -P ssh_sysadm_login 1
ssh_use_tcpdβ if you want to allowsshdto use tcp wrappers, you must turn on thessh_use_tcpdboolean. Disabled by default.
setsebool -P ssh_use_tcpd 1
daemons_dontaudit_schedulingβ if you want to dontaudit all daemons scheduling requests (setsched,sys_nice), you must turn on thedaemons_dontaudit_schedulingboolean. Enabled by default.
setsebool -P daemons_dontaudit_scheduling 1
fips_modeβ if you want to allow all domains to execute infips_mode, you must turn on thefips_modeboolean. Enabled by default.
setsebool -P fips_mode 1
kerberos_enabledβ if you want to allow confined applications to run with kerberos, you must turn on thekerberos_enabledboolean. Enabled by default.
setsebool -P kerberos_enabled 1
nis_enabledβ if you want to allow system to run with NIS, you must turn on thenis_enabledboolean. Disabled by default.
setsebool -P nis_enabled 1
polyinstantiation_enabledβ if you want to enable polyinstantiated directory support, you must turn on thepolyinstantiation_enabledboolean. Disabled by default.
setsebool -P polyinstantiation_enabled 1
π PORT TYPES π
SELinux defines port types to represent TCP and UDP ports. yes, the ports have types too. everyone's labeled. π
you can see the types associated with a port by using the following command:
semanage port -l
Policy governs the access confined processes have to these ports. SELinux sshd policy is very flexible β it lets users set up their sshd processes in as secure a method as possible. π«Ά
the following port types are defined for sshd:
ssh_port_tβ Default Defined Ports:tcp 22
π MANAGED FILES π
The SELinux process type sshd_t can manage files labeled with the following file types. the paths listed are the default paths for these file types. and hey β the processes UID still needs to have DAC permissions. don't forget that part, bestie. π
auth_cache_t
/var/cache/coolkey(/.*)?
auth_home_t
/root/.yubico(/.*)?
/root/.config/Yubico(/.*)?
/root/.google_authenticator
/root/.google_authenticator~
/home/[^/]+/.yubico(/.*)?
/home/[^/]+/.config/Yubico(/.*)?
/home/[^/]+/.google_authenticator
/home/[^/]+/.google_authenticator~
cifs_tcluster_conf_t
/etc/cluster(/.*)?
cluster_var_lib_t
/var/lib/pcsd(/.*)?
/var/lib/cluster(/.*)?
/var/lib/openais(/.*)?
/var/lib/pengine(/.*)?
/var/lib/corosync(/.*)?
/usr/lib/heartbeat(/.*)?
/var/lib/heartbeat(/.*)?
/var/lib/pacemaker(/.*)?
cluster_var_run_t
/run/crm(/.*)?
/run/cman_.*
/run/rsctmp(/.*)?
/run/aisexec.*
/run/heartbeat(/.*)?
/run/pcsd-ruby.socket
/run/corosync-qnetd(/.*)?
/run/corosync-qdevice(/.*)?
/run/pcsd.socket
/run/corosync.pid
/run/cpglockd.pid
/run/rgmanager.pid
/run/cluster/rgmanager.sk
condor_var_lib_t
/var/lib/condor(/.*)?
/var/lib/condor/spool(/.*)?
/var/lib/condor/execute(/.*)?
ecryptfs_t
/home/[^/]+/.Private(/.*)?
/home/[^/]+/.ecryptfs(/.*)?
faillog_t
/var/log/btmp.*
/run/faillock(/.*)?
/var/log/faillog.*
/var/log/tallylog.*
fusefs_t
/run/user/[0-9]+/gvfs
gitosis_var_lib_t
/srv/gitolite(3)?(/.*)?
/srv/lib/gitosis(/.*)?
/var/lib/gitosis(/.*)?
initrc_var_run_t
/run/sysconfig(/.*)?
/run/utmp
/run/keymap
/run/numlock-on
/run/setleds-on
/run/runlevel.dir
/run/setmixer_flag
/run/bootsplashctl
kadmind_tmp_t
/var/tmp/kadmin_0
/var/tmp/kiprop_0
krb5_host_rcache_t
/var/tmp/krb5_0.rcache2
/var/cache/krb5rcache(/.*)?
/var/tmp/nfs_0
/var/tmp/DNS_25
/var/tmp/host_0
/var/tmp/imap_0
/var/tmp/HTTP_23
/var/tmp/HTTP_48
/var/tmp/ldap_55
/var/tmp/ldap_487
/var/tmp/ldapmap1_0
nfs_topenshift_tmp_t
/var/lib/openshift/.*/.tmp(/.*)?
/var/lib/openshift/.*/.sandbox(/.*)?
/var/lib/stickshift/.*/.tmp(/.*)?
/var/lib/stickshift/.*/.sandbox(/.*)?
pam_var_run_t
/var/(db|adm)/sudo(/.*)?
/run/sudo(/.*)?
/run/pam_ssh(/.*)?
/run/sepermit(/.*)?
/var/lib/sudo(/.*)?
/run/pam_mount(/.*)?
/run/pam_timestamp(/.*)?
root_t
/sysroot/.aleph-version.json
/sysroot/ostree/deploy/.*-atomic/deploy(/.*)?
/
/initrd
/var/lib/ntp
security_t
/selinux
sshd_var_run_t
/run/sshd.pid
/run/sshd.init.pid
systemd_passwd_var_run_t
/run/systemd/ask-password(/.*)?
/run/systemd/ask-password-block(/.*)?
user_tmp_t
/run/tlog(/.*)?
/run/user/[^/]+
/dev/shm/mono.*
/tmp/.ICE-unix(/.*)?
/tmp/.X11-unix(/.*)?
/dev/shm/pulse-shm.*
/run/user
/tmp/.X0-lock
/tmp/hsperfdata_root
/var/tmp/hsperfdata_root
/home/[^/]+/tmp
/home/[^/]+/.tmp
/run/user/[0-9]+
/tmp/gconfd-[^/]+
user_tmp_typeβ all user tmp filesvar_auth_t
/var/ace(/.*)?
/var/rsa(/.*)?
/var/lib/abl(/.*)?
/var/lib/rsa(/.*)?
/var/lib/pam_ssh(/.*)?
/var/lib/pam_shield(/.*)?
/var/opt/quest/vas/vasd(/.*)?
/var/lib/google-authenticator(/.*)?
wtmpdb_journal_t
/var/lib/wtmpdb/wtmp.db-journal
π¦ FILE CONTEXTS π¦
SELinux requires files to have an extended attribute to define the file type. every file's gotta have its little label, it's giving β¨identityβ¨. π¦
you can see the context of a file using the -Z option to ls.
Policy governs the access confined processes have to these files. SELinux sshd policy is very flexible β it allows users to set up their sshd processes in as secure a method as possible. π
β STANDARD FILE CONTEXT β
SELinux defines the file context types for the sshd. if you wanted to store files with these types in a different paths, you need to execute the semanage command to specify alternate labeling and then use restorecon to put the labels on disk. like this:
semanage fcontext -a -t sshd_keygen_exec_t '/srv/sshd/content(/.*)?'
restorecon -R -v /srv/mysshd_content
Note: SELinux often uses regular expressions to specify labels that match multiple files. regex girlies rise. π
the following file types are defined for sshd:
sshd_auth_exec_tβ set files with thesshd_auth_exec_ttype, if you want to transition an executable to thesshd_auth_tdomain.sshd_exec_tβ set files with thesshd_exec_ttype, if you want to transition an executable to thesshd_tdomain.
Paths:
/usr/bin/sshd, /usr/bin/gsisshd
sshd_initrc_exec_tβ set files with thesshd_initrc_exec_ttype, if you want to transition an executable to thesshd_initrc_tdomain.sshd_key_tβ set files with thesshd_key_ttype, if you want to treat the files assshdkey data.
Paths:
/etc/ssh/ssh_host.*_key, /etc/ssh/ssh_host.*_key.pub,
/etc/ssh/primes
sshd_keygen_exec_tβ set files with thesshd_keygen_exec_ttype, if you want to transition an executable to thesshd_keygen_tdomain.
Paths:
/usr/libexec/(open)?ssh/sshd-keygen, /usr/bin/sshd-keygen,
/usr/bin/sshd-gen-keys-start
sshd_keygen_unit_file_tβ set files with thesshd_keygen_unit_file_ttype, if you want to treat the files assshdkeygen unit content.sshd_keytab_tβ set files with thesshd_keytab_ttype, if you want to treat the files as kerberos keytab files.sshd_session_exec_tβ set files with thesshd_session_exec_ttype, if you want to transition an executable to thesshd_session_tdomain.sshd_session_tmpfs_tβ set files with thesshd_session_tmpfs_ttype, if you want to storesshdsession files on a tmpfs file system.sshd_session_var_run_tβ set files with thesshd_session_var_run_ttype, if you want to store thesshdsession files under the/runor/var/rundirectory.sshd_tmpfs_tβ set files with thesshd_tmpfs_ttype, if you want to storesshdfiles on a tmpfs file system.sshd_unit_file_tβ set files with thesshd_unit_file_ttype, if you want to treat the files assshdunit content.sshd_var_run_tβ set files with thesshd_var_run_ttype, if you want to store thesshdfiles under the/runor/var/rundirectory.
Paths:
/run/sshd.pid, /run/sshd.init.pid
Note: file context can be temporarily modified with thechconcommand. if you want to permanently change the file context you need to use thesemanage fcontextcommand. this will modify the SELinux labeling database. and then you'll need to userestoreconto apply the labels. so like,chconis the quick fix andsemanage fcontext+restoreconis the actual glow-up. π
π¬ COMMANDS π¬
okay so like, you can also do all this stuff by hand with the semanage girlies, and honestly they're kinda the moment:
semanage fcontextβ this one can also be used to manipulate default file context mappings. yup, the whole mapping situation, yours to mess with πsemanage permissiveβ can also be used to manipulate whether or not a process type is permissive. so if you wanna decide which types get to vibe in permissive mode, this is her β¨semanage moduleβ can also be used to enable/disable/install/remove policy modules. literal queen behavior, she does it all π«Άsemanage portβ can also be used to manipulate the port definitions. ports, but make it curated πsemanage booleanβ can also be used to manipulate the booleans. yes bestie, the toggles. the on/off girlies. she handles them πΈsystem-config-selinuxβ a GUI tool available to customize SELinux policy settings. for when you want to click instead of type, no judgment, we love a visual era π₯οΈπ
π AUTHOR π
this manual page was auto-generated using sepolicy manpage. slay, honestly β the robots did the homework so we didn't have to πβ¨
π SEE ALSO π
go read these next, bestie, they're all connected iykyk:
selinux(8)sshd(8)semanage(8)restorecon(8)chcon(1)sepolicy(8)setsebool(8)ssh_keygen_selinux(8)ssh_keysign_selinux(8)sshd_auth_selinux(8)sshd_keygen_selinux(8)sshd_net_selinux(8)sshd_sandbox_selinux(8)sshd_session_selinux(8)
that's the whole page, bestie!! π the source is sshd, the version/date situation is 26-10-06, and it's all living under the page name sshd_selinux(8) β go forth and be iconic with your contexts ππ¦β¨
π¦ where this page comes from
- opensuse-leap 16.0: selinux-policy-doc 20250627+git412.dbf877ab7-160000.1.1 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms