tomcat_selinux(8)

πŸ“¦
version 20250627+git412.dbf877ab7 Β· 7 versions
, in opensuse-leap 16.0

🐱 tomcat_selinux(8) πŸ’– β€” the SELinux glow-up for Tomcat

okay so bestie, welcome to the tomcat_selinux(8) page β€” this is the SELinux policy manual for the tomcat processes, and it's literally about keeping your Tomcat locked down and cute. the page source is tomcat, version 26-10-06, dated 26-10-06 (same date, efficient queen behavior), but we'll get to that at the end. let's go. πŸ’…


✨ NAME ✨

tomcat_selinux β€” Security Enhanced Linux Policy for the tomcat processes. that's the whole vibe. periodt.


πŸ’… DESCRIPTION πŸ’…

so Security-Enhanced Linux secures the tomcat processes via flexible mandatory access control. no cap, it's giving security with main character energy.

the tomcat processes execute with the tomcat_t SELinux type. you can check if you have these processes running by executing the ps command with the -Z qualifier. for example:

ps -eZ | grep tomcat_t

slay, now you can see what's up. πŸ‘‘


πŸšͺ ENTRYPOINTS πŸšͺ

the tomcat_t SELinux type can be entered via the tomcat_exec_t file type. that's the doorway, bestie.

the default entrypoint paths for the tomcat_t domain are the following:

/usr/bin/tomcat(6)?, /usr/libexec/tomcat/server

those are the exact paths, keep them close. 🫢


πŸ‘‘ PROCESS TYPES πŸ‘‘

SELinux defines process types (domains) for each process running on the system. it's a whole thing.

you can see the context of a process using the -Z option to ps. yes, again with the -Z, it's iconic.

policy governs the access confined processes have to files. SELinux tomcat policy is very flexible allowing users to setup their tomcat processes in as secure a method as possible. we love a flexible queen.

the following process types are defined for tomcat:

  • tomcat_t
note: semanage permissive -a tomcat_t can be used to make the process type tomcat_t permissive. SELinux does not deny access to permissive process types, but the AVC (SELinux denials) messages are still generated. so like, permissive is not a free pass, it's just a vibe. πŸ’€

πŸŽ€ BOOLEANS πŸŽ€

SELinux policy is customizable based on least access required. tomcat policy is extremely flexible and has several booleans that allow you to manipulate the policy and run tomcat with the tightest access possible. it's giving "customize your security, bestie."

  • tomcat_use_execmem β€” if you want to allow tomcat to use executable memory and executable stack, you must turn on the tomcat_use_execmem boolean. disabled by default. run: setsebool -P tomcat_use_execmem 1
  • daemons_dontaudit_scheduling β€” if you want to dontaudit all daemons scheduling requests (setsched, sys_nice), you must turn on the daemons_dontaudit_scheduling boolean. enabled by default. run: setsebool -P daemons_dontaudit_scheduling 1
  • mmap_low_allowed β€” if you want to control the ability to mmap a low area of the address space, as configured by /proc/sys/vm/mmap_min_addr, you must turn on the mmap_low_allowed boolean. disabled by default. run: setsebool -P mmap_low_allowed 1
  • nis_enabled β€” if you want to allow system to run with NIS, you must turn on the nis_enabled boolean. disabled by default. run: setsebool -P nis_enabled 1
  • secure_mode_insmod β€” if you want to disable kernel module loading, you must turn on the secure_mode_insmod boolean. disabled by default. run: setsebool -P secure_mode_insmod 1
  • selinuxuser_execheap β€” if you want to allow unconfined executables to make their heap memory executable. doing this is a really bad idea. probably indicates a badly coded executable, but could indicate an attack. this executable should be reported in bugzilla, you must turn on the selinuxuser_execheap boolean. disabled by default. run: setsebool -P selinuxuser_execheap 1
  • selinuxuser_execstack β€” if you want to allow unconfined executables to make their stack executable. this should never, ever be necessary. probably indicates a badly coded executable, but could indicate an attack. this executable should be reported in bugzilla, you must turn on the selinuxuser_execstack boolean. disabled by default. run: setsebool -P selinuxuser_execstack 1
