ITСooky

IT-рецепты съедобные и не очень!

i2p на шлюзе FreeBSD

дата 11.10.2011

КСТАТИ: i2pна FreeBSD через 3 года ставить гораздо легче

i2p — это сеть в сети интернет которая шифруется от всех всё, то есть это обычные сайты но ни владельцы сайтов не знают кто к ним заходит, ни клиенты не знают к кому конкретно обращаются за контентом, их интернет провайдеры конечно видят активность но тоже не знает кто к кому за чем, только браузер на локальному ПК точно знает адрес захода — но он ник чему не привязан! В i2p нет DNS, доменов и IP — адрес выглядит
так

forum.i2p 

это красивый адрес но быстрее сайт откроется по такому

33pebl3dijgihcdxxuxm27m3m4rgldi5didiqmjqjtg4q6fla6ya.b32.i2p 

Технологию разработали немцы, но на Java поэтому придется её ставит странным способом. Но не анонимность меня привлекала(её кстати разработчики не гарантируют на все 100%), а возможность создания сайта в этой сети без привязки к домену айпи и хостингу, то есть бесплатный, ну только за интернет домашний надо платить конечно же. В обычном интернете чем больше посетителей на сайте тем он хуже работает а здесь всё наоборот!!! Соответственно чем дольше вы находитесь в сети, чем популярнее ресурс тем он быстрее работает — поэтому выгодно поставить i2p на шлюз и забыть о его существовании не отключаясь от сети i2p никогда! Да и трафик у вас должен быть бесплатный это же всё таки p2p!

Большую рекламу сети i2p сделал перенос в неё одного сайта с базами(которые продаются на любом рынке у метро), в начале все думали что его наконец-то закрыли, ан нет он сам ушел. Разработчики i2p этому очень рады, несмотря на некоторые проблемы — количество пиров выросло до небывалых размеров, вот они пишут(даже русский выучили): Сердечно приветствую наших новых русскоязычных пользователей! (A warm welcome to our new Russian users!) Due to ruslеаks we’ve recently been experiencing a massive influx of many new routers. We have now hit the mark of 10,000 and later even the one of 12,000 active routers. This is currently making the ride a bit bumpy, but all is fine. This means a growth of the network, which comes accompanied by some growing pains, but it’s nothing to worry about. Generally, growth is good for the network and good for your anonymity. So if you are having problems accessing some services, be patient. Not all eepsites are currently reachable on first attempt, but we hope that will level out soon. So again, be patient, don’t leave straight away, and stay tuned for the soon-to-come I2P router update!

Ингредиенты:
1. FreeBSD сервер подготовленный по рецепту Создаем шлюз на FreeBSD и Wi-Fi точку доступа!
2. Putty

Устанавливаем
Для начала обновляем коллекцию портов, это поможет избежать некоторых проблем с версиями

portsnap fetch extract && portsnap fetch update

Идем в коллекцию портов

cd /usr/ports/net-p2p/i2p
make

Много чего предлагает на все соглашаемся, ничего отдельно не отмечаем!
В какой то момент подготовка обрывается потому что из-за каких то лицензионных соглашений надо установить в ручную JDK и для неё потребуется 2.5 Gb места! Сразу качаем всё что потребуется, версии могут отличаться — следите за своими системными сообщениями!

Идем в папку.

cd /usr/ports/distfiles

И качаем то что попросили, файлы большие!

fetch http://www.java.net/download/jdk6/6u3/promoted/b05/jdk-6u3-fcs-src-b05-jrl-24_sep_2007.jar
fetch http://www.java.net/download/jdk6/6u3/promoted/b05/jdk-6u3-fcs-bin-b05-jrl-24_sep_2007.jar
fetch http://www.java.net/download/jdk6/6u3/promoted/b05/jdk-6u3-fcs-mozilla_headers-b05-unix-24_sep_2007.jar   

