sandervanvugt

selinux march22

Mar 29th, 2022
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.41 KB | None | 0 0
  1. 1 getenforce
  2. 2 ls -Z /var/www
  3. 3 history
  4. 4 ldd /usr/bin/passwd
  5. 5 cd /proc
  6. 6 ls
  7. 7 cat cmdline
  8. 8 vim /etc/sysconfig/selinux
  9. 9 reboot
  10. 10 vim /etc/httpd/conf/httpd.conf
  11. 11 mkdir /web
  12. 12 echo non default docroot > /web/index.html
  13. 13 systemctl restart httpd
  14. 14 curl localhost
  15. 15 setenforce permissive
  16. 16 getenforce
  17. 17 curl localhost
  18. 18 vim /etc/httpd/conf/httpd.conf
  19. 19 systemctl restart httpd
  20. 20 curl localhost
  21. 21 getenforce
  22. 22 setenforce enforcing
  23. 23 getenforce
  24. 24 curl localhost
  25. 25 curl https://github.com/sandervanvugt/selinux
  26. 26 git https://github.com/sandervanvugt/selinux
  27. 27 git clone https://github.com/sandervanvugt/selinux
  28. 28 cd selinux/
  29. 29 l;s
  30. 30 ls
  31. 31 history
  32. 32 sleep 120; ./countdown 10
  33. 33 getenforce
  34. 34 ps Zaux | grep http
  35. 35 ls -Z /var/www
  36. 36 ls -ldZ /web
  37. 37 grep AVC /var/log/audit/audit.log
  38. 38 ls -Z /var/www
  39. 39 man semanage-fcontext
  40. 40 semanage fcontext -a -t public_content_t "/web(/.*)?"
  41. 41 echo $?
  42. 42 ls -dZ /web
  43. 43 restorecon -Rv /web
  44. 44 curl https://github.com/sandervanvugt/selinux
  45. 45 curl localhost
  46. 46 cd /etc/selinux/targeted/
  47. 47 ls
  48. 48 cd contexts/
  49. 49 ls
  50. 50 cd files/
  51. 51 ls
  52. 52 cat file_contexts.local
  53. 53 history
  54. 54 grep AVC /var/log/audit/audit.log
  55. 55 cd
  56. 56 git clone https://github.com/SELinuxProject/refpolicy
  57. 57 du -hs refpolicy/
  58. 58 vim /etc/sysconfig/selinux
  59. 59 sestatus
  60. 60 sealert -a /var/log/audit/audit.log
  61. 61 grep AVC /var/log/audit/audit.log
  62. 62 ps Zaux
  63. 63 ps -eZ | grep dbus
  64. 64 ps Zaux | grep dbus
  65. 65 ps -eZ | grep dbus
  66. 66 dnf install selinux-polic-doc
  67. 67 dnf install selinux-policy-doc
  68. 68 man -k _selinux
  69. 69 man -k _selinux | wc
  70. 70 man -k _selinux | grep http
  71. 71 man -k _selinux | grep nginx
  72. 72 man httpd_selinux
  73. 73 semanage fcontext -l
  74. 74 semanage fcontext -l | wc
  75. 75 seinfo -t
  76. 76 seinfo -t | wc
  77. 77 systemctl disable --now https
  78. 78 systemctl disable --now httpd
  79. 79 dnf search nginx
  80. 80 dnf install nginx
  81. 81 systemctl enable --now nginx
  82. 82 systemctl status nginx
  83. 83 vim /etc/nginx/nginx.conf
  84. 84 ps Zaux | grep nginx
  85. 85 ls -ldZ /usr/share/nginx/
  86. 86 ls -lZ /usr/share/nginx/
  87. 87 selinux/countdown 12
  88. 88 ss Ztunap
  89. 89 ss tuna
  90. 90 ss -tuna
  91. 91 ss -tunaZ
  92. 92 vim /etc/ssh/sshd_config
  93. 93 man semanage-port
  94. 94 getsebool -a
  95. 95 getsebool -a | wc
  96. 96 getsebool -a | grep ftp
  97. 97 dnf install -y vsftpd
  98. 98 vim /etc/vsftpd/vsftpd.conf
  99. 99 dnf install -y lftp
  100. 100 systemctl restart vsftpd
  101. 101 systemctl status vsftpd
  102. 102 lftp localhost
  103. 103 getenforce
  104. 104 setenforce permissive
  105. 105 lftp localhost
  106. 106 find / -name "pub"
  107. 107 cd /var/ftp
  108. 108 chmod 777 pub
  109. 109 cd
  110. 110 lftp localhost
  111. 111 setenforce enforcing
  112. 112 lftp localhost
  113. 113 grep AVC /var/log/audit/audit.log
  114. 114 grep AVC /var/log/audit/audit.log | grep ftp
  115. 115 getsebool -a | grep ftp
  116. 116 journalctl | grep sealert
  117. 117 sealert -l b74f63da-8b35-4e2c-9faa-37a25710df9f | less
  118. 118 # semanage fcontext -a -t public_content_rw_t pub
  119. 119 # restorecon -R -v pub
  120. 120 # setsebool -P allow_ftpd_anon_write 1
  121. 121 semanage fcontext -a -t public_content_rw_t "/var/ftp/pub(/.*)?"
  122. 122 restorecon -Rv /var/ftp/pub
  123. 123 setsebool -P allow_ftpd_anon_write 1
  124. 124 getenforce
  125. 125 lftp localhost
  126. 126 journalctl | grep sealert
  127. 127 sealert -l 31280abf-6d3f-4e4e-a563-999b34428186 | less
  128. 128 dnf provides */sealert
  129. 129 sesearch -b ftpd_anon_write -A
  130. 130 getsebool -a | grep ftp
  131. 131 sesearch -b ftpd_full_access -A
  132. 132 sesearch -A | grep httpd_t
  133. 133 ldd $(which ls)
  134. 134 ldd $(which passwd)
  135. 135 man semanage-fcontext
  136. 136 seinfo -tunconfined_t
  137. 137 seinfo -tunconfined_domain_type -x
  138. 138 seinfo -aunconfined_t
  139. 139 seinfo -aunconfined_domain_type -x
  140. 140 selinux/countdown 18
  141. 141 semodule -l
  142. 142 grep http /var/log/audit/audit.log
  143. 143 grep http /var/log/audit/audit.log | grep AVC
  144. 144 grep http /var/log/audit/audit.log | grep AVC | audit2allow -M mypolicy
  145. 145 ls
  146. 146 vim mypolicy.te
  147. 147 ls
  148. 148 cd refpolicy/policy/modules/services/
  149. 149 ls
  150. 150 vim finger.te
  151. 151 vim finger.if
  152. 152 cd
  153. 153 grep AVC /var/log/audit/audit.log > avc.txt
  154. 154 vim avc.txt
  155. 155 cat avc.txt | audit2allow -M ssspol
  156. 156 vim ssspol.te
  157. 157 cd selinux/
  158. 158 ls
  159. 159 cd ..
  160. 160 vim sander.te
  161. 161 vim sander.fc
  162. 162 vim sander.te
  163. 163 checkmodule -M -m -o sander.mod sander.te
  164. 164 semodule_package -o sander.pp -m sander.mod -f sander.fc
  165. 165 ls -l
  166. 166 semodule -i sander.pp
  167. 167 mkdir /opt/sander
  168. 168 cat sander.fc
  169. 169 ls -Zd /opt/sander/
  170. 170 restorecon -Rv /opt/sander
  171. 171 history
  172. 172 semanage user -l
  173. 173 semanage login -l
  174. 174 useradd linda
  175. 175 passwd linda
  176. 176 useradd -Z sysadm_u -G wheel lisa
  177. 177 semanage login -a -s user_u linda
  178. 178 semanage login -l
  179. 179 exit
  180. 180 id -Z
  181. 181 semanage login -m -s sysadm_u root
  182. 182 semanage login -m -s user_u -r s0 __default__
  183. 183 semanage login -l
  184. 184 id -Z
  185. 185 useradd anna
  186. 186 passwd anna
  187. 187 id -Z anna
  188. 188 mount
  189. 189 mount -o remount,rw /
  190. 190 passwd lisa
  191. 191 grep lisa /etc/shadow
  192. 192 exit
  193. 193 usermod -G wheel lisa
  194. 194 id lisa
  195. 195 getenforce
  196. 196 history
  197. 197 reboot
  198. 198 ls
  199. 199 load_policy -i
  200. 200 ls -Z /etc/shadow
  201. 201 restorecon -v /etc/shadow
  202. 202 reboot
  203. 203 exit
  204. 204 getsebool -a | grep sysadm
  205. 205 setsebool -P xdm_sysadm_login on
  206. 206 setsebool -P ssh_sysadm_login on
  207. 207 getsebool -a | grep sysadm
  208. 208 reboot
  209. 209 cd selinux/
  210. 210 ls
  211. 211 vim setup-rot.sh
  212. 212 ./setup-rot.sh
  213. 213 dnf provides */sepolgen
  214. 214 dnf install -y python2-policycoreutils
  215. 215 dnf install -y python3-policycoreutils
  216. 216 dnf install -y policycoreutils-devel
  217. 217 sepolgen --application startrot13
  218. 218 vim startrot13.te
  219. 219 vim startrot13.te
  220. 220 startrot.sh
  221. 221 vim startrot13.te
  222. 222 ./startrot13.sh
  223. 223 vim startrot13.te
  224. 224 ./startrot13.sh
  225. 225 seinfo -t | grep start
  226. 226 history
  227. 227 ip a
  228. 228 reboot
  229. 229 history
  230.  
Advertisement
Add Comment
Please, Sign In to add comment