selinux_linux.go 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768
  1. // +build selinux,linux
  2. package selinux
  3. import (
  4. "bufio"
  5. "bytes"
  6. "crypto/rand"
  7. "encoding/binary"
  8. "errors"
  9. "fmt"
  10. "io"
  11. "io/ioutil"
  12. "os"
  13. "path/filepath"
  14. "regexp"
  15. "strconv"
  16. "strings"
  17. "sync"
  18. "syscall"
  19. )
  20. const (
  21. // Enforcing constant indicate SELinux is in enforcing mode
  22. Enforcing = 1
  23. // Permissive constant to indicate SELinux is in permissive mode
  24. Permissive = 0
  25. // Disabled constant to indicate SELinux is disabled
  26. Disabled = -1
  27. selinuxDir = "/etc/selinux/"
  28. selinuxConfig = selinuxDir + "config"
  29. selinuxfsMount = "/sys/fs/selinux"
  30. selinuxTypeTag = "SELINUXTYPE"
  31. selinuxTag = "SELINUX"
  32. xattrNameSelinux = "security.selinux"
  33. stRdOnly = 0x01
  34. selinuxfsMagic = 0xf97cff8c
  35. )
  36. type selinuxState struct {
  37. enabledSet bool
  38. enabled bool
  39. selinuxfsSet bool
  40. selinuxfs string
  41. mcsList map[string]bool
  42. sync.Mutex
  43. }
  44. var (
  45. // ErrMCSAlreadyExists is returned when trying to allocate a duplicate MCS.
  46. ErrMCSAlreadyExists = errors.New("MCS label already exists")
  47. // ErrEmptyPath is returned when an empty path has been specified.
  48. ErrEmptyPath = errors.New("empty path")
  49. // InvalidLabel is returned when an invalid label is specified.
  50. InvalidLabel = errors.New("Invalid Label")
  51. assignRegex = regexp.MustCompile(`^([^=]+)=(.*)$`)
  52. roFileLabel string
  53. state = selinuxState{
  54. mcsList: make(map[string]bool),
  55. }
  56. )
  57. // Context is a representation of the SELinux label broken into 4 parts
  58. type Context map[string]string
  59. func (s *selinuxState) setEnable(enabled bool) bool {
  60. s.Lock()
  61. defer s.Unlock()
  62. s.enabledSet = true
  63. s.enabled = enabled
  64. return s.enabled
  65. }
  66. func (s *selinuxState) getEnabled() bool {
  67. s.Lock()
  68. enabled := s.enabled
  69. enabledSet := s.enabledSet
  70. s.Unlock()
  71. if enabledSet {
  72. return enabled
  73. }
  74. enabled = false
  75. if fs := getSelinuxMountPoint(); fs != "" {
  76. if con, _ := CurrentLabel(); con != "kernel" {
  77. enabled = true
  78. }
  79. }
  80. return s.setEnable(enabled)
  81. }
  82. // SetDisabled disables selinux support for the package
  83. func SetDisabled() {
  84. state.setEnable(false)
  85. }
  86. func (s *selinuxState) setSELinuxfs(selinuxfs string) string {
  87. s.Lock()
  88. defer s.Unlock()
  89. s.selinuxfsSet = true
  90. s.selinuxfs = selinuxfs
  91. return s.selinuxfs
  92. }
  93. func verifySELinuxfsMount(mnt string) bool {
  94. var buf syscall.Statfs_t
  95. for {
  96. err := syscall.Statfs(mnt, &buf)
  97. if err == nil {
  98. break
  99. }
  100. if err == syscall.EAGAIN {
  101. continue
  102. }
  103. return false
  104. }
  105. if uint32(buf.Type) != uint32(selinuxfsMagic) {
  106. return false
  107. }
  108. if (buf.Flags & stRdOnly) != 0 {
  109. return false
  110. }
  111. return true
  112. }
  113. func findSELinuxfs() string {
  114. // fast path: check the default mount first
  115. if verifySELinuxfsMount(selinuxfsMount) {
  116. return selinuxfsMount
  117. }
  118. // check if selinuxfs is available before going the slow path
  119. fs, err := ioutil.ReadFile("/proc/filesystems")
  120. if err != nil {
  121. return ""
  122. }
  123. if !bytes.Contains(fs, []byte("\tselinuxfs\n")) {
  124. return ""
  125. }
  126. // slow path: try to find among the mounts
  127. f, err := os.Open("/proc/self/mountinfo")
  128. if err != nil {
  129. return ""
  130. }
  131. defer f.Close()
  132. scanner := bufio.NewScanner(f)
  133. for {
  134. mnt := findSELinuxfsMount(scanner)
  135. if mnt == "" { // error or not found
  136. return ""
  137. }
  138. if verifySELinuxfsMount(mnt) {
  139. return mnt
  140. }
  141. }
  142. }
  143. // findSELinuxfsMount returns a next selinuxfs mount point found,
  144. // if there is one, or an empty string in case of EOF or error.
  145. func findSELinuxfsMount(s *bufio.Scanner) string {
  146. for s.Scan() {
  147. txt := s.Text()
  148. // The first field after - is fs type.
  149. // Safe as spaces in mountpoints are encoded as \040
  150. if !strings.Contains(txt, " - selinuxfs ") {
  151. continue
  152. }
  153. const mPos = 5 // mount point is 5th field
  154. fields := strings.SplitN(txt, " ", mPos+1)
  155. if len(fields) < mPos+1 {
  156. continue
  157. }
  158. return fields[mPos-1]
  159. }
  160. return ""
  161. }
  162. func (s *selinuxState) getSELinuxfs() string {
  163. s.Lock()
  164. selinuxfs := s.selinuxfs
  165. selinuxfsSet := s.selinuxfsSet
  166. s.Unlock()
  167. if selinuxfsSet {
  168. return selinuxfs
  169. }
  170. return s.setSELinuxfs(findSELinuxfs())
  171. }
  172. // getSelinuxMountPoint returns the path to the mountpoint of an selinuxfs
  173. // filesystem or an empty string if no mountpoint is found. Selinuxfs is
  174. // a proc-like pseudo-filesystem that exposes the selinux policy API to
  175. // processes. The existence of an selinuxfs mount is used to determine
  176. // whether selinux is currently enabled or not.
  177. func getSelinuxMountPoint() string {
  178. return state.getSELinuxfs()
  179. }
  180. // GetEnabled returns whether selinux is currently enabled.
  181. func GetEnabled() bool {
  182. return state.getEnabled()
  183. }
  184. func readConfig(target string) string {
  185. var (
  186. val, key string
  187. bufin *bufio.Reader
  188. )
  189. in, err := os.Open(selinuxConfig)
  190. if err != nil {
  191. return ""
  192. }
  193. defer in.Close()
  194. bufin = bufio.NewReader(in)
  195. for done := false; !done; {
  196. var line string
  197. if line, err = bufin.ReadString('\n'); err != nil {
  198. if err != io.EOF {
  199. return ""
  200. }
  201. done = true
  202. }
  203. line = strings.TrimSpace(line)
  204. if len(line) == 0 {
  205. // Skip blank lines
  206. continue
  207. }
  208. if line[0] == ';' || line[0] == '#' {
  209. // Skip comments
  210. continue
  211. }
  212. if groups := assignRegex.FindStringSubmatch(line); groups != nil {
  213. key, val = strings.TrimSpace(groups[1]), strings.TrimSpace(groups[2])
  214. if key == target {
  215. return strings.Trim(val, "\"")
  216. }
  217. }
  218. }
  219. return ""
  220. }
  221. func getSELinuxPolicyRoot() string {
  222. return filepath.Join(selinuxDir, readConfig(selinuxTypeTag))
  223. }
  224. func readCon(fpath string) (string, error) {
  225. if fpath == "" {
  226. return "", ErrEmptyPath
  227. }
  228. in, err := os.Open(fpath)
  229. if err != nil {
  230. return "", err
  231. }
  232. defer in.Close()
  233. var retval string
  234. if _, err := fmt.Fscanf(in, "%s", &retval); err != nil {
  235. return "", err
  236. }
  237. return strings.Trim(retval, "\x00"), nil
  238. }
  239. // SetFileLabel sets the SELinux label for this path or returns an error.
  240. func SetFileLabel(fpath string, label string) error {
  241. if fpath == "" {
  242. return ErrEmptyPath
  243. }
  244. return lsetxattr(fpath, xattrNameSelinux, []byte(label), 0)
  245. }
  246. // FileLabel returns the SELinux label for this path or returns an error.
  247. func FileLabel(fpath string) (string, error) {
  248. if fpath == "" {
  249. return "", ErrEmptyPath
  250. }
  251. label, err := lgetxattr(fpath, xattrNameSelinux)
  252. if err != nil {
  253. return "", err
  254. }
  255. // Trim the NUL byte at the end of the byte buffer, if present.
  256. if len(label) > 0 && label[len(label)-1] == '\x00' {
  257. label = label[:len(label)-1]
  258. }
  259. return string(label), nil
  260. }
  261. /*
  262. SetFSCreateLabel tells kernel the label to create all file system objects
  263. created by this task. Setting label="" to return to default.
  264. */
  265. func SetFSCreateLabel(label string) error {
  266. return writeCon(fmt.Sprintf("/proc/self/task/%d/attr/fscreate", syscall.Gettid()), label)
  267. }
  268. /*
  269. FSCreateLabel returns the default label the kernel which the kernel is using
  270. for file system objects created by this task. "" indicates default.
  271. */
  272. func FSCreateLabel() (string, error) {
  273. return readCon(fmt.Sprintf("/proc/self/task/%d/attr/fscreate", syscall.Gettid()))
  274. }
  275. // CurrentLabel returns the SELinux label of the current process thread, or an error.
  276. func CurrentLabel() (string, error) {
  277. return readCon(fmt.Sprintf("/proc/self/task/%d/attr/current", syscall.Gettid()))
  278. }
  279. // PidLabel returns the SELinux label of the given pid, or an error.
  280. func PidLabel(pid int) (string, error) {
  281. return readCon(fmt.Sprintf("/proc/%d/attr/current", pid))
  282. }
  283. /*
  284. ExecLabel returns the SELinux label that the kernel will use for any programs
  285. that are executed by the current process thread, or an error.
  286. */
  287. func ExecLabel() (string, error) {
  288. return readCon(fmt.Sprintf("/proc/self/task/%d/attr/exec", syscall.Gettid()))
  289. }
  290. func writeCon(fpath string, val string) error {
  291. if fpath == "" {
  292. return ErrEmptyPath
  293. }
  294. out, err := os.OpenFile(fpath, os.O_WRONLY, 0)
  295. if err != nil {
  296. return err
  297. }
  298. defer out.Close()
  299. if val != "" {
  300. _, err = out.Write([]byte(val))
  301. } else {
  302. _, err = out.Write(nil)
  303. }
  304. return err
  305. }
  306. /*
  307. CanonicalizeContext takes a context string and writes it to the kernel
  308. the function then returns the context that the kernel will use. This function
  309. can be used to see if two contexts are equivalent
  310. */
  311. func CanonicalizeContext(val string) (string, error) {
  312. return readWriteCon(filepath.Join(getSelinuxMountPoint(), "context"), val)
  313. }
  314. func readWriteCon(fpath string, val string) (string, error) {
  315. if fpath == "" {
  316. return "", ErrEmptyPath
  317. }
  318. f, err := os.OpenFile(fpath, os.O_RDWR, 0)
  319. if err != nil {
  320. return "", err
  321. }
  322. defer f.Close()
  323. _, err = f.Write([]byte(val))
  324. if err != nil {
  325. return "", err
  326. }
  327. var retval string
  328. if _, err := fmt.Fscanf(f, "%s", &retval); err != nil {
  329. return "", err
  330. }
  331. return strings.Trim(retval, "\x00"), nil
  332. }
  333. /*
  334. SetExecLabel sets the SELinux label that the kernel will use for any programs
  335. that are executed by the current process thread, or an error.
  336. */
  337. func SetExecLabel(label string) error {
  338. return writeCon(fmt.Sprintf("/proc/self/task/%d/attr/exec", syscall.Gettid()), label)
  339. }
  340. // SetSocketLabel takes a process label and tells the kernel to assign the
  341. // label to the next socket that gets created
  342. func SetSocketLabel(label string) error {
  343. return writeCon(fmt.Sprintf("/proc/self/task/%d/attr/sockcreate", syscall.Gettid()), label)
  344. }
  345. // SocketLabel retrieves the current socket label setting
  346. func SocketLabel() (string, error) {
  347. return readCon(fmt.Sprintf("/proc/self/task/%d/attr/sockcreate", syscall.Gettid()))
  348. }
  349. // SetKeyLabel takes a process label and tells the kernel to assign the
  350. // label to the next kernel keyring that gets created
  351. func SetKeyLabel(label string) error {
  352. return writeCon("/proc/self/attr/keycreate", label)
  353. }
  354. // KeyLabel retrieves the current kernel keyring label setting
  355. func KeyLabel() (string, error) {
  356. return readCon("/proc/self/attr/keycreate")
  357. }
  358. // Get returns the Context as a string
  359. func (c Context) Get() string {
  360. if c["level"] != "" {
  361. return fmt.Sprintf("%s:%s:%s:%s", c["user"], c["role"], c["type"], c["level"])
  362. }
  363. return fmt.Sprintf("%s:%s:%s", c["user"], c["role"], c["type"])
  364. }
  365. // NewContext creates a new Context struct from the specified label
  366. func NewContext(label string) (Context, error) {
  367. c := make(Context)
  368. if len(label) != 0 {
  369. con := strings.SplitN(label, ":", 4)
  370. if len(con) < 3 {
  371. return c, InvalidLabel
  372. }
  373. c["user"] = con[0]
  374. c["role"] = con[1]
  375. c["type"] = con[2]
  376. if len(con) > 3 {
  377. c["level"] = con[3]
  378. }
  379. }
  380. return c, nil
  381. }
  382. // ClearLabels clears all reserved labels
  383. func ClearLabels() {
  384. state.Lock()
  385. state.mcsList = make(map[string]bool)
  386. state.Unlock()
  387. }
  388. // ReserveLabel reserves the MLS/MCS level component of the specified label
  389. func ReserveLabel(label string) {
  390. if len(label) != 0 {
  391. con := strings.SplitN(label, ":", 4)
  392. if len(con) > 3 {
  393. mcsAdd(con[3])
  394. }
  395. }
  396. }
  397. func selinuxEnforcePath() string {
  398. return fmt.Sprintf("%s/enforce", getSelinuxMountPoint())
  399. }
  400. // EnforceMode returns the current SELinux mode Enforcing, Permissive, Disabled
  401. func EnforceMode() int {
  402. var enforce int
  403. enforceS, err := readCon(selinuxEnforcePath())
  404. if err != nil {
  405. return -1
  406. }
  407. enforce, err = strconv.Atoi(string(enforceS))
  408. if err != nil {
  409. return -1
  410. }
  411. return enforce
  412. }
  413. /*
  414. SetEnforceMode sets the current SELinux mode Enforcing, Permissive.
  415. Disabled is not valid, since this needs to be set at boot time.
  416. */
  417. func SetEnforceMode(mode int) error {
  418. return writeCon(selinuxEnforcePath(), fmt.Sprintf("%d", mode))
  419. }
  420. /*
  421. DefaultEnforceMode returns the systems default SELinux mode Enforcing,
  422. Permissive or Disabled. Note this is is just the default at boot time.
  423. EnforceMode tells you the systems current mode.
  424. */
  425. func DefaultEnforceMode() int {
  426. switch readConfig(selinuxTag) {
  427. case "enforcing":
  428. return Enforcing
  429. case "permissive":
  430. return Permissive
  431. }
  432. return Disabled
  433. }
  434. func mcsAdd(mcs string) error {
  435. if mcs == "" {
  436. return nil
  437. }
  438. state.Lock()
  439. defer state.Unlock()
  440. if state.mcsList[mcs] {
  441. return ErrMCSAlreadyExists
  442. }
  443. state.mcsList[mcs] = true
  444. return nil
  445. }
  446. func mcsDelete(mcs string) {
  447. if mcs == "" {
  448. return
  449. }
  450. state.Lock()
  451. defer state.Unlock()
  452. state.mcsList[mcs] = false
  453. }
  454. func intToMcs(id int, catRange uint32) string {
  455. var (
  456. SETSIZE = int(catRange)
  457. TIER = SETSIZE
  458. ORD = id
  459. )
  460. if id < 1 || id > 523776 {
  461. return ""
  462. }
  463. for ORD > TIER {
  464. ORD = ORD - TIER
  465. TIER--
  466. }
  467. TIER = SETSIZE - TIER
  468. ORD = ORD + TIER
  469. return fmt.Sprintf("s0:c%d,c%d", TIER, ORD)
  470. }
  471. func uniqMcs(catRange uint32) string {
  472. var (
  473. n uint32
  474. c1, c2 uint32
  475. mcs string
  476. )
  477. for {
  478. binary.Read(rand.Reader, binary.LittleEndian, &n)
  479. c1 = n % catRange
  480. binary.Read(rand.Reader, binary.LittleEndian, &n)
  481. c2 = n % catRange
  482. if c1 == c2 {
  483. continue
  484. } else {
  485. if c1 > c2 {
  486. c1, c2 = c2, c1
  487. }
  488. }
  489. mcs = fmt.Sprintf("s0:c%d,c%d", c1, c2)
  490. if err := mcsAdd(mcs); err != nil {
  491. continue
  492. }
  493. break
  494. }
  495. return mcs
  496. }
  497. /*
  498. ReleaseLabel will unreserve the MLS/MCS Level field of the specified label.
  499. Allowing it to be used by another process.
  500. */
  501. func ReleaseLabel(label string) {
  502. if len(label) != 0 {
  503. con := strings.SplitN(label, ":", 4)
  504. if len(con) > 3 {
  505. mcsDelete(con[3])
  506. }
  507. }
  508. }
  509. // ROFileLabel returns the specified SELinux readonly file label
  510. func ROFileLabel() string {
  511. return roFileLabel
  512. }
  513. /*
  514. ContainerLabels returns an allocated processLabel and fileLabel to be used for
  515. container labeling by the calling process.
  516. */
  517. func ContainerLabels() (processLabel string, fileLabel string) {
  518. var (
  519. val, key string
  520. bufin *bufio.Reader
  521. )
  522. if !GetEnabled() {
  523. return "", ""
  524. }
  525. lxcPath := fmt.Sprintf("%s/contexts/lxc_contexts", getSELinuxPolicyRoot())
  526. in, err := os.Open(lxcPath)
  527. if err != nil {
  528. return "", ""
  529. }
  530. defer in.Close()
  531. bufin = bufio.NewReader(in)
  532. for done := false; !done; {
  533. var line string
  534. if line, err = bufin.ReadString('\n'); err != nil {
  535. if err == io.EOF {
  536. done = true
  537. } else {
  538. goto exit
  539. }
  540. }
  541. line = strings.TrimSpace(line)
  542. if len(line) == 0 {
  543. // Skip blank lines
  544. continue
  545. }
  546. if line[0] == ';' || line[0] == '#' {
  547. // Skip comments
  548. continue
  549. }
  550. if groups := assignRegex.FindStringSubmatch(line); groups != nil {
  551. key, val = strings.TrimSpace(groups[1]), strings.TrimSpace(groups[2])
  552. if key == "process" {
  553. processLabel = strings.Trim(val, "\"")
  554. }
  555. if key == "file" {
  556. fileLabel = strings.Trim(val, "\"")
  557. }
  558. if key == "ro_file" {
  559. roFileLabel = strings.Trim(val, "\"")
  560. }
  561. }
  562. }
  563. if processLabel == "" || fileLabel == "" {
  564. return "", ""
  565. }
  566. if roFileLabel == "" {
  567. roFileLabel = fileLabel
  568. }
  569. exit:
  570. scon, _ := NewContext(processLabel)
  571. if scon["level"] != "" {
  572. mcs := uniqMcs(1024)
  573. scon["level"] = mcs
  574. processLabel = scon.Get()
  575. scon, _ = NewContext(fileLabel)
  576. scon["level"] = mcs
  577. fileLabel = scon.Get()
  578. }
  579. return processLabel, fileLabel
  580. }
  581. // SecurityCheckContext validates that the SELinux label is understood by the kernel
  582. func SecurityCheckContext(val string) error {
  583. return writeCon(fmt.Sprintf("%s/context", getSelinuxMountPoint()), val)
  584. }
  585. /*
  586. CopyLevel returns a label with the MLS/MCS level from src label replaced on
  587. the dest label.
  588. */
  589. func CopyLevel(src, dest string) (string, error) {
  590. if src == "" {
  591. return "", nil
  592. }
  593. if err := SecurityCheckContext(src); err != nil {
  594. return "", err
  595. }
  596. if err := SecurityCheckContext(dest); err != nil {
  597. return "", err
  598. }
  599. scon, err := NewContext(src)
  600. if err != nil {
  601. return "", err
  602. }
  603. tcon, err := NewContext(dest)
  604. if err != nil {
  605. return "", err
  606. }
  607. mcsDelete(tcon["level"])
  608. mcsAdd(scon["level"])
  609. tcon["level"] = scon["level"]
  610. return tcon.Get(), nil
  611. }
  612. // Prevent users from relabing system files
  613. func badPrefix(fpath string) error {
  614. if fpath == "" {
  615. return ErrEmptyPath
  616. }
  617. badPrefixes := []string{"/usr"}
  618. for _, prefix := range badPrefixes {
  619. if strings.HasPrefix(fpath, prefix) {
  620. return fmt.Errorf("relabeling content in %s is not allowed", prefix)
  621. }
  622. }
  623. return nil
  624. }
  625. // Chcon changes the `fpath` file object to the SELinux label `label`.
  626. // If `fpath` is a directory and `recurse`` is true, Chcon will walk the
  627. // directory tree setting the label.
  628. func Chcon(fpath string, label string, recurse bool) error {
  629. if fpath == "" {
  630. return ErrEmptyPath
  631. }
  632. if label == "" {
  633. return nil
  634. }
  635. if err := badPrefix(fpath); err != nil {
  636. return err
  637. }
  638. callback := func(p string, info os.FileInfo, err error) error {
  639. e := SetFileLabel(p, label)
  640. if os.IsNotExist(e) {
  641. return nil
  642. }
  643. return e
  644. }
  645. if recurse {
  646. return filepath.Walk(fpath, callback)
  647. }
  648. return SetFileLabel(fpath, label)
  649. }
  650. // DupSecOpt takes an SELinux process label and returns security options that
  651. // can be used to set the SELinux Type and Level for future container processes.
  652. func DupSecOpt(src string) ([]string, error) {
  653. if src == "" {
  654. return nil, nil
  655. }
  656. con, err := NewContext(src)
  657. if err != nil {
  658. return nil, err
  659. }
  660. if con["user"] == "" ||
  661. con["role"] == "" ||
  662. con["type"] == "" {
  663. return nil, nil
  664. }
  665. dup := []string{"user:" + con["user"],
  666. "role:" + con["role"],
  667. "type:" + con["type"],
  668. }
  669. if con["level"] != "" {
  670. dup = append(dup, "level:"+con["level"])
  671. }
  672. return dup, nil
  673. }
  674. // DisableSecOpt returns a security opt that can be used to disable SELinux
  675. // labeling support for future container processes.
  676. func DisableSecOpt() []string {
  677. return []string{"disable"}
  678. }