И еще файлы которые надо скачать по кривым ссылкам

bsd-jdk16-patches-4.tar.bz2

http://www.eyesbeyond.com/freebsddom/java/jdk16.html

tzupdater-1_3_40-2011h.zip

http://www.oracle.com/technetwork/java/javase/downloads/tzupdater-1-3-39-download-402444.html

diablo-caffe-freebsd7-i386-1.6.0_07-b02.tar.bz2

http://www.freebsdfoundation.org/cgi-bin/download?download=diablo-caffe-freebsd7-i386-1.6.0_07-b02.tar.bz2

Кладем их тоже в /usr/ports/distfiles опять делаем

cd /usr/ports/net-p2p/i2p
make

Появится лицензионное соглашение его надо докрутить до конца и набрать yes!
Опять прерывается причина

Found libtool-2.2.6a_1, but you need to upgrade to libtool>=2.4

Идем в

cd /usr/ports/devel/libtool
make
make install

Устанавливается как раз 2.4 версия. Опять возвращаемся.

cd /usr/ports/net-p2p/i2p
make

Опять прерывается причина

Requested 'x11 >= 1.2.99.1' but version of X11 is 1.2.1
Requested 'xext >= 1.0.99.1' but version of Xext is 1.0.5
Requested 'inputproto >= 1.9.99.902' but version of InputProto is 1.5.0

У меня основная часть системы устанавливалась давно так что придется обновить многое, вам это может не потребуется!

cd /usr/ports/x11/xproto
make deinstall && make deinstall
make install
cd /usr/ports/x11/xextproto
make deinstall && make deinstall
make install
cd /usr/ports/x11/libXext
make deinstall
make install
cd /usr/ports/x11/inputproto
make deinstall
make install
cd /usr/ports/x11/fixesproto
make deinstall
make install
cd /usr/ports/devel/xorg-macros
make deinstall
make install
cd /usr/ports/x11/xorg
make deinstall
make install
cd /usr/ports/x11
make deinstall
make install
ошибка
cd /usr/ports/x11/libxcb/
make clean install
cd /usr/ports/x11
make install
ошибка
cd /usr/ports/graphics/libGLU
make install
cd /usr/ports/x11
make clean install

Честно говоря система еще что-то просила обновить, но я послал её в dev/null и вернулся к установке i2p и о чудо она завершилась успешно!

cd /usr/ports/net-p2p/i2p
make clean install

В rc.conf добавляем

i2p_enable="YES"
i2p_user="i2p"

Добавляем пользователя с каким нибудь паролем(запомните его) под именем i2p

adduser

Заходим по SSH(PUtty) на наш сервер от этого пользователя и делаем
i2p#

 /usr/local/sbin/i2prouter install

В папке пользователя i2p появляются файлы настроек
i2p#

 cd  /home/i2p/i2p

По какой-то причине в настройках нет ссылок на наши папки их надо добавить в ручную
i2p#

 vi i2prouter

добавляем

%INSTALL_PATH - /home/i2p/i2p
%SYSTEM_java_io_tmpdir /tmp

В файле wrapper.config тоже проверяем пути чтобы были на /home/i2p/i2p
i2p#

 vi wrapper.config

Не помню что я еще менял но вот мой конфиг(в некоторых случаях помогает вставить его как есть весь)

