Advertisement
sandervanvugt

delinuxlynx dec20

Dec 14th, 2020
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.99 KB | None | 0 0
  1. 1 yum install httpd
  2. 2 systemctl start httpd
  3. 3 ps Zaux | grep http
  4. 4 ls -Zl /var/www
  5. 5 lsmod | grep lsm
  6. 6 ls /etc/selinux/
  7. 7 cd
  8. 8 getenforce
  9. 9 setenforce --help
  10. 10 vim /etc/sysconfig/selinux
  11. 11 vim /etc/httpd/conf/httpd.conf
  12. 12 mkdir /web
  13. 13 vim /web/index.html
  14. 14 systemctl restart httpd
  15. 15 curl http://localhost
  16. 16 getenforce
  17. 17 grep AVC /var/log/audit/audit.log
  18. 18 setenforce permissive
  19. 19 curl http://localhost
  20. 20 setenforce 1
  21. 21 vim /web/index.html
  22. 22 vim /etc/httpd/conf/httpd.conf
  23. 23 systemctl restart httpd
  24. 24 curl http://localhost
  25. 25 grep AVC /var/log/audit/audit.log
  26. 26 setenforce 0
  27. 27 curl http://localhost
  28. 28 grep AVC /var/log/audit/audit.log
  29. 29 git clone https://github.com/sandervanvugt/luth
  30. 30 git clone https://github.com/sandervanvugt/selinux
  31. 31 cd luth
  32. 32 ./countdown 15
  33. 33 cd ..
  34. 34 git clone https://github.com/SELinuxProject/refpolicy
  35. 35 id -Z
  36. 36 sestatus
  37. 37 ps Zaux | grep http
  38. 38 ls -lZ /var/www
  39. 39 ls -dZ /web
  40. 40 grep AVC /var/log/audit/audit.log
  41. 41 man semanage
  42. 42 man semanage-fcontext
  43. 43 semanage fcontext -a -t httpd_sys_content_t "/web(/.*)?"
  44. 44 ls -dZ /web
  45. 45 cd /etc/selinux/
  46. 46 ls
  47. 47 cd targeted/
  48. 48 ls
  49. 49 cd contexts/
  50. 50 ls
  51. 51 cd files/
  52. 52 ls
  53. 53 cat file_contexts.local
  54. 54 restorecon -Rv /web
  55. 55 dnf provides */semanage
  56. 56 vim /etc/httpd/conf/httpd.conf
  57. 57 ps -eZ | grep dbus-daemon
  58. 58 ps Zaux | grep dbus-daemon
  59. 59 semanage fcontext -l
  60. 60 semanage fcontext -l | wc
  61. 61 dnf provides */seinfo
  62. 62 dnf install setools-console -y
  63. 63 seinfo -t
  64. 64 seinfo -t |wc
  65. 65 man -k _selinux
  66. 66 dnf install -y selinux-policy-doc
  67. 67 hisgtory
  68. 68 history
  69. 69 mandb
  70. 70 man -k _selinux
  71. 71 man -k _selinux | wc
  72. 72 man -k _selinux | grep http
  73. 73 man -k _selinux | grep ftp
  74. 74 man ftpd_selinux
  75. 75 getsebool -a
  76. 76 getsebool -a | wc
  77. 77 getsebool -a | grep http
  78. 78 setsebool -P httpd_use_nfs on
  79. 79 getsebool -a | grep http
  80. 80 semanage boolean -l | grep http
  81. 81 dnf install -y vsftpd
  82. 82 vim /etc/vsftpd/vsftpd.conf
  83. 83 dnf install -y lftp
  84. 84 systemctl enable --now vsftpd
  85. 85 lftp localhost
  86. 86 cd /var/ftp
  87. 87 chmod 777 pub
  88. 88 cd
  89. 89 lftp localhost
  90. 90 getenforce
  91. 91 setenforce enforcing
  92. 92 lftp localhost
  93. 93 grep AVC /var/log/audit/audit.log | grep ftp
  94. 94 cd /var/ftp
  95. 95 ls -lZ
  96. 96 semanage fcontext -a -t public_content_rw_t "/var/ftp/pub(/.*)?"
  97. 97 restorecon -Rv /var/ftp/pub/
  98. 98 cd pub
  99. 99 ls
  100. 100 cd ..
  101. 101 lftp localhost
  102. 102 grep AVC /var/log/audit/audit.log | grep ftp
  103. 103 grep sealert /var/log/messages
  104. 104 sealert -l 48c48352-9240-4981-86d3-c13bae5e4b2b | less
  105. 105 setsebool -P ftpd_anon_write 1
  106. 106 lftp localhost
  107. 107 cd
  108. 108 cd luth/
  109. 109 ./countdown 12
  110. 110 vim /etc/httpd/conf/httpd.conf
  111. 111 systemctl restart httpd
  112. 112 systemctl status httpd
  113. 113 grep sealert /var/log/messages
  114. 114 sealert -l a917433a-092a-4ba8-9806-d97602702c44
  115. 115 sealert -l a917433a-092a-4ba8-9806-d97602702c44 | less
  116. 116 semanage port -a -t http_port_t -p tcp 82
  117. 117 semanage port -l | grep httpd
  118. 118 semanage port -l | grep http
  119. 119 systemctl restart httpd
  120. 120 systemctl status httpd
  121. 121 grep sealert /var/log/messages
  122. 122 sealert -l 0465a323-81ed-401d-94ca-323708960453
  123. 123 sealert -l 0465a323-81ed-401d-94ca-323708960453 | less
  124. 124 # ausearch -c 'httpd' --raw | audit2allow -M my-httpd
  125. 125 ausearch -c 'httpd' --raw > ../seout.txt
  126. 126 cd ..
  127. 127 less seout.txt
  128. 128 vim seout.txt
  129. 129 cat seout.txt | audit2allow -M my-httpd
  130. 130 ls
  131. 131 vim my-httpd.te
  132. 132 sealert -b
  133. 133 sesearch -b ftpd_anon_write -A
  134. 134 getsebool -a | grep ftp
  135. 135 sesearch -b ftpd_full_access -A
  136. 136 search -b ftpd_anon_write -p read -AC
  137. 137 sesearch -b ftpd_anon_write -p read -AC
  138. 138 sesearch -b ftpd_anon_write -p read -A
  139. 139 sesearch -s httpd_t -t user_home_t -p read -A
  140. 140 sesearch -A | grep httpd_t
  141. 141 ldd $(which ls)
  142. 142 semanage permissive -l
  143. 143 ps Zaux | grep ftp
  144. 144 semanage permissive -d ftpd_t
  145. 145 semanage permissive -a ftpd_t
  146. 146 semanage permissive -l
  147. 147 semanage permissive -d ftpd_t
  148. 148 seinfo -aunconfined_domain_type -x
  149. 149 semodule -l | less
  150. 150 semodule -l
  151. 151 semodule -d zarafa
  152. 152 ls
  153. 153 history | grep git
  154. 154 ls
  155. 155 cd refpolicy/
  156. 156 ls
  157. 157 cd policy/
  158. 158 ls
  159. 159 cd modules/
  160. 160 ls
  161. 161 cd services/
  162. 162 ls
  163. 163 vim sysstat.te
  164. 164 pwd
  165. 165 cd
  166. 166 cd luth/
  167. 167 ./countdown 15
  168. 168 cd ../r
  169. 169 cd ..
  170. 170 ls
  171. 171 cd refpolicy/policy/modules/roles/
  172. 172 ls
  173. 173 vim unprivuser.te
  174. 174 seinfo -c
  175. 175 seinfo -cipx_socket -x
  176. 176 seinfo -csocket -x
  177. 177 seinfo -cfile -x
  178. 178 cd
  179. 179 vim sander.te
  180. 180 vim sander.fc
  181. 181 checkmodule -M -m -o sander.mod sander.te
  182. 182 ls sander*
  183. 183 type sander.mod
  184. 184 file sander.mopd
  185. 185 file sander.mod
  186. 186 semodule_package -o sander.pp -m sander.mod -f sander.fc
  187. 187 semodule -i sander.pp
  188. 188 mkdir /opt/sander
  189. 189 ls -ldZ /opt/sander
  190. 190 restorecon -Rv /opt/sander
  191. 191 semanage user -l
  192. 192 ps Zaux
  193. 193 history
  194. 194 seinfo -aselinux_unconfined_type -x
  195. 195 semanage user -l
  196. 196 selinux login -l
  197. 197 semanage login -l
  198. 198 useradd linda
  199. 199 echo password | passwd --stdin linda
  200. 200 useradd -Z sysadm_u -G wheel lisa
  201. 201 semanage login -a -s user_u linda
  202. 202 semanage login -l
  203. 203 ssh linda@localhost
  204. 204 id -Z
  205. 205 grep AVC /var/log/audit/audit.log
  206. 206 journalctl | grep semanage
  207. 207 grep sealert /var/log/messages
  208. 208 sealert -l 70315399-3287-4a85-a35a-45538b4e7130 | less
  209. 209 semanage login -l
  210. 210 semanage login -a -s sysadm_u root
  211. 211 semanage login -l
  212. 212 semanage login -m -s sysadm_u root
  213. 213 semanage login -l
  214. 214 semanage login -m -s user_u -r s0 __default__
  215. 215 semanage login -l
  216. 216 useradd anna
  217. 217 echo password | passwd --stdin anna
  218. 218 ssh anna@localhost
  219. 219 getsebool -a | grep user
  220. 220 getsebool -a | grep sysadm
  221. 221 ssh root@localhost
  222. 222 history
  223. 223 #### dont do this at home #### semanage login -m -s user_u root
  224. 224 sleep 20; luth/countdown 12
  225. 225 seinfo -t public_content_t -x
  226. 226 cd /usr/share/doc/selinux-policy/
  227. 227 ls
  228. 228 vim example.te
  229. 229 vim example.if
  230. 230 vim example.fc
  231. 231 make -f /usr/share/selinux/devel/Makefile myapp.pp
  232. 232 cd /usr/share/selinux/devel/
  233. 233 ls
  234. 234 cd include/
  235. 235 ls
  236. 236 pwd
  237. 237 cd
  238. 238 cd selinux/
  239. 239 ls
  240. 240 vim setup-rot.sh
  241. 241 ls
  242. 242 cat rot13.service
  243. 243 cat server.php
  244. 244 ./setup-rot.sh
  245. 245 dnf provides */sepolgen
  246. 246 dnf install -y policycoreutils-devel
  247. 247 sepolgen --application startrot13
  248. 248 vim startrot13.te
  249. 249 vim startrot13.te
  250. 250 vim startrot13.sh
  251. 251 ls
  252. 252 ./startrot13.sh
  253. 253 ls
  254. 254 semodule -i startrot13.pp
  255. 255 man startrot13_selinux
  256. 256 seinfo -t | grep start
  257. 257 dnf provides */rpmbuild
  258. 258 dnf install -y rpm-build
  259. 259 ./startrot13.sh
  260. 260 runcon -u system_u -r system_r -t httpd_t vsftpd
  261. 261 grep sealert /var/log/messages
  262. 262 sealert -l a6209df7-00df-4db0-b575-adff66fe34f9 | less
  263. 263 # ausearch -c 'runcon' --raw | audit2allow -M my-runcon
  264. 264 # semodule -X 300 -i my-runcon.pp
  265. 265 # ausearch -c 'runcon' --raw | audit2allow -M my-runcon
  266. 266 ausearch -c 'runcon' --raw | audit2allow -M my-runcon
  267. 267 semodule -X 300 -i my-runcon.pp
  268. 268 runcon -u system_u -r system_r -t httpd_t vsftpd
  269. 269 history
  270. 270 history | grep root
  271. 271 semanage login -m -s user_u root
  272. 272 id -Z
  273. 273 history
  274.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement