selinux.go 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. package control
  2. import (
  3. "fmt"
  4. "syscall"
  5. "github.com/codegangsta/cli"
  6. "github.com/rancher/os/config"
  7. )
  8. func selinuxCommand() cli.Command {
  9. app := cli.Command{}
  10. app.Name = "selinux"
  11. app.Action = func(c *cli.Context) error {
  12. argv := []string{"system-docker", "run", "-it", "--privileged", "--rm",
  13. "--net", "host", "--pid", "host", "--ipc", "host",
  14. "-v", "/usr/bin/docker:/usr/bin/docker.dist:ro",
  15. "-v", "/usr/bin/ros:/usr/bin/dockerlaunch:ro",
  16. "-v", "/usr/bin/ros:/usr/bin/system-docker:ro",
  17. "-v", "/usr/bin/ros:/sbin/poweroff:ro",
  18. "-v", "/usr/bin/ros:/sbin/reboot:ro",
  19. "-v", "/usr/bin/ros:/sbin/halt:ro",
  20. "-v", "/usr/bin/ros:/sbin/shutdown:ro",
  21. "-v", "/usr/bin/ros:/usr/bin/respawn:ro",
  22. "-v", "/usr/bin/ros:/usr/bin/ros:ro",
  23. "-v", "/usr/bin/ros:/usr/bin/cloud-init:ro",
  24. "-v", "/usr/bin/ros:/usr/sbin/netconf:ro",
  25. "-v", "/usr/bin/ros:/usr/sbin/wait-for-network:ro",
  26. "-v", "/usr/bin/ros:/usr/sbin/wait-for-docker:ro",
  27. "-v", "/var/lib/docker:/var/lib/docker",
  28. "-v", "/var/lib/rkt:/var/lib/rkt",
  29. "-v", "/dev:/host/dev",
  30. "-v", "/etc/docker:/etc/docker",
  31. "-v", "/etc/hosts:/etc/hosts",
  32. "-v", "/etc/resolv.conf:/etc/resolv.conf",
  33. "-v", "/etc/rkt:/etc/rkt",
  34. "-v", "/etc/ssl/certs/ca-certificates.crt:/etc/ssl/certs/ca-certificates.crt.rancher",
  35. "-v", "/lib/firmware:/lib/firmware",
  36. "-v", "/lib/modules:/lib/modules",
  37. "-v", "/run:/run",
  38. "-v", "/usr/share/ros:/usr/share/ros",
  39. "-v", "/var/lib/rancher/conf:/var/lib/rancher/conf",
  40. "-v", "/var/lib/rancher:/var/lib/rancher",
  41. "-v", "/var/log:/var/log",
  42. "-v", "/var/run:/var/run",
  43. "-v", "/home:/home",
  44. "-v", "/opt:/opt",
  45. "-v", "/etc/selinux:/etc/selinux",
  46. "-v", "/var/lib/selinux:/var/lib/selinux",
  47. "-v", "/usr/share/selinux:/usr/share/selinux",
  48. fmt.Sprintf("%s/os-selinuxtools:%s%s", config.OsRepo, config.Version, config.Suffix), "bash"}
  49. syscall.Exec("/bin/system-docker", argv, []string{})
  50. return nil
  51. }
  52. return app
  53. }