Upgrade to Pro — share decks privately, control downloads, hide ads and more …

ホスティングにおける fuse の利用

harasou
March 22, 2019
170

ホスティングにおける fuse の利用

harasou

March 22, 2019
Tweet

Transcript

  1. GVTFCJOEFY४උ # ls -l /opt/bindex/ /var/lib/bindex/ /opt/bindex/: total 4 -rw-r--r--

    1 root root 18 Mar 21 19:52 now /var/lib/bindex/: total 0 # # bindexd /opt/bindex/ /var/lib/bindex/ # # ls -l /opt/bindex/ /var/lib/bindex/ /opt/bindex/: total 4 -rw-r--r-- 1 root root 18 Mar 21 19:52 now /var/lib/bindex/: total 4 -rw-r--r-- 1 root root 18 Mar 21 19:52 now wCJOENPVOUͷ༷ʹ
 ʮϚ΢ϯτݩʢ/opt/bindexʣʯͱ
 ʮϚ΢ϯτઌʢ/var/lib/bindexʣʯΛ ༻ҙ͠CJOEFYEΛ࣮ߦ wϚ΢ϯτઌʢ/var/lib/bindexʣʹ΋
 Ϛ΢ϯτݩͱಉ͡ϑΝΠϧ͕ݟ͑Δ
  2. GVTFCJOEFY࣮ߦྫ # cat /opt/bindex/now #!/bin/bash date # # cat /var/lib/bindex/now

    #!/bin/bash date wϚ΢ϯτݩʢ/opt/bindexʣʹ͋Δ ϑΝΠϧ͸ɺϚ΢ϯτઌʢ/var/lib/ bindexʣͰ΋ಉ༷͡ʹݟ͑Δ
 wϚ΢ϯτݩʢ/opt/bindexʣͷϑΝΠ ϧ͕ʮ࣮ߦϑΝΠϧʯͩͬͨ৔߹ɺ
 Ϛ΢ϯτઌͰͦͷϑΝΠϧΛPQFO SFBEʢDBUʣ͢Δͱɺ
 ࣮ߦϑΝΠϧΛFYFDWFͨ݁͠Ռʢඪ ४ग़ྗɾඪ४Τϥʔग़ྗʣ͕ฦΔ # chmod +x /opt/bindex/now # # cat /var/lib/bindex/now Thu Mar 21 20:02:01 UTC 2019 # # cat /var/lib/bindex/now Thu Mar 21 20:02:07 UTC 2019
  3. GVTFCJOEFY࣮૷ PQFOTZTUFNDBMM int bindex_open(const char *path, struct fuse_file_info *fi) {

    : if (should_execute(&buf)) { : if ((fd = mkonetimefd()) == -1) { return -errno; } if ((pid = fork()) < 0) { return -errno; } /* child */ if (pid == 0) { dup2(fd, 1); dup2(fd, 2); argv[0] = (char *)real_path; argv[1] = NULL; execve(real_path, argv, environ);  ࣮ߦϑΝΠϧ͔൑ఆ  ςϯϙϥϦϑΝΠϧΛ࡞ ੒ɻʢ࡞੒ͱಉ࣌ʹ VOMJOLʣ  ࢠϓϩηεΛੜ੒ͯ͠ɺ  ඪ४ग़ྗɾඪ४Τϥʔग़ ྗΛςϯϙϥϦϑΝΠϧ ʹ޲͚Δ  ࣮ߦϑΝΠϧΛ࣮ߦͯ͠  ͋ͱ͸ɺPQFOͨ͠ϓϩη ε͕ɺςϯϙϥϦϑΝΠ ϧͷGEܦ༝ͰSFBE ʢCJOEFY@SFBEʣ