memcached.service 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. # It's not recommended to modify this file in-place, because it will be
  2. # overwritten during upgrades. If you want to customize, the best
  3. # way is to use the "systemctl edit" command to create an override unit.
  4. #
  5. # For example, to pass additional options, create an override unit
  6. # (as is done by systemctl edit) and enter the following:
  7. #
  8. # [Service]
  9. # Environment=OPTIONS="-l 127.0.0.1,::1"
  10. [Unit]
  11. Description=memcached daemon
  12. After=network.target
  13. [Service]
  14. Environment=PORT=11211
  15. Environment=USER=memcached
  16. Environment=MAXCONN=1024
  17. Environment=CACHESIZE=256
  18. Environment="OPTIONS=-l 127.0.0.1"
  19. ExecStart=/usr/bin/memcached -p ${PORT} -u ${USER} -m ${CACHESIZE} -c ${MAXCONN} $OPTIONS
  20. # Set up a new file system namespace and mounts private /tmp and /var/tmp
  21. # directories so this service cannot access the global directories and
  22. # other processes cannot access this service's directories.
  23. PrivateTmp=true
  24. # Mounts the /usr, /boot, and /etc directories read-only for processes
  25. # invoked by this unit.
  26. ProtectSystem=full
  27. # Ensures that the service process and all its children can never gain new
  28. # privileges
  29. NoNewPrivileges=true
  30. # Sets up a new /dev namespace for the executed processes and only adds API
  31. # pseudo devices such as /dev/null, /dev/zero or /dev/random (as well as
  32. # the pseudo TTY subsystem) to it, but no physical devices such as /dev/sda.
  33. PrivateDevices=true
  34. # Required for dropping privileges and running as a different user
  35. CapabilityBoundingSet=CAP_SETGID CAP_SETUID CAP_SYS_RESOURCE
  36. # Restricts the set of socket address families accessible to the processes
  37. # of this unit. Protects against vulnerabilities such as CVE-2016-8655
  38. RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX
  39. # Some security features are not in the older versions of systemd used by
  40. # e.g. RHEL7/CentOS 7. The below settings are automatically edited at package
  41. # build time to uncomment them if the target platform supports them.
  42. # Attempts to create memory mappings that are writable and executable at
  43. # the same time, or to change existing memory mappings to become executable
  44. # are prohibited.
  45. ##safer##MemoryDenyWriteExecute=true
  46. # Explicit module loading will be denied. This allows to turn off module
  47. # load and unload operations on modular kernels. It is recommended to turn
  48. # this on for most services that do not need special file systems or extra
  49. # kernel modules to work.
  50. ##safer##ProtectKernelModules=true
  51. # Kernel variables accessible through /proc/sys, /sys, /proc/sysrq-trigger,
  52. # /proc/latency_stats, /proc/acpi, /proc/timer_stats, /proc/fs and /proc/irq
  53. # will be made read-only to all processes of the unit. Usually, tunable
  54. # kernel variables should only be written at boot-time, with the sysctl.d(5)
  55. # mechanism. Almost no services need to write to these at runtime; it is hence
  56. # recommended to turn this on for most services.
  57. ##safer##ProtectKernelTunables=true
  58. # The Linux Control Groups (cgroups(7)) hierarchies accessible through
  59. # /sys/fs/cgroup will be made read-only to all processes of the unit.
  60. # Except for container managers no services should require write access
  61. # to the control groups hierarchies; it is hence recommended to turn this
  62. # on for most services
  63. ##safer##ProtectControlGroups=true
  64. # Any attempts to enable realtime scheduling in a process of the unit are
  65. # refused.
  66. ##safer##RestrictRealtime=true
  67. # Takes away the ability to create or manage any kind of namespace
  68. ##safer##RestrictNamespaces=true
  69. [Install]
  70. WantedBy=multi-user.target