16-i2p_config 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. #!/bin/sh
  2. set -e
  3. echo "Configuring I2P"
  4. I2P="/usr/share/i2p"
  5. I2PROUTER="/usr/bin/i2prouter"
  6. WRAPPER="/etc/i2p/wrapper.config"
  7. # This must be set in order for the i2p init script to work
  8. sed -i 's/^RUN_DAEMON=.*$/RUN_DAEMON="true"/' /etc/default/i2p
  9. # Remove the "i2prouter" script, its man page, and its apparmor profile
  10. # since these are not used by Tails:
  11. rm /etc/apparmor.d/usr.bin.i2prouter /usr/share/man/man1/i2prouter.1.gz
  12. # Install custom i2prouter stub scripts
  13. for script in ${I2PROUTER} ${I2PROUTER}-nowrapper; do
  14. echo "Removing $script"
  15. dpkg-divert --rename --add "${script}"
  16. cat > "$script" << EOF
  17. #!/bin/sh
  18. echo "This script is not used by Tails."
  19. echo "See https://tails.boum.org/doc/anonymous_internet/i2p/ for more information."
  20. exit 0
  21. EOF
  22. chmod 755 "$script"
  23. done
  24. # Remove the outproxy from the tunnel on port 4444
  25. # This will remove the following lines:
  26. # tunnel.0.proxyList=false.i2p
  27. # tunnel.0.option.i2ptunnel.httpclient.SSLOutproxies=false.i2p
  28. # The SSLOutproxies option was first set in I2P 0.9.15
  29. sed -i '/^.*tunnel\.0\.\(proxyList\|option\.i2ptunnel\.httpclient\.SSLOutproxies\)/d' "$I2P/i2ptunnel.config"
  30. # Disable the https outproxy (port 4445)
  31. sed -i 's|^.*\(tunnel\.6\.startOnLoad\).*|\1=false|' "$I2P/i2ptunnel.config"
  32. # Don't serve the router console on IPv6
  33. sed -i 's|^clientApp\.0\.args=7657\s\+::1,127\.0\.0\.1|clientApp.0.args=7657 127.0.0.1|' "$I2P/clients.config"
  34. # Disable IPv6 in the wrapper
  35. sed -i 's|^.*\(wrapper\.java\.additional\.5=-Djava\.net\.preferIPv4Stack=\).*|\1true|' "$WRAPPER"
  36. sed -i 's|^.*\(wrapper\.java\.additional\.6=-Djava\.net\.preferIPv6Addresses=\).*|\1false|' "$WRAPPER"
  37. # Tails specific router configs:
  38. # * i2cp: allows java clients to communicate with I2P outside of the JVM. Disabled.
  39. # * IPv6: Disabled
  40. # * HiddenMode: Enabled
  41. # * In-I2P Network Updates: Disabled
  42. # * Inbound connections: Disabled (setting is "i2cp.ntcp.autoip")
  43. # * Disable I2P plugins
  44. # * Disable NTP
  45. cat > "$I2P/router.config" << EOF
  46. # NOTE: This I2P config file must use UTF-8 encoding
  47. i2cp.disableInterface=true
  48. i2np.ntcp.ipv6=false
  49. i2np.ntcp.autoip=false
  50. i2np.udp.ipv6=false
  51. router.isHidden=true
  52. router.updateDisabled=true
  53. router.enablePlugins=false
  54. time.disabled=true
  55. EOF
  56. cat > "$I2P/susimail.config" << EOF
  57. susimail.pop3.leave.on.server=true
  58. EOF
  59. # enforce apparmor
  60. echo Setting the I2P apparmor profile to enforce mode
  61. sed -i -re 's|flags=\(complain\)||' /etc/apparmor.d/system_i2p