device_defaults.go 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. // +build linux freebsd
  2. package configs
  3. var (
  4. // These are devices that are to be both allowed and created.
  5. DefaultSimpleDevices = []*Device{
  6. // /dev/null and zero
  7. {
  8. Path: "/dev/null",
  9. Type: 'c',
  10. Major: 1,
  11. Minor: 3,
  12. Permissions: "rwm",
  13. FileMode: 0666,
  14. },
  15. {
  16. Path: "/dev/zero",
  17. Type: 'c',
  18. Major: 1,
  19. Minor: 5,
  20. Permissions: "rwm",
  21. FileMode: 0666,
  22. },
  23. {
  24. Path: "/dev/full",
  25. Type: 'c',
  26. Major: 1,
  27. Minor: 7,
  28. Permissions: "rwm",
  29. FileMode: 0666,
  30. },
  31. // consoles and ttys
  32. {
  33. Path: "/dev/tty",
  34. Type: 'c',
  35. Major: 5,
  36. Minor: 0,
  37. Permissions: "rwm",
  38. FileMode: 0666,
  39. },
  40. // /dev/urandom,/dev/random
  41. {
  42. Path: "/dev/urandom",
  43. Type: 'c',
  44. Major: 1,
  45. Minor: 9,
  46. Permissions: "rwm",
  47. FileMode: 0666,
  48. },
  49. {
  50. Path: "/dev/random",
  51. Type: 'c',
  52. Major: 1,
  53. Minor: 8,
  54. Permissions: "rwm",
  55. FileMode: 0666,
  56. },
  57. }
  58. DefaultAllowedDevices = append([]*Device{
  59. // allow mknod for any device
  60. {
  61. Type: 'c',
  62. Major: Wildcard,
  63. Minor: Wildcard,
  64. Permissions: "m",
  65. },
  66. {
  67. Type: 'b',
  68. Major: Wildcard,
  69. Minor: Wildcard,
  70. Permissions: "m",
  71. },
  72. {
  73. Path: "/dev/console",
  74. Type: 'c',
  75. Major: 5,
  76. Minor: 1,
  77. Permissions: "rwm",
  78. },
  79. // /dev/pts/ - pts namespaces are "coming soon"
  80. {
  81. Path: "",
  82. Type: 'c',
  83. Major: 136,
  84. Minor: Wildcard,
  85. Permissions: "rwm",
  86. },
  87. {
  88. Path: "",
  89. Type: 'c',
  90. Major: 5,
  91. Minor: 2,
  92. Permissions: "rwm",
  93. },
  94. // tuntap
  95. {
  96. Path: "",
  97. Type: 'c',
  98. Major: 10,
  99. Minor: 200,
  100. Permissions: "rwm",
  101. },
  102. }, DefaultSimpleDevices...)
  103. DefaultAutoCreatedDevices = append([]*Device{
  104. {
  105. // /dev/fuse is created but not allowed.
  106. // This is to allow java to work. Because java
  107. // Insists on there being a /dev/fuse
  108. // https://github.com/docker/docker/issues/514
  109. // https://github.com/docker/docker/issues/2393
  110. //
  111. Path: "/dev/fuse",
  112. Type: 'c',
  113. Major: 10,
  114. Minor: 229,
  115. Permissions: "rwm",
  116. },
  117. }, DefaultSimpleDevices...)
  118. )