label.go 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. package label
  2. import (
  3. "github.com/opencontainers/selinux/go-selinux"
  4. )
  5. // Deprecated: use selinux.ROFileLabel
  6. var ROMountLabel = selinux.ROFileLabel
  7. // SetProcessLabel takes a process label and tells the kernel to assign the
  8. // label to the next program executed by the current process.
  9. // Deprecated: use selinux.SetExecLabel
  10. var SetProcessLabel = selinux.SetExecLabel
  11. // ProcessLabel returns the process label that the kernel will assign
  12. // to the next program executed by the current process. If "" is returned
  13. // this indicates that the default labeling will happen for the process.
  14. // Deprecated: use selinux.ExecLabel
  15. var ProcessLabel = selinux.ExecLabel
  16. // SetSocketLabel takes a process label and tells the kernel to assign the
  17. // label to the next socket that gets created
  18. // Deprecated: use selinux.SetSocketLabel
  19. var SetSocketLabel = selinux.SetSocketLabel
  20. // SocketLabel retrieves the current default socket label setting
  21. // Deprecated: use selinux.SocketLabel
  22. var SocketLabel = selinux.SocketLabel
  23. // SetKeyLabel takes a process label and tells the kernel to assign the
  24. // label to the next kernel keyring that gets created
  25. // Deprecated: use selinux.SetKeyLabel
  26. var SetKeyLabel = selinux.SetKeyLabel
  27. // KeyLabel retrieves the current default kernel keyring label setting
  28. // Deprecated: use selinux.KeyLabel
  29. var KeyLabel = selinux.KeyLabel
  30. // FileLabel returns the label for specified path
  31. // Deprecated: use selinux.FileLabel
  32. var FileLabel = selinux.FileLabel
  33. // PidLabel will return the label of the process running with the specified pid
  34. // Deprecated: use selinux.PidLabel
  35. var PidLabel = selinux.PidLabel
  36. // Init initialises the labeling system
  37. func Init() {
  38. selinux.GetEnabled()
  39. }
  40. // ClearLabels will clear all reserved labels
  41. // Deprecated: use selinux.ClearLabels
  42. var ClearLabels = selinux.ClearLabels
  43. // ReserveLabel will record the fact that the MCS label has already been used.
  44. // This will prevent InitLabels from using the MCS label in a newly created
  45. // container
  46. // Deprecated: use selinux.ReserveLabel
  47. func ReserveLabel(label string) error {
  48. selinux.ReserveLabel(label)
  49. return nil
  50. }
  51. // ReleaseLabel will remove the reservation of the MCS label.
  52. // This will allow InitLabels to use the MCS label in a newly created
  53. // containers
  54. // Deprecated: use selinux.ReleaseLabel
  55. func ReleaseLabel(label string) error {
  56. selinux.ReleaseLabel(label)
  57. return nil
  58. }
  59. // DupSecOpt takes a process label and returns security options that
  60. // can be used to set duplicate labels on future container processes
  61. // Deprecated: use selinux.DupSecOpt
  62. var DupSecOpt = selinux.DupSecOpt