okay but fr fr, those last two? red flags. if you're turning those on, something is probably cursed. report it to bugzilla, bestie. πŸ™ˆ

πŸ“ MANAGED FILES πŸ“

the SELinux process type tomcat_t can manage files labeled with the following file types. the paths listed are the default paths for these file types. note the processes UID still need to have DAC permissions. so like, SELinux isn't doing all the work, your UID has to cooperate too. πŸ’…

  • file_type β€” all files on the system. literally every file, no cap.

🎨 FILE CONTEXTS 🎨

SELinux requires files to have an extended attribute to define the file type. it's a whole labeling system.

you can see the context of a file using the -Z option to ls. yes, -Z again, it's the moment.

policy governs the access confined processes have to these files. SELinux tomcat policy is very flexible allowing users to setup their tomcat processes in as secure a method as possible. we love consistency.

🌈 STANDARD FILE CONTEXT 🌈

SELinux defines the file context types for the tomcat, 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 so:

semanage fcontext -a -t tomcat_exec_t '/srv/tomcat/content(/.*)?'
restorecon -R -v /srv/mytomcat_content
note: SELinux often uses regular expressions to specify labels that match multiple files. so those regexes are intentional, don't come for them.

the following file types are defined for tomcat:

  • tomcat_cache_t β€” set files with the tomcat_cache_t type, if you want to store the files under the /var/cache directory. cache queen.
  • tomcat_exec_t β€” set files with the tomcat_exec_t type, if you want to transition an executable to the tomcat_t domain. paths: /usr/bin/tomcat(6)?, /usr/libexec/tomcat/server
  • tomcat_log_t β€” set files with the tomcat_log_t type, if you want to treat the data as tomcat log data, usually stored under the /var/log directory. logs are iconic.
  • tomcat_tmp_t β€” set files with the tomcat_tmp_t type, if you want to store tomcat temporary files in the /tmp directories. temp files, we stan.
  • tomcat_unit_file_t β€” set files with the tomcat_unit_file_t type, if you want to treat the files as tomcat unit content. unit content, very demure.
  • tomcat_var_lib_t β€” set files with the tomcat_var_lib_t type, if you want to store the tomcat files under the /var/lib directory. paths: /var/lib/tomcat6?(/.*)?, /var/lib/tomcats?(/.*)?
  • tomcat_var_run_t β€” set files with the tomcat_var_run_t type, if you want to store the tomcat files under the /run or /var/run directory. run files, run the world.
note: file context can be temporarily modified with the chcon command. if you want to permanently change the file context you need to use the semanage fcontext command. this will modify the SELinux labeling database. you will need to use restorecon to apply the labels. don't skip the restorecon, bestie. 😭

πŸ’» COMMANDS πŸ’»

<<semanage fcontext>> can also be used to manipulate default file context mappings.

semanage permissive can also be used to manipulate whether or not a process type is permissive.

semanage module can also be used to enable/disable/install/remove policy modules.

semanage boolean can also be used to manipulate the booleans.

system-config-selinux is a GUI tool available to customize SELinux policy settings. for the girlies who like a visual interface. ✨


✍️ AUTHOR ✍️

this manual page was auto-generated using sepolicy manpage . β€” no human wrote this prose, it's giving robot with a cute filter. πŸ€–πŸ’…


πŸ‘€ SEE ALSO πŸ‘€


so yeah, that's the whole page, bestie. source/version is tomcat, version 26-10-06, dated 26-10-06. catch you later, stay secure, and don't turn on selinuxuser_execheap unless you have a really good reason. periodt. πŸ’–πŸ¦‹πŸŒΈ

πŸ“¦ where this page comes from