#********************************************************************
# Wrapper Properties
#
# WARNING - for any changes to take effect, you must completely
# stop the router and the wrapper. Clicking 'Restart' on your
# router console will NOT reread this file! You must
# click "Shutdown", wait 11 minutes, then start i2p.
#
# WARNING - The wrapper is NOT run (and this file is not used)
# if you start I2P with the 'no window' icon on Windows, or
# with the runplain.sh script on Linux. Use the 'restartable'
# icon on Windows or the i2prouter script on Linux to run the wrapper.
#
# NOTE - Directory organization:
# The standard I2P Installation will set up a "split" directory structure
# with code in the install directory, data and configuration files in the
# user's home directory, and temporary files in the system temporary directory.
# To set up a single-directory "portable" installation suitable for
# a USB stick, make several changes specified below (search for PORTABLE).
#
# NOTE - The izpack installer performs variable subsitiution on this
# file upon installation. If you did not use izpack, you must
# find and replace all instances of (dollar)INSTALL_PATH and
# (dollar)SYSTEM_java_io_tmpdir with appropriate values
# (perhaps . and /var/tmp, respectively)
#
#********************************************************************
# Java Application
wrapper.java.command=java

# Java Main class.  This class must implement the WrapperListener interface
#  or guarantee that the WrapperManager class is initialized.  Helper
#  classes are provided to do this for you.  See the Integration section
#  of the documentation for details.
wrapper.java.mainclass=org.tanukisoftware.wrapper.WrapperSimpleApp

