README 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. Copyright © 2020 Maxime Devos <maxime.devos@student.kuleuven.be>
  2. This file is part of rehash.
  3. rehash is free software; you can redistribute it and/or modify it
  4. under the terms of the GNU General Public License as published by
  5. the Free Software Foundation; either version 3 of the License, or (at
  6. your option) any later version.
  7. rehash is distributed in the hope that it will be useful, but
  8. WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with rehash. If not, see <http://www.gnu.org/licenses/>.
  13. * What is rehash?
  14. rehash is a GNUnet service for mapping a hash of one type o
  15. a corresponding hash of another via the DHT. A program
  16. can insert hash->hash mappings into the rehash service,
  17. which then are stored locally and pushed onto the network.
  18. Another program, possibly on another peer, could then look
  19. up a hash by one type and find a hash of another.
  20. TODO: implement content pushing
  21. * How to use?
  22. The following components are planned:
  23. - a C implementation
  24. - a Scheme binding to the C implementation
  25. - a nice guile-fibers binding to the former
  26. - a REST API
  27. (should be less problematic to include in Guix
  28. than depending on GNUnet)
  29. - a web demo
  30. * Limitations
  31. Any hash->hash mappings found in this manner can of course
  32. not be guaranteed to be correct (^), so don't forget to verify
  33. the found mapping, and if it turns out to be incorrect,
  34. don't forget to tell that to the rehash service, to prevent
  35. further propagation of bad mappings.
  36. TODO: implement this
  37. (^) An evil peer could spam incorrect hash->hash mappings.
  38. * Limitations to limitations
  39. TODO locally delete old mappings if a good mapping becomes known.
  40. TODO work out the mathematics on how effective an attacker could be
  41. TODO work out countermeasures
  42. I don't think evil peers will be a large-scale problem in practice
  43. (what would be the point?), although targeted denial-of-service by
  44. spamming attacks would be possible I guess.
  45. * For what would this be useful?
  46. This service was written for use in guix-gnunet, an experimental
  47. fork of guix for integrating GNUnet in Guix. More specifically, for
  48. finding substitutes over GNUnet (including sources, which usually are
  49. fixed-output derivations).
  50. In the case of sources (or more technically correct, any fixed-output
  51. derivation), its nix (?) hash is known, but this hash isn't directly
  52. useful for downloading the source over the GNUnet file-sharing system,
  53. which has its own directory format and (presumably? (*)) splits
  54. (large) files in some tree structure and hashes this tree recursively
  55. (or something (*)). The rehash service allows for converting
  56. between hash types (for some value of unreliable).
  57. In case of variable-output derivations, some authorised substitute
  58. server still needs to publish signed narinfos. The local Guix
  59. could then try to ‘convert’ the nix (?) hash in the narinfo to an
  60. appropriate GNUnet hash, and try to download the substitute over
  61. GNUnet.
  62. (*) TODO verify with the ECRS paper.
  63. * A path not taken: embedding the GNUnet hash in the narinfo
  64. This is what the wip-ipfs-substitutes patch does (*2). However,
  65. GNUnet isn't quite stable yet (but it's getting better,
  66. for some protocols informational RFCs are written / have been
  67. written / have received feedback / etc.), so it seems unreasonable
  68. for the upstream substitute servers to include GNUnet hashes
  69. anytime soon.
  70. If GNUnet (or at least its file-sharing protocols) is stable enough,
  71. this will probably be implemented, to avoid bad mappings.
  72. (Note: generating GNUnet hashes doesn't quite require the full
  73. stack, and could be done fully in Scheme without too much trouble.
  74. See (*3) for a suspended work-in-progress.)
  75. (*2) https://issues.guix.gnu.org/33899
  76. (*3) https://notabug.org/mdevos/scheme-gnunet
  77. * Another path not taken: embedding the GNUnet hash in the origin specification
  78. Advantage: no incorrect hashes
  79. Disadvantage: all origins would need to be updated, not very useful
  80. for variable-output derivations (e.g. packages), whose inputs can change.
  81. This may still be implemented if GNUnet becomes stable and popular enough,
  82. but its applicability is limited.