# Java Classpath (include wrapper.jar)  Add class path elements as
#  needed starting from 1
#
# Doing it this way means we can add new apps without asking people
# to update their wrapper.config.
# The downside is that we lose control over classpath order,
# This is fine for new installs (where the uninstall jars
# copy.jar, delete.jar, and exec.jar containing duplicate FileUtil
# classes, or all the classes of i2p.jar, are in a different directory).
# Be sure there are no other duplicate classes.
#
wrapper.java.classpath.1=/home/i2p/i2p/lib/*.jar
#  uncomment this to use the system classpath as well (e.g. to get tools.jar)
# wrapper.java.classpath.2=%CLASSPATH%

# Java Library Path (location of Wrapper.DLL or libwrapper.so)
wrapper.java.library.path.1=/home/i2p/i2p
wrapper.java.library.path.2=/home/i2p/i2p/lib

# Java Additional Parameters
# Numbers must be consecutive (except for stripquotes)
wrapper.java.additional.1=-DloggerFilenameOverride=logs/log-router-@.txt
wrapper.java.additional.2=-Dorg.mortbay.http.Version.paranoid=true
wrapper.java.additional.3=-Dorg.mortbay.xml.XmlParser.NotValidating=true
wrapper.java.additional.4=-Di2p.dir.base="/home/i2p/i2p"
wrapper.java.additional.4.stripquotes=TRUE

# On some IPv6 enabled systems, I2P and other network-enabled java applications
# may fail to start. For examples see
# http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=560044. 
# Two things that may help if you experience this issue
# 1) "echo 0 > /proc/sys/net/ipv6/bindv6only" as root; or
# 2) uncomment the next two lines:
#wrapper.java.additional.5=-Djava.net.preferIPv4Stack=true
#wrapper.java.additional.6=-Djava.net.preferIPv6Addresses=false

# Jetty says this is a security risk
# Uncommenting this won't help as the router forces it to true
# If you really need this, you have to set it in jetty.xml
# somehow - not sure exactly but here's a clue:
# org.mortbay.util.FileResource.setCheckAliases(false)
# wrapper.java.additional.7=-Dorg.mortbay.util.FileResource.checkAliases=false
# PORTABLE installation:
# uncomment the following
#wrapper.java.additional.7=-Di2p.dir.pid="$INSTALL_PATH"
#wrapper.java.additional.7.stripquotes=TRUE
#wrapper.java.additional.8=-Di2p.dir.temp="$INSTALL_PATH"
#wrapper.java.additional.8.stripquotes=TRUE
#wrapper.java.additional.9=-Di2p.dir.config="$INSTALL_PATH"
#wrapper.java.additional.9.stripquotes=TRUE
#
# Uncomment this for better performance.
# If it doesn't work, server mode is not available in your JVM.
# This may not be required if your machine is already "server-class".
# See http://java.sun.com/j2se/1.5.0/docs/guide/vm/server-class.html
#wrapper.java.additional.7=-server

# Initial Java Heap Size (in MB)
#wrapper.java.initmemory=4

# Maximum Java Heap Size (in MB)
# The JVM's default is 64MB, and I2P can work fine in that, but to handle
# lots of I2PSnark activity in the same JVM, increasing the default max heap
# size should help.  Feel free to reduce this if not using I2PSnark in the jvm
# High-bandwidth routers may need to increase to 256 or more.
#
# WARNING - for any changes to take effect, you must completely
# stop the router and the wrapper. Clicking 'Restart' on your
# router console will NOT reread this file! You must
# click "Shutdown", wait 11 minutes, then start i2p.
#
wrapper.java.maxmemory=128

# Application parameters.  Add parameters as needed starting from 1
wrapper.app.parameter.1=net.i2p.router.Router

#********************************************************************
# Wrapper Logging Properties
#********************************************************************
# Format of output for the console.  (See docs for formats)
wrapper.console.format=PM

# Log Level for console output.  (See docs for log levels)
wrapper.console.loglevel=INFO

# Log file to use for wrapper output logging.
# You may wish to change this on linux so the log is
# preserved across OS restarts.
# If you do change it, add the following line above to
# tell the router where to find the wrapper log
# (change X to the next available number)
# wrapper.java.additional.X=-Dwrapper.logfile=/path/to/wrapper.log
wrapper.logfile=/home/i2p/i2p/wrapper.log
# PORTABLE installation:
# Use the following instead. I2P will find the logfile here,
# no need for a wrapper.java.additional line too.
#wrapper.logfile=$INSTALL_PATH/wrapper.log

# Format of output for the log file.
# The format consists of the tokens 'L' for log level, 'P' for prefix, 'D' for thread,
# 'T' for time, 'Z' for millisecond time, and 'M' for message
# Unfortunately the log timezone cannot be changed, see
# http://www.nabble.com/Log-message-timezone-td23651317.html
wrapper.logfile.format=TM

# Log Level for log file output.  (See docs for log levels)
wrapper.logfile.loglevel=INFO

# Maximum size that the log file will be allowed to grow to before
#  the log is rolled. Size is specified in bytes.  The default value
#  of 0, disables log rolling.  May abbreviate with the 'k' (kb) or
#  'm' (mb) suffix.  For example: 10m = 10 megabytes.
wrapper.logfile.maxsize=1m

# Maximum number of rolled log files which will be allowed before old
#  files are deleted.  The default value of 0 implies no limit.
wrapper.logfile.maxfiles=2

# Log Level for sys/event log output.  (See docs for log levels)
wrapper.syslog.loglevel=NONE

# choose what to do if the JVM kills itself based on the exit code
wrapper.on_exit.default=SHUTDOWN
wrapper.on_exit.0=SHUTDOWN
wrapper.on_exit.1=SHUTDOWN
# OOM
wrapper.on_exit.10=RESTART
# graceful shutdown
wrapper.on_exit.2=SHUTDOWN
# hard shutdown
wrapper.on_exit.3=SHUTDOWN
# hard restart
wrapper.on_exit.4=RESTART
# hard restart
wrapper.on_exit.5=RESTART

# the router may take a few seconds to save state, etc
wrapper.jvm_exit.timeout=30

# give the OS 60s to clear all the old sockets / etc before restarting
# Let's change the default from 60 to 15 seconds and see if anyone moans..
wrapper.restart.delay=15

wrapper.ping.interval=300
# The ping timeout must be at least 5 seconds longer than the value of wrapper.ping.interval.
# Extend this if you are getting 'JVM appears hung' shutdowns.
wrapper.ping.timeout=320

# use the wrapper's internal timer thread.  otherwise this would 
# force a restart of the router during daylight savings time as well
# as any time that the OS clock changes
wrapper.use_system_time=false

# pid file for the JVM
# If you plan to have multiple wrappers running on the same machine,
# you should copy this file, change the location or file name,
# and edit the i2prouter script to change the WRAPPER_CONF setting
# to point to the new wrapper.config location.
wrapper.java.pidfile=/tmp/routerjvm.pid
# PORTABLE installation:
# Use the following instead.
#wrapper.java.pidfile=$INSTALL_PATH/routerjvm.pid
# pid file for the service monitoring the JVM
#
# From i2prouter:
#
#     PIDDIR="."
#     APP_NAME="i2p"
#     PIDFILE="$PIDDIR/$APP_NAME.pid"
#
# This means i2prouter looks for './i2p.pid'.
# See comments above for wrapper.java.pidfile
wrapper.pidfile=/tmp/i2p.pid
# PORTABLE installation:
# Use the following instead.
#wrapper.pidfile=$INSTALL_PATH/i2p.pid

#********************************************************************
# Wrapper NT Service Properties
#********************************************************************
# WARNING - Do not modify any of these properties when an application
#  using this configuration file has been installed as a service.
#  Please uninstall the service before modifying this section.  The
#  service can then be reinstalled.

# Name of the service
wrapper.ntservice.name=i2p

# Display name of the service
wrapper.ntservice.displayname=I2P Service

# Description of the service
wrapper.ntservice.description=The I2P router service

# Service dependencies.  Add dependencies as needed starting from 1
wrapper.ntservice.dependency.1=

# Mode in which the service is installed.  AUTO_START or DEMAND_START
wrapper.ntservice.starttype=AUTO_START

# Allow the service to interact with the desktop.
wrapper.ntservice.interactive=false

Меняем адрес 127.0.0.1 на адрес нашего сервера в файлах
i2p#

 clients.config

i2p#

 i2ptunnel.config

Опят пытаемся запустить i2p (под пользователем i2p)если проблема все еще в папке он ругнется так

If you accidentally end up inside vi, you can quit it by pressing Escape, colon
(:), q (q), bang (!) and pressing return.
i2p start
To access i2p:
Point your browser at http://localhost:7657/ to access configuration
Point your browser proxy at http://localhost:4444/ to access i2p network
Unable to locate i2psvc in %INSTALL_PATH!
The most likely reason is that a supported version of the java
wrapper is not available in the I2P installation package for your
platform. It may be possible to manually download and install
a compatible wrapper for your system.
See http://www.i2p2.de/manualwrapper for hints.
In the meantime, you may start I2P by running the script
%INSTALL_PATH/runplain.sh

Если он так уже не ругеатся это хорошо, но он точно еще ругнется на отсутствие misc/compat6x надо установить!
Возвращаемся под рутом и делаем

cd /usr/ports/misc/compat6x
make install

Возвращаемся под i2p
i2p#

 /usr/local/sbin/i2prouter start

Уже не ругается

Point your browser at http://localhost:7657/ to access configuration
Point your browser proxy at http://localhost:4444/ to access i2p network
Starting I2P Service...done.

Смотрим начал ли слушать i2p порты
i2p#

 sockstat -4l | grep i2p

После удачного старта все настройки перемещаются в папку /home/i2p/.i2p теперь всё надо править там и перегружаться чтобы вступило в силу!

По нашим настройкам кансоль i2p должна быть по адресу 192.168.1.107 (внешний ip нашего сервера) на порту 7657 шлюз нас пока просто не пустить сюда, открываем!
Добавляем в rc.firewall

vi /etc/rc.firewall

строку в разделе разращенных поротов

${FwCMD} add allow tcp from any to ${ipout} 7657 in via ${lanin} setup

Перезагружаем ipfw

/etc/rc.d/ipfw restart

Заходим с браузера с любого ПК который у нас в сети Wi-Fi, должна быть вот такая идеальная картинка (у вас её пока не будет)!
318331574063

Ставим на web-интервейс консоли i2p пароль. Для этого в настройках

Настройки I2P > Расширенные > Дополнительные настройки I2P

или если такого пукнкта в меню уже нет
пишем в
vi /home/i2p/.i2p/router.config

добавляем строку

consolePassword=parolll

Жмем Сохранить настройки и Перезапустить в меню — теперь вход защищен, пользователь admin(не меняется) пароль parolll.

В разделе общей информации где сейчас написано «Сеть: ОК» будет ругаться:
На время

ОШИБКА - Часы сбиты на столько-то

Правим время на правильное

date 201110101515

2011 год 10 месяц 10 день 15 час 15 минута
Находим кнопку перезагрузить в веб интерфейсе и перезагружаем i2p это займет минуты 3 в это время веб интерфейс доступен не будут!

На порты

ОШИБКА - UDP отключено и не заданы адрес/порт для входящих TCP-соединений

Идем во вкладку

Настройки I2P

там меняем UDP порт 29205 на любой другой(это ооочень важно, и никому не говорите об этих портах) лучше чтобы он был от 30000 до 64000, так же добавляем порт для TCP они могут совпадать! Заодно меняем настройки скорости до приемлемых значений!
Приводим к виду
I2Pconsole

Пока i2p рано перезагружать надо, открыть эти порты на нашем сервере и на устройстве доступа в интернет!

Добавляем в rc.firewall

vi /etc/rc.firewall

vi /home/i2p/.i2p/router.config
строку в разделе разращенных поротов

${FwCMD} add allow tcp from any to any 29205 via ${lanout}
${FwCMD} add allow udp from any to any 29205 via ${lanout}

Перезагружаем ipfw

/etc/rc.d/ipfw reload

Заходим по веб интерфейсу на ваш модем обычно там есть возможность настроить Port Forwarding!
Для начала добавляем нового

Lan Client

router_adsl1
В

Port Forwarding

добавляем новое правило
router_adsl2
В Port Forwarding добавляем это правило новому Lan CLient’у
router_adsl3
В

Tools>Systems Commands

сохраняем настройки и перезагружаем модем

Из настроек i2p ивдно что прокси для доступа к сайтам i2p у нас на 192.168.1.107 порт 4444 надо его открыть на нашем шлюзе

Добавляем в rc.firewall

vi /etc/rc.firewall

строку в разделе разращенных поротов

${FwCMD} add allow tcp from any to ${ipout} 4444 in via ${lanin} setup

Перезагружаем ipfw

/etc/rc.d/ipfw reload

В веб-интерфейсе i2p надо добавить источники адресов идем в

Адресная Книга > Подписки

добавляем:

http://i2host.i2p/cgi-bin/i2hostetag
http://stats.i2p/cgi-bin/newhosts.txt
http://tino.i2p/hosts.txt
http://dream.i2p/hosts.txt
http://hosts.i2p/
http://hosts.i2p/hosts.cgi?filter=all
http://bl.i2p/hosts2.txt
http://rus.i2p/hosts.txt

Жмем сохранить и перезагрузить, и перезагружаем из веб-интерфейса i2p!

В нашем браузере FireFox добавляем дополнение FoxyProxy — вот по этой ссылке foxyproxy-standard нажимаем добавить в FireFox
Справа от адресной строки появится мордочка лисенка, жмем и настраиваем следующим образом!
foxyproxy4
Добавляем правило для i2p
foxyproxy1
foxyproxy2
foxyproxy3
Шаблон URL правильней будет писать вот такой

*.i2p/*

В меню FireFox

Инструменты> Foxy Proxy, стандартная версия

выбираем

Использовать прокси основаное на шаблонах

!

Все теперь можно открывать i2p сайты, еще их называют eepsite’s!
Система не все сайты откроет сразу — даже самые основные:
Предупреждение-I2P-неизвестный-I2P-сайт_1318334980407
Но уж если откроет — то откроет!
Русская-I2P-Wiki_1318335237516


Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *