Compare commits
51 Commits
Author | SHA1 | Date | |
---|---|---|---|
7188a28ebd | |||
231c9f07bd | |||
5abecda122 | |||
48ee44606a | |||
5107f25aa5 | |||
6b847ca8b3 | |||
bb7dff6890 | |||
d86a60af37 | |||
6a1365956b | |||
06ebccb4ee | |||
07b4e1fb53 | |||
683dbc85fc | |||
5ecc79b054 | |||
c607bb9fd3 | |||
8e89742f4a | |||
3776c09db5 | |||
0f5a04da1b | |||
0dd22d990a | |||
8c8ba765cd | |||
c7ac947d70 | |||
d6c67830f9 | |||
d6354e2bc2 | |||
8b7ba5a4a5 | |||
ac8a6dbe91 | |||
f33d1592c8 | |||
641eb5dfa4 | |||
694b2a67c0 | |||
ca2fd4873a | |||
4f39a50ce6 | |||
2f067908ba | |||
2a286e1383 | |||
65a150c5b2 | |||
d9efd86c21 | |||
054a28c22a | |||
8775895d20 | |||
a8d6b05fb9 | |||
d79ea5d92f | |||
77c7e6c08c | |||
36783b4587 | |||
71e6743206 | |||
33cdebd325 | |||
86a183c9fa | |||
accce088e6 | |||
42beefd223 | |||
12b71780a1 | |||
b444857549 | |||
2004e84df8 | |||
7441572846 | |||
93dd1b4e8d | |||
d467b652ec | |||
19c29cfdc6 |
6
.gitignore
vendored
6
.gitignore
vendored
@ -7,3 +7,9 @@ i2pseeds.su3
|
||||
onion.key
|
||||
tmp/
|
||||
i2p-tools-*
|
||||
*.crl
|
||||
*.crt
|
||||
*.pem
|
||||
plugin
|
||||
reseed-tools*
|
||||
data-dir*
|
@ -5,10 +5,10 @@ COPY . /var/lib/i2p/go/src/i2pgit.org/idk/reseed-tools
|
||||
WORKDIR /var/lib/i2p/go/src/i2pgit.org/idk/reseed-tools
|
||||
RUN apt-get update && \
|
||||
apt-get dist-upgrade -y && \
|
||||
apt-get install -y git golang-1.13-go make && \
|
||||
apt-get install -y git golang-go make && \
|
||||
mkdir -p /var/lib/i2p/i2p-config/reseed && \
|
||||
chown -R $I2P_UID:$I2P_GID /var/lib/i2p && chmod -R o+rwx /var/lib/i2p
|
||||
RUN /usr/lib/go-1.13/bin/go build -v -tags netgo -ldflags '-w -extldflags "-static"'
|
||||
RUN go build -v -tags netgo -ldflags '-w -extldflags "-static"'
|
||||
USER $I2P_UID
|
||||
WORKDIR /var/lib/i2p/i2p-config/reseed
|
||||
ENTRYPOINT [ "/var/lib/i2p/go/src/i2pgit.org/idk/reseed-tools/entrypoint.sh" ]
|
169
Makefile
169
Makefile
@ -1,6 +1,6 @@
|
||||
|
||||
VERSION=0.0.6
|
||||
APP=i2p-tools-1
|
||||
VERSION=0.2.0
|
||||
APP=reseed-tools
|
||||
USER_GH=eyedeekay
|
||||
|
||||
GOOS?=$(shell uname -s | tr A-Z a-z)
|
||||
@ -19,47 +19,55 @@ WHOAMI=$(shell whoami)
|
||||
echo:
|
||||
@echo "type make version to do release $(APP) $(VERSION) $(GOOS) $(GOARCH) $(MIN_GO_VERSION) $(I2P_UID) $(I2P_GID)"
|
||||
|
||||
version:
|
||||
cat README.md | gothub release -s $(GITHUB_TOKEN) -u $(USER_GH) -r $(APP) -t v$(VERSION) -d -
|
||||
build:
|
||||
go build $(ARG) -o reseed-tools-$(GOOS)-$(GOARCH)
|
||||
|
||||
edit:
|
||||
cat README.md | gothub edit -s $(GITHUB_TOKEN) -u $(USER_GH) -r $(APP) -t v$(VERSION) -d -
|
||||
|
||||
upload: binary tar
|
||||
gothub upload -s $(GITHUB_TOKEN) -u $(USER_GH) -r $(APP) -t v$(VERSION) -f ../i2p-tools.tar.xz -n "i2p-tools.tar.xz"
|
||||
|
||||
build: gofmt
|
||||
/usr/lib/go-$(MIN_GO_VERSION)/bin/go build $(ARG) -o i2p-tools-$(GOOS)-$(GOARCH)
|
||||
1.15-build: gofmt
|
||||
/usr/lib/go-$(MIN_GO_VERSION)/bin/go build $(ARG) -o reseed-tools-$(GOOS)-$(GOARCH)
|
||||
|
||||
clean:
|
||||
rm i2p-tools-* *.key *.i2pKeys *.crt *.crl *.pem tmp -rf
|
||||
|
||||
binary:
|
||||
GOOS=darwin GOARCH=amd64 make build
|
||||
GOOS=linux GOARCH=386 make build
|
||||
GOOS=linux GOARCH=amd64 make build
|
||||
GOOS=linux GOARCH=arm make build
|
||||
GOOS=linux GOARCH=arm64 make build
|
||||
GOOS=openbsd GOARCH=amd64 make build
|
||||
GOOS=freebsd GOARCH=386 make build
|
||||
GOOS=freebsd GOARCH=amd64 make build
|
||||
rm reseed-tools-* *.key *.i2pKeys *.crt *.crl *.pem tmp -rfv
|
||||
|
||||
tar:
|
||||
tar --exclude="./.git" --exclude="./tmp" -cvf ../i2p-tools.tar.xz .
|
||||
tar --exclude="./.git" --exclude="./tmp" -cvf ../reseed-tools.tar.xz .
|
||||
|
||||
install:
|
||||
install -m755 i2p-tools-$(GOOS)-$(GOARCH) /usr/local/bin/i2p-tools
|
||||
install -m755 reseed-tools-$(GOOS)-$(GOARCH) /usr/bin/reseed-tools
|
||||
install -m644 etc/default/reseed /etc/default/reseed
|
||||
install -m755 etc/init.d/reseed /etc/init.d/reseed
|
||||
mkdir -p /etc/systemd/system/reseed.d/
|
||||
mkdir -p /var/lib/i2p
|
||||
install -g i2psvc -o i2psvc -d /var/lib/i2p/i2p-config/reseed/
|
||||
install -m644 etc/systemd/system/reseed.d/reseed.conf /etc/systemd/system/reseed.d/reseed.conf
|
||||
install -m644 etc/systemd/system/reseed.d/reseed.service /etc/systemd/system/reseed.d/reseed.service
|
||||
|
||||
checkinstall: build
|
||||
fakeroot checkinstall \
|
||||
--default \
|
||||
--install=no \
|
||||
--fstrans=yes \
|
||||
--pkgname=reseed-tools \
|
||||
--pkgversion=$(VERSION) \
|
||||
--pkggroup=net \
|
||||
--pkgrelease=1 \
|
||||
--pkgsource="https://i2pgit.org/idk/reseed-tools" \
|
||||
--maintainer="$(SIGNER)" \
|
||||
--requires="i2p,i2p-router" \
|
||||
--suggests="i2p,i2p-router,syndie,tor,tsocks" \
|
||||
--nodoc \
|
||||
--deldoc=yes \
|
||||
--deldesc=yes \
|
||||
--backup=no
|
||||
|
||||
### You shouldn't need to use these now that the go mod require rule is fixed,
|
||||
## but I'm leaving them in here because it made it easier to test that both
|
||||
## versions behaved the same way. -idk
|
||||
|
||||
build-fork:
|
||||
/usr/lib/go-$(MIN_GO_VERSION)/bin/go build -o i2p-tools-idk
|
||||
/usr/lib/go-$(MIN_GO_VERSION)/bin/go build -o reseed-tools-idk
|
||||
|
||||
build-unfork:
|
||||
/usr/lib/go-$(MIN_GO_VERSION)/bin/go build -o i2p-tools-md
|
||||
/usr/lib/go-$(MIN_GO_VERSION)/bin/go build -o reseed-tools-md
|
||||
|
||||
fork:
|
||||
sed -i 's|idk/reseed-tools|idk/reseed-tools|g' main.go cmd/*.go reseed/*.go su3/*.go
|
||||
@ -67,7 +75,7 @@ fork:
|
||||
|
||||
unfork:
|
||||
sed -i 's|idk/reseed-tools|idk/reseed-tools|g' main.go cmd/*.go reseed/*.go su3/*.go
|
||||
sed -i 's|RTradeLtd/i2p-tools-1|idk/reseed-tools|g' main.go cmd/*.go reseed/*.go su3/*.go
|
||||
sed -i 's|RTradeLtd/reseed-tools|idk/reseed-tools|g' main.go cmd/*.go reseed/*.go su3/*.go
|
||||
make gofmt build-unfork
|
||||
|
||||
gofmt:
|
||||
@ -76,12 +84,12 @@ gofmt:
|
||||
try:
|
||||
mkdir -p tmp && \
|
||||
cd tmp && \
|
||||
../i2p-tools-$(GOOS)-$(GOARCH) reseed --signer=you@mail.i2p --netdb=/home/idk/.i2p/netDb --tlsHost=your-domain.tld --onion --p2p --i2p --littleboss=start
|
||||
../reseed-tools-$(GOOS)-$(GOARCH) reseed --signer=you@mail.i2p --netdb=/home/idk/.i2p/netDb --tlsHost=your-domain.tld --onion --p2p --i2p --littleboss=start
|
||||
|
||||
stop:
|
||||
mkdir -p tmp && \
|
||||
cd tmp && \
|
||||
../i2p-tools-$(GOOS)-$(GOARCH) reseed --signer=you@mail.i2p --netdb=/home/idk/.i2p/netDb --tlsHost=your-domain.tld --onion --p2p --i2p --littleboss=stop
|
||||
../reseed-tools-$(GOOS)-$(GOARCH) reseed --signer=you@mail.i2p --netdb=/home/idk/.i2p/netDb --tlsHost=your-domain.tld --onion --p2p --i2p --littleboss=stop
|
||||
|
||||
docker:
|
||||
docker build -t eyedeekay/reseed .
|
||||
@ -109,7 +117,7 @@ docker-server:
|
||||
--publish 8443:8443 \
|
||||
--restart=always \
|
||||
--volume /var/lib/i2p/i2p-config/netDb:/var/lib/i2p/i2p-config/netDb:z \
|
||||
--volume reseed-keyss:/var/lib/i2p/i2p-config/reseed \
|
||||
--volume reseed-keys:/var/lib/i2p/i2p-config/reseed \
|
||||
eyedeekay/reseed \
|
||||
--signer=hankhill19580@gmail.com
|
||||
docker logs -f reseed
|
||||
@ -147,3 +155,102 @@ jar: gojava
|
||||
echo $(JAVA_HOME)
|
||||
./gojava -v -o reseed.jar -s . build ./reseed
|
||||
|
||||
release: version upload checkinstall upload-single-deb binary upload-bin plguins upload-plugins
|
||||
|
||||
version:
|
||||
cat README.md | gothub release -s $(GITHUB_TOKEN) -u $(USER_GH) -r $(APP) -t v$(VERSION) -d -
|
||||
|
||||
edit:
|
||||
cat README.md | gothub edit -s $(GITHUB_TOKEN) -u $(USER_GH) -r $(APP) -t v$(VERSION) -d -
|
||||
|
||||
upload: tar
|
||||
gothub upload -R -s $(GITHUB_TOKEN) -u $(USER_GH) -r $(APP) -t v$(VERSION) -f ../reseed-tools.tar.xz -n "reseed-tools.tar.xz"
|
||||
|
||||
binary:
|
||||
GOOS=darwin GOARCH=amd64 make build
|
||||
GOOS=darwin GOARCH=arm64 make build
|
||||
GOOS=linux GOARCH=386 make build
|
||||
GOOS=linux GOARCH=amd64 make build
|
||||
GOOS=linux GOARCH=arm make build
|
||||
GOOS=linux GOARCH=arm64 make build
|
||||
GOOS=openbsd GOARCH=amd64 make build
|
||||
GOOS=freebsd GOARCH=386 make build
|
||||
GOOS=freebsd GOARCH=amd64 make build
|
||||
GOOS=windows GOARCH=amd64 make build
|
||||
GOOS=windows GOARCH=386 make build
|
||||
|
||||
plugins: binary
|
||||
GOOS=darwin GOARCH=amd64 make su3s
|
||||
GOOS=darwin GOARCH=arm64 make su3s
|
||||
GOOS=linux GOARCH=386 make su3s
|
||||
GOOS=linux GOARCH=amd64 make su3s
|
||||
GOOS=linux GOARCH=arm make su3s
|
||||
GOOS=linux GOARCH=arm64 make su3s
|
||||
GOOS=openbsd GOARCH=amd64 make su3s
|
||||
GOOS=freebsd GOARCH=386 make su3s
|
||||
GOOS=freebsd GOARCH=amd64 make su3s
|
||||
GOOS=windows GOARCH=amd64 make su3s
|
||||
GOOS=windows GOARCH=386 make su3s
|
||||
|
||||
upload-bin:
|
||||
GOOS=darwin GOARCH=amd64 make upload-single-bin
|
||||
GOOS=darwin GOARCH=arm64 make upload-single-bin
|
||||
GOOS=linux GOARCH=386 make upload-single-bin
|
||||
GOOS=linux GOARCH=amd64 make upload-single-bin
|
||||
GOOS=linux GOARCH=arm make upload-single-bin
|
||||
GOOS=linux GOARCH=arm64 make upload-single-bin
|
||||
GOOS=openbsd GOARCH=amd64 make upload-single-bin
|
||||
GOOS=freebsd GOARCH=386 make upload-single-bin
|
||||
GOOS=freebsd GOARCH=amd64 make upload-single-bin
|
||||
GOOS=windows GOARCH=amd64 make upload-single-bin
|
||||
GOOS=windows GOARCH=386 make upload-single-bin
|
||||
|
||||
upload-su3s:
|
||||
GOOS=darwin GOARCH=amd64 make upload-single-su3
|
||||
GOOS=darwin GOARCH=arm64 make upload-single-su3
|
||||
GOOS=linux GOARCH=386 make upload-single-su3
|
||||
GOOS=linux GOARCH=amd64 make upload-single-su3
|
||||
GOOS=linux GOARCH=arm make upload-single-su3
|
||||
GOOS=linux GOARCH=arm64 make upload-single-su3
|
||||
GOOS=openbsd GOARCH=amd64 make upload-single-su3
|
||||
GOOS=freebsd GOARCH=386 make upload-single-su3
|
||||
GOOS=freebsd GOARCH=amd64 make upload-single-su3
|
||||
GOOS=windows GOARCH=amd64 make upload-single-su3
|
||||
GOOS=windows GOARCH=386 make upload-single-su3
|
||||
|
||||
upload-single-deb:
|
||||
gothub upload -R -s $(GITHUB_TOKEN) -u $(USER_GH) -r $(APP) -t v$(VERSION) -f reseed-tools_$(VERSION)-1_amd64.deb -l "`sha256sum reseed-tools_$(VERSION)-1_amd64.deb`" -n "reseed-tools_$(VERSION)-1_amd64.deb"
|
||||
|
||||
upload-single-bin:
|
||||
gothub upload -R -s $(GITHUB_TOKEN) -u $(USER_GH) -r $(APP) -t v$(VERSION) -f reseed-tools-"$(GOOS)"-"$(GOARCH)" -l "`sha256sum reseed-tools-$(GOOS)-$(GOARCH)`" -n "reseed-tools-$(GOOS)"-"$(GOARCH)"
|
||||
|
||||
upload-single-su3:
|
||||
gothub upload -R -s $(GITHUB_TOKEN) -u $(USER_GH) -r $(APP) -t v$(VERSION) -f reseed-tools-"$(GOOS)"-"$(GOARCH).su3" -l "`sha256sum reseed-tools-$(GOOS)-$(GOARCH).su3`" -n "reseed-tools-$(GOOS)"-"$(GOARCH).su3"
|
||||
|
||||
tmp/content:
|
||||
mkdir -p tmp
|
||||
cp -rv content tmp/content
|
||||
|
||||
su3s: tmp/content
|
||||
i2p.plugin.native -name=reseed-tools-$(GOOS)-$(GOARCH) \
|
||||
-signer=hankhill19580@gmail.com \
|
||||
-version "$(VERSION)" \
|
||||
-author=hankhill19580@gmail.com \
|
||||
-autostart=true \
|
||||
-clientname=reseed-tools-$(GOOS)-$(GOARCH) \
|
||||
-command="reseed-tools-$(GOOS)-$(GOARCH) reseed --yes --signer=you@mail.i2p --netdb=\$$CONFIG/netDb" \
|
||||
-consolename="Reseed Tools" \
|
||||
-consoleurl="http://127.0.0.1:8443" \
|
||||
-updateurl="http://idk.i2p/reseed-tools/reseed-tools-$(GOOS)-$(GOARCH).su3" \
|
||||
-website="http://idk.i2p/reseed-tools/" \
|
||||
-icondata="content/images/reseed.png" \
|
||||
-delaystart="3" \
|
||||
-desc="`cat description-pak`" \
|
||||
-exename=reseed-tools-$(GOOS)-$(GOARCH) \
|
||||
-targetos="$(GOOS)" \
|
||||
-res=tmp/ \
|
||||
-license=MIT
|
||||
unzip -o reseed-tools-$(GOOS)-$(GOARCH).zip -d reseed-tools-$(GOOS)-$(GOARCH)-zip
|
||||
|
||||
#export sumbblinux=`sha256sum "../reseed-tools-linux.su3"`
|
||||
#export sumbbwindows=`sha256sum "../reseed-tools-windows.su3"`
|
||||
|
214
README.md
214
README.md
@ -4,18 +4,139 @@ I2P Reseed Tools
|
||||
This tool provides a secure and efficient reseed server for the I2P network. There are several utility commands to
|
||||
create, sign, and validate SU3 files. Please note that this requires at least Go version 1.13, and uses Go Modules.
|
||||
|
||||
## Installation
|
||||
## Dependencies
|
||||
|
||||
If you have go installed you can download, build, and install this tool with `go get`
|
||||
`go`, `git`, and optionally `make` are required to build the project.
|
||||
Precompiled binaries for most platforms are available at my github mirror
|
||||
https://github.com/eyedeekay/i2p-tools-1.
|
||||
|
||||
In order to install the build-dependencies on Ubuntu or Debian, you may use:
|
||||
|
||||
```sh
|
||||
sudo apt-get install golang-go git make
|
||||
```
|
||||
|
||||
## Installation(From Source)
|
||||
|
||||
```
|
||||
go get i2pgit.org/idk/reseed-tools
|
||||
i2p-tools -h
|
||||
git clone https://i2pgit.org/idk/reseed-tools
|
||||
cd reseed-tools
|
||||
make build
|
||||
# Optionally, if you want to install to /usr/bin/reseed-tools
|
||||
sudo make install
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
### Docker!
|
||||
#### Debian/Ubuntu note:
|
||||
|
||||
Debian users who are running I2P as a system service must also run the
|
||||
`reseed-tools` as the same user. This is so that the reseed-tools can access
|
||||
the I2P service's netDb directory. On Debian and Ubuntu, that user is `i2psvc`
|
||||
and the netDb directory is: `/var/lib/i2p/i2p-config/netDb`.
|
||||
|
||||
##### Systemd Service
|
||||
|
||||
A systemd service is provided which should work with the I2P Debian package
|
||||
when reseed-tools is installed in `/usr/bin/reseed-tools`. If you install with
|
||||
`make install` this service is also installed. This service will cause the
|
||||
bundles to regenerate every 12 hours.
|
||||
|
||||
The contact email for your reseed should be added in:
|
||||
`/etc/systemd/system/reseed.d/reseed.conf`.
|
||||
|
||||
Self-signed certificates will be auto-generated for these services. To change
|
||||
this you should edit the `/etc/systemd/system/reseed.d/reseed.service`.
|
||||
|
||||
- To enable starting the reseed service automatically with the system: `sudo systemctl enable reseed.service`
|
||||
- To run the service manually: `sudo sysctl start reseed.service`
|
||||
- To reload the systemd services: `sudo systemctl daemon-reload`
|
||||
- To view the status/logs: `sudo journalctl -u reseed.service`
|
||||
|
||||
##### SysV Service
|
||||
|
||||
An initscript is also provided. The initscript, unlike the systemd service,
|
||||
cannot schedule itself to restart. You should restart the service roughly once
|
||||
a day to ensure that the information does not expire.
|
||||
|
||||
The contact email for your reseed should be added in:
|
||||
`/etc/init.d/reseed`.
|
||||
|
||||
Self-signed certificates will be auto-generated for these services. To change
|
||||
this you should edit the `/etc/init.d/reseed`.
|
||||
|
||||
### Without a webserver, standalone with TLS support
|
||||
|
||||
If this is your first time running a reseed server (ie. you don't have any existing keys),
|
||||
you can simply run the command and follow the prompts to create the appropriate keys, crl and certificates.
|
||||
Afterwards an HTTPS reseed server will start on the default port and generate 6 files in your current directory
|
||||
(a TLS key, certificate and crl, and a su3-file signing key, certificate and crl).
|
||||
|
||||
```
|
||||
reseed-tools reseed --signer=you@mail.i2p --netdb=/home/i2p/.i2p/netDb --tlsHost=your-domain.tld
|
||||
```
|
||||
|
||||
## Example Commands:
|
||||
|
||||
### Locally behind a webserver (reverse proxy setup), preferred:
|
||||
|
||||
If you are using a reverse proxy server it may provide the TLS certificate instead.
|
||||
|
||||
```
|
||||
reseed-tools reseed --signer=you@mail.i2p --netdb=/home/i2p/.i2p/netDb --port=8443 --ip=127.0.0.1 --trustProxy
|
||||
```
|
||||
|
||||
### Without a webserver, standalone, self-supervising(Automatic restarts)
|
||||
|
||||
```
|
||||
./reseed-tools reseed --signer=you@mail.i2p --netdb=/home/i2p/.i2p/netDb --littleboss=start
|
||||
```
|
||||
|
||||
### Without a webserver, standalone, automatic OnionV3 with TLS support
|
||||
|
||||
```
|
||||
./reseed-tools reseed --signer=you@mail.i2p --netdb=/home/i2p/.i2p/netDb --onion --i2p --p2p
|
||||
```
|
||||
|
||||
### Without a webserver, standalone, serve P2P with LibP2P
|
||||
|
||||
```
|
||||
./reseed-tools reseed --signer=you@mail.i2p --netdb=/home/i2p/.i2p/netDb --p2p
|
||||
```
|
||||
|
||||
### Without a webserver, standalone, upload a single signed .su3 to github
|
||||
|
||||
* This one isn't working yet, I'll get to it eventually, I've got a cooler idea now.
|
||||
|
||||
```
|
||||
./reseed-tools reseed --signer=you@mail.i2p --netdb=/home/i2p/.i2p/netDb --github --ghrepo=reseed-tools --ghuser=eyedeekay
|
||||
```
|
||||
|
||||
### Without a webserver, standalone, in-network reseed
|
||||
|
||||
```
|
||||
./reseed-tools reseed --signer=you@mail.i2p --netdb=/home/i2p/.i2p/netDb --i2p
|
||||
```
|
||||
|
||||
### Without a webserver, standalone, Regular TLS, OnionV3 with TLS
|
||||
|
||||
```
|
||||
./reseed-tools reseed --tlsHost=your-domain.tld --signer=you@mail.i2p --netdb=/home/i2p/.i2p/netDb --onion
|
||||
```
|
||||
|
||||
### Without a webserver, standalone, Regular TLS, OnionV3 with TLS, and LibP2P
|
||||
|
||||
```
|
||||
./reseed-tools reseed --tlsHost=your-domain.tld --signer=you@mail.i2p --netdb=/home/i2p/.i2p/netDb --onion --p2p
|
||||
```
|
||||
|
||||
### Without a webserver, standalone, Regular TLS, OnionV3 with TLS, I2P In-Network reseed, and LibP2P, self-supervising
|
||||
|
||||
```
|
||||
./reseed-tools reseed --tlsHost=your-domain.tld --signer=you@mail.i2p --netdb=/home/i2p/.i2p/netDb --onion --p2p --littleboss=start
|
||||
```
|
||||
|
||||
### Docker
|
||||
|
||||
To make it easier to deploy reseeds, it is possible to run this software as a
|
||||
Docker image. Because the software requires access to a network database to host
|
||||
@ -72,86 +193,3 @@ work for you. In that case, just copy-and-paste:
|
||||
--volume reseed-keys:/var/lib/i2p/i2p-config/reseed \
|
||||
eyedeekay/reseed \
|
||||
--signer $YOUR_EMAIL_HERE
|
||||
|
||||
### Locally behind a webserver (reverse proxy setup), preferred:
|
||||
|
||||
```
|
||||
i2p-tools reseed --signer=you@mail.i2p --netdb=/home/i2p/.i2p/netDb --port=8443 --ip=127.0.0.1 --trustProxy
|
||||
```
|
||||
|
||||
### Without a webserver, standalone with TLS support
|
||||
|
||||
```
|
||||
i2p-tools reseed --signer=you@mail.i2p --netdb=/home/i2p/.i2p/netDb --tlsHost=your-domain.tld
|
||||
```
|
||||
|
||||
If this is your first time running a reseed server (ie. you don't have any existing keys),
|
||||
you can simply run the command and follow the prompts to create the appropriate keys, crl and certificates.
|
||||
Afterwards an HTTPS reseed server will start on the default port and generate 6 files in your current directory
|
||||
(a TLS key, certificate and crl, and a su3-file signing key, certificate and crl).
|
||||
|
||||
Get the source code here on github or a pre-build binary anonymously on
|
||||
|
||||
http://reseed.i2p/
|
||||
http://j7xszhsjy7orrnbdys7yykrssv5imkn4eid7n5ikcnxuhpaaw6cq.b32.i2p/
|
||||
|
||||
also a short guide and complete tech info.
|
||||
|
||||
## Experimental, currently only available from idk/reseed-tools fork
|
||||
|
||||
Requires ```go mod``` and at least go 1.13. To build the idk/reseed-tools
|
||||
fork, from anywhere:
|
||||
|
||||
git clone https://i2pgit.org/idk/reseed-tools
|
||||
cd i2p-tools-1
|
||||
make build
|
||||
|
||||
### Without a webserver, standalone, self-supervising(Automatic restarts)
|
||||
|
||||
```
|
||||
./i2p-tools-1 reseed --signer=you@mail.i2p --netdb=/home/i2p/.i2p/netDb --littleboss=start
|
||||
```
|
||||
|
||||
### Without a webserver, standalone, automatic OnionV3 with TLS support
|
||||
|
||||
```
|
||||
./i2p-tools-1 reseed --signer=you@mail.i2p --netdb=/home/i2p/.i2p/netDb --onion --i2p --p2p
|
||||
```
|
||||
|
||||
### Without a webserver, standalone, serve P2P with LibP2P
|
||||
|
||||
```
|
||||
./i2p-tools-1 reseed --signer=you@mail.i2p --netdb=/home/i2p/.i2p/netDb --p2p
|
||||
```
|
||||
|
||||
### Without a webserver, standalone, upload a single signed .su3 to github
|
||||
|
||||
* This one isn't working yet, I'll get to it eventually, I've got a cooler idea now.
|
||||
|
||||
```
|
||||
./i2p-tools-1 reseed --signer=you@mail.i2p --netdb=/home/i2p/.i2p/netDb --github --ghrepo=i2p-tools-1 --ghuser=eyedeekay
|
||||
```
|
||||
|
||||
### Without a webserver, standalone, in-network reseed
|
||||
|
||||
```
|
||||
./i2p-tools-1 reseed --signer=you@mail.i2p --netdb=/home/i2p/.i2p/netDb --i2p
|
||||
```
|
||||
|
||||
### Without a webserver, standalone, Regular TLS, OnionV3 with TLS
|
||||
|
||||
```
|
||||
./i2p-tools-1 reseed --tlsHost=your-domain.tld --signer=you@mail.i2p --netdb=/home/i2p/.i2p/netDb --onion
|
||||
```
|
||||
|
||||
### Without a webserver, standalone, Regular TLS, OnionV3 with TLS, and LibP2P
|
||||
|
||||
```
|
||||
./i2p-tools-1 reseed --tlsHost=your-domain.tld --signer=you@mail.i2p --netdb=/home/i2p/.i2p/netDb --onion --p2p
|
||||
```
|
||||
|
||||
### Without a webserver, standalone, Regular TLS, OnionV3 with TLS, I2P In-Network reseed, and LibP2P, self-supervising
|
||||
|
||||
```
|
||||
./i2p-tools-1 reseed --tlsHost=your-domain.tld --signer=you@mail.i2p --netdb=/home/i2p/.i2p/netDb --onion --p2p --littleboss=start
|
||||
```
|
||||
|
114
cmd/reseed.go
114
cmd/reseed.go
@ -12,7 +12,6 @@ import (
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
//"crawshaw.io/littleboss"
|
||||
"github.com/cretz/bine/tor"
|
||||
"github.com/cretz/bine/torutil"
|
||||
"github.com/cretz/bine/torutil/ed25519"
|
||||
@ -22,9 +21,35 @@ import (
|
||||
"github.com/libp2p/go-libp2p-core/host"
|
||||
"github.com/urfave/cli"
|
||||
"i2pgit.org/idk/reseed-tools/reseed"
|
||||
|
||||
"github.com/eyedeekay/checki2cp/getmeanetdb"
|
||||
)
|
||||
|
||||
func getDefaultSigner() string {
|
||||
intentionalsigner := os.Getenv("RESEED_EMAIL")
|
||||
if intentionalsigner == "" {
|
||||
adminsigner := os.Getenv("MAILTO")
|
||||
if adminsigner != "" {
|
||||
return adminsigner
|
||||
}
|
||||
return ""
|
||||
}
|
||||
return intentionalsigner
|
||||
}
|
||||
|
||||
func getHostName() string {
|
||||
hostname := os.Getenv("RESEED_HOSTNAME")
|
||||
if hostname == "" {
|
||||
hostname, _ = os.Hostname()
|
||||
}
|
||||
return hostname
|
||||
}
|
||||
|
||||
func NewReseedCommand() cli.Command {
|
||||
ndb, err := getmeanetdb.WhereIstheNetDB()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
return cli.Command{
|
||||
Name: "reseed",
|
||||
Usage: "Start a reseed server",
|
||||
@ -32,10 +57,12 @@ func NewReseedCommand() cli.Command {
|
||||
Flags: []cli.Flag{
|
||||
cli.StringFlag{
|
||||
Name: "signer",
|
||||
Value: getDefaultSigner(),
|
||||
Usage: "Your su3 signing ID (ex. something@mail.i2p)",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "tlsHost",
|
||||
Value: getHostName(),
|
||||
Usage: "The public hostname used on your TLS certificate",
|
||||
},
|
||||
cli.BoolFlag{
|
||||
@ -57,6 +84,7 @@ func NewReseedCommand() cli.Command {
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "netdb",
|
||||
Value: ndb,
|
||||
Usage: "Path to NetDB directory containing routerInfos",
|
||||
},
|
||||
cli.StringFlag{
|
||||
@ -84,7 +112,7 @@ func NewReseedCommand() cli.Command {
|
||||
},
|
||||
cli.IntFlag{
|
||||
Name: "numSu3",
|
||||
Value: 0,
|
||||
Value: 50,
|
||||
Usage: "Number of su3 files to build (0 = automatic based on size of netdb)",
|
||||
},
|
||||
cli.StringFlag{
|
||||
@ -128,10 +156,14 @@ func NewReseedCommand() cli.Command {
|
||||
Value: "127.0.0.1:7656",
|
||||
Usage: "Use this SAM address to set up I2P connections for in-network reseed",
|
||||
},
|
||||
cli.BoolFlag{
|
||||
Name: "acme",
|
||||
Usage: "Automatically generate a TLS certificate with the ACME protocol, defaults to Let's Encrypt",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "littleboss",
|
||||
Value: "start",
|
||||
Usage: "Self-Supervise this application",
|
||||
Name: "acmeserver",
|
||||
Value: "https://acme-staging-v02.api.letsencrypt.org/directory",
|
||||
Usage: "Use this server to issue a certificate with the ACME protocol",
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -183,11 +215,6 @@ func LoadKeys(keysPath string, c *cli.Context) (i2pkeys.I2PKeys, error) {
|
||||
}
|
||||
|
||||
func reseedAction(c *cli.Context) {
|
||||
// validate flags
|
||||
if c.String("littleboss") != "start" {
|
||||
log.Println("--littleboss", c.String("littleboss"))
|
||||
return
|
||||
}
|
||||
netdbDir := c.String("netdb")
|
||||
if netdbDir == "" {
|
||||
fmt.Println("--netdb is required")
|
||||
@ -208,13 +235,53 @@ func reseedAction(c *cli.Context) {
|
||||
var i2pTlsCert, i2pTlsKey string
|
||||
var i2pkey i2pkeys.I2PKeys
|
||||
|
||||
if tlsHost != "" {
|
||||
onionTlsHost = tlsHost
|
||||
i2pTlsHost = tlsHost
|
||||
tlsKey = c.String("tlsKey")
|
||||
// if no key is specified, default to the host.pem in the current dir
|
||||
if tlsKey == "" {
|
||||
tlsKey = tlsHost + ".pem"
|
||||
onionTlsKey = tlsHost + ".pem"
|
||||
i2pTlsKey = tlsHost + ".pem"
|
||||
}
|
||||
|
||||
tlsCert = c.String("tlsCert")
|
||||
// if no certificate is specified, default to the host.crt in the current dir
|
||||
if tlsCert == "" {
|
||||
tlsCert = tlsHost + ".crt"
|
||||
onionTlsCert = tlsHost + ".crt"
|
||||
i2pTlsCert = tlsHost + ".crt"
|
||||
}
|
||||
|
||||
// prompt to create tls keys if they don't exist?
|
||||
auto := c.Bool("yes")
|
||||
// use ACME?
|
||||
acme := c.Bool("acme")
|
||||
if acme {
|
||||
acmeserver := c.String("acmeserver")
|
||||
err := checkUseAcmeCert(tlsHost, signerID, acmeserver, &tlsCert, &tlsKey, auto)
|
||||
if nil != err {
|
||||
log.Fatalln(err)
|
||||
}
|
||||
} else {
|
||||
err := checkOrNewTLSCert(tlsHost, &tlsCert, &tlsKey, auto)
|
||||
if nil != err {
|
||||
log.Fatalln(err)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if c.Bool("i2p") {
|
||||
var err error
|
||||
i2pkey, err = LoadKeys("reseed.i2pkeys", c)
|
||||
if err != nil {
|
||||
log.Fatalln(err)
|
||||
}
|
||||
i2pTlsHost = i2pkey.Addr().Base32()
|
||||
if i2pTlsHost == "" {
|
||||
i2pTlsHost = i2pkey.Addr().Base32()
|
||||
}
|
||||
if i2pTlsHost != "" {
|
||||
// if no key is specified, default to the host.pem in the current dir
|
||||
if i2pTlsKey == "" {
|
||||
@ -250,7 +317,9 @@ func reseedAction(c *cli.Context) {
|
||||
}
|
||||
ok = []byte(key.PrivateKey())
|
||||
}
|
||||
onionTlsHost = torutil.OnionServiceIDFromPrivateKey(ed25519.PrivateKey(ok)) + ".onion"
|
||||
if onionTlsHost == "" {
|
||||
onionTlsHost = torutil.OnionServiceIDFromPrivateKey(ed25519.PrivateKey(ok)) + ".onion"
|
||||
}
|
||||
err = ioutil.WriteFile(c.String("onionKey"), ok, 0644)
|
||||
if err != nil {
|
||||
log.Fatalln(err.Error())
|
||||
@ -275,27 +344,6 @@ func reseedAction(c *cli.Context) {
|
||||
}
|
||||
}
|
||||
|
||||
if tlsHost != "" {
|
||||
tlsKey = c.String("tlsKey")
|
||||
// if no key is specified, default to the host.pem in the current dir
|
||||
if tlsKey == "" {
|
||||
tlsKey = tlsHost + ".pem"
|
||||
}
|
||||
|
||||
tlsCert = c.String("tlsCert")
|
||||
// if no certificate is specified, default to the host.crt in the current dir
|
||||
if tlsCert == "" {
|
||||
tlsCert = tlsHost + ".crt"
|
||||
}
|
||||
|
||||
// prompt to create tls keys if they don't exist?
|
||||
auto := c.Bool("yes")
|
||||
err := checkOrNewTLSCert(tlsHost, &tlsCert, &tlsKey, auto)
|
||||
if nil != err {
|
||||
log.Fatalln(err)
|
||||
}
|
||||
}
|
||||
|
||||
reloadIntvl, err := time.ParseDuration(c.String("interval"))
|
||||
if nil != err {
|
||||
fmt.Printf("'%s' is not a valid time interval.\n", reloadIntvl)
|
||||
|
186
cmd/utils.go
186
cmd/utils.go
@ -2,10 +2,12 @@ package cmd
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"crypto"
|
||||
"crypto/ecdsa"
|
||||
"crypto/elliptic"
|
||||
"crypto/rand"
|
||||
"crypto/rsa"
|
||||
"crypto/tls"
|
||||
"crypto/x509"
|
||||
"crypto/x509/pkix"
|
||||
"encoding/asn1"
|
||||
@ -18,6 +20,13 @@ import (
|
||||
|
||||
"i2pgit.org/idk/reseed-tools/reseed"
|
||||
"i2pgit.org/idk/reseed-tools/su3"
|
||||
|
||||
"github.com/go-acme/lego/v4/certcrypto"
|
||||
"github.com/go-acme/lego/v4/certificate"
|
||||
"github.com/go-acme/lego/v4/challenge/http01"
|
||||
"github.com/go-acme/lego/v4/challenge/tlsalpn01"
|
||||
"github.com/go-acme/lego/v4/lego"
|
||||
"github.com/go-acme/lego/v4/registration"
|
||||
)
|
||||
|
||||
func loadPrivateKey(path string) (*rsa.PrivateKey, error) {
|
||||
@ -35,6 +44,24 @@ func loadPrivateKey(path string) (*rsa.PrivateKey, error) {
|
||||
return privKey, nil
|
||||
}
|
||||
|
||||
// Taken directly from the lego example, since we need very minimal support
|
||||
// https://go-acme.github.io/lego/usage/library/
|
||||
type MyUser struct {
|
||||
Email string
|
||||
Registration *registration.Resource
|
||||
key crypto.PrivateKey
|
||||
}
|
||||
|
||||
func (u *MyUser) GetEmail() string {
|
||||
return u.Email
|
||||
}
|
||||
func (u MyUser) GetRegistration() *registration.Resource {
|
||||
return u.Registration
|
||||
}
|
||||
func (u *MyUser) GetPrivateKey() crypto.PrivateKey {
|
||||
return u.key
|
||||
}
|
||||
|
||||
func signerFile(signerID string) string {
|
||||
return strings.Replace(signerID, "@", "_at_", 1)
|
||||
}
|
||||
@ -60,6 +87,165 @@ func getOrNewSigningCert(signerKey *string, signerID string, auto bool) (*rsa.Pr
|
||||
return loadPrivateKey(*signerKey)
|
||||
}
|
||||
|
||||
func checkUseAcmeCert(tlsHost, signer, cadirurl string, tlsCert, tlsKey *string, auto bool) error {
|
||||
_, certErr := os.Stat(*tlsCert)
|
||||
_, keyErr := os.Stat(*tlsKey)
|
||||
if certErr != nil || keyErr != nil {
|
||||
if certErr != nil {
|
||||
fmt.Printf("Unable to read TLS certificate '%s'\n", *tlsCert)
|
||||
}
|
||||
if keyErr != nil {
|
||||
fmt.Printf("Unable to read TLS key '%s'\n", *tlsKey)
|
||||
}
|
||||
|
||||
if !auto {
|
||||
fmt.Printf("Would you like to generate a new certificate with Let's Encrypt or a custom ACME server? '%s'? (y or n): ", tlsHost)
|
||||
reader := bufio.NewReader(os.Stdin)
|
||||
input, _ := reader.ReadString('\n')
|
||||
if []byte(input)[0] != 'y' {
|
||||
fmt.Println("Continuing without TLS")
|
||||
return nil
|
||||
}
|
||||
}
|
||||
} else {
|
||||
TLSConfig := &tls.Config{}
|
||||
TLSConfig.NextProtos = []string{"http/1.1"}
|
||||
TLSConfig.Certificates = make([]tls.Certificate, 1)
|
||||
var err error
|
||||
TLSConfig.Certificates[0], err = tls.LoadX509KeyPair(*tlsCert, *tlsKey)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if time.Now().Sub(TLSConfig.Certificates[0].Leaf.NotAfter) < (time.Hour * 48) {
|
||||
ecder, err := ioutil.ReadFile(tlsHost + signer + ".acme.key")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
privateKey, err := x509.ParseECPrivateKey(ecder)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
user := MyUser{
|
||||
Email: signer,
|
||||
key: privateKey,
|
||||
}
|
||||
config := lego.NewConfig(&user)
|
||||
config.CADirURL = cadirurl
|
||||
config.Certificate.KeyType = certcrypto.RSA2048
|
||||
client, err := lego.NewClient(config)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
renewAcmeIssuedCert(client, user, tlsHost, tlsCert, tlsKey)
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
privateKey, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
ecder, err := x509.MarshalECPrivateKey(privateKey)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
filename := tlsHost + signer + ".acme.key"
|
||||
keypem, err := os.OpenFile(filename, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0600)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer keypem.Close()
|
||||
err = pem.Encode(keypem, &pem.Block{Type: "EC PRIVATE KEY", Bytes: ecder})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
user := MyUser{
|
||||
Email: signer,
|
||||
key: privateKey,
|
||||
}
|
||||
config := lego.NewConfig(&user)
|
||||
config.CADirURL = cadirurl
|
||||
config.Certificate.KeyType = certcrypto.RSA2048
|
||||
client, err := lego.NewClient(config)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return newAcmeIssuedCert(client, user, tlsHost, tlsCert, tlsKey)
|
||||
}
|
||||
|
||||
func renewAcmeIssuedCert(client *lego.Client, user MyUser, tlsHost string, tlsCert, tlsKey *string) error {
|
||||
var err error
|
||||
err = client.Challenge.SetHTTP01Provider(http01.NewProviderServer("", "8000"))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = client.Challenge.SetTLSALPN01Provider(tlsalpn01.NewProviderServer("", "8443"))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// New users will need to register
|
||||
if user.Registration, err = client.Registration.QueryRegistration(); err != nil {
|
||||
reg, err := client.Registration.Register(registration.RegisterOptions{TermsOfServiceAgreed: true})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
user.Registration = reg
|
||||
}
|
||||
resource, err := client.Certificate.Get(tlsHost, true)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
certificates, err := client.Certificate.Renew(*resource, true, false, "")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
ioutil.WriteFile(tlsHost+".pem", certificates.PrivateKey, 0600)
|
||||
ioutil.WriteFile(tlsHost+".crt", certificates.Certificate, 0600)
|
||||
// ioutil.WriteFile(tlsHost+".crl", certificates.PrivateKey, 0600)
|
||||
*tlsCert = tlsHost + ".crt"
|
||||
*tlsKey = tlsHost + ".pem"
|
||||
return nil
|
||||
}
|
||||
|
||||
func newAcmeIssuedCert(client *lego.Client, user MyUser, tlsHost string, tlsCert, tlsKey *string) error {
|
||||
var err error
|
||||
err = client.Challenge.SetHTTP01Provider(http01.NewProviderServer("", "8000"))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = client.Challenge.SetTLSALPN01Provider(tlsalpn01.NewProviderServer("", "8443"))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// New users will need to register
|
||||
if user.Registration, err = client.Registration.QueryRegistration(); err != nil {
|
||||
reg, err := client.Registration.Register(registration.RegisterOptions{TermsOfServiceAgreed: true})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
user.Registration = reg
|
||||
}
|
||||
|
||||
request := certificate.ObtainRequest{
|
||||
Domains: []string{tlsHost},
|
||||
Bundle: true,
|
||||
}
|
||||
certificates, err := client.Certificate.Obtain(request)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
ioutil.WriteFile(tlsHost+".pem", certificates.PrivateKey, 0600)
|
||||
ioutil.WriteFile(tlsHost+".crt", certificates.Certificate, 0600)
|
||||
// ioutil.WriteFile(tlsHost+".crl", certificates.PrivateKey, 0600)
|
||||
*tlsCert = tlsHost + ".crt"
|
||||
*tlsKey = tlsHost + ".pem"
|
||||
return nil
|
||||
}
|
||||
|
||||
func checkOrNewTLSCert(tlsHost string, tlsCert, tlsKey *string, auto bool) error {
|
||||
_, certErr := os.Stat(*tlsCert)
|
||||
_, keyErr := os.Stat(*tlsKey)
|
||||
|
10
content/index.html
Normal file
10
content/index.html
Normal file
@ -0,0 +1,10 @@
|
||||
<h1 id="you-have-found-an-i2p-reseed">You have found an I2P Reseed</h1>
|
||||
<p>Maybe it was by accident, or maybe you visited the URL because you saw it in the software somewhere. While we’ve got your attention, we’re going to take this opportunity to tell you a little about what we do here. I2P is a peer-to-peer network which uses “Garlic Routing” to maintain privacy. Reseed nodes help you get connected to I2P for the first time, and even though you should only have to use them once in a great while, they are very important services.</p>
|
||||
<h2 id="to-learn-more-about-i2p-visit"><a href="https://geti2p.net">To learn more about I2P, visit</a></h2>
|
||||
<p><a href="https://geti2p.net"><img src="images/reseed.png" alt="Help reseed" /></a></p>
|
||||
<ul>
|
||||
<li><a href="https://geti2p.net/en/docs/reseed">Learn more about reseeds here:</a></li>
|
||||
<li><a href="https://geti2p.net/en/get-involved/guides/reseed">Learn how to run a reseed here:</a></li>
|
||||
<li><a href="https://i2pgit.org/idk/reseed-tools">Read the reseed server code and learn about more reseed options here:</a></li>
|
||||
</ul>
|
||||
<p>Here on purpose? Here’s a one-time link to a reseed bundle for you.</p>
|
2
description-pak
Normal file
2
description-pak
Normal file
@ -0,0 +1,2 @@
|
||||
Reseed tools is a self-contained, easy-to-configure I2P reseed service
|
||||
which can be run on any OS.
|
2
etc/default/reseed
Normal file
2
etc/default/reseed
Normal file
@ -0,0 +1,2 @@
|
||||
#Edit the contact/signing email used by your reseed server here
|
||||
export RESEED_EMAIL=""
|
@ -8,42 +8,31 @@
|
||||
# Description: <DESCRIPTION>
|
||||
### END INIT INFO
|
||||
|
||||
SCRIPT='/usr/local/bin/i2p-tools'
|
||||
SCRIPT='/usr/bin/reseed-tools'
|
||||
RUNAS=i2psvc
|
||||
NETDBDIR=/var/lib/i2p/i2p-config/netDb
|
||||
RUNDIR=/var/lib/i2p/i2p-config/reseed
|
||||
SIGNER=you@mail.i2p
|
||||
MORE_OPTIONS=""
|
||||
if [ -f /etc/default/reseed ]; then
|
||||
source /etc/default/reseed
|
||||
. /etc/default/reseed
|
||||
fi
|
||||
RUNOPTS=" reseed --signer=$SIGNER --netdb=$NETDBDIR $MORE_OPTIONS "
|
||||
|
||||
rundir(){
|
||||
if [ !-d $RUNDIR ]; then
|
||||
install -d -oi2psvc -m2770 $RUNDIR
|
||||
fi
|
||||
cd $RUNDIR
|
||||
}
|
||||
RUNOPTS=" reseed --yes=true --netdb=$NETDBDIR $MORE_OPTIONS "
|
||||
|
||||
start() {
|
||||
rundir
|
||||
su - $RUNAS $SCRIPT $RUNOPTS --restart=start
|
||||
start-stop-daemon --user $RUNAS --exec $SCRIPT --chdir $RUNDIR --make-pidfile $RUNDIR/reseed.pid --start -- $RUNOPTS
|
||||
}
|
||||
|
||||
stop() {
|
||||
rundir
|
||||
su - $RUNAS $SCRIPT $RUNOPTS --restart=stop
|
||||
}
|
||||
|
||||
start() {
|
||||
rundir
|
||||
su - $RUNAS $SCRIPT $RUNOPTS --restart=restart
|
||||
start-stop-daemon --user $RUNAS --exec $SCRIPT --chdir $RUNDIR --remove-pidfile $RUNDIR/reseed.pid --stop
|
||||
}
|
||||
|
||||
status() {
|
||||
rundir
|
||||
su - $RUNAS $SCRIPT $RUNOPTS --restart=status
|
||||
start-stop-daemon --user $RUNAS --exec $SCRIPT --chdir $RUNDIR --remove-pidfile $RUNDIR/reseed.pid --status
|
||||
}
|
||||
|
||||
restart() {
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
uninstall() {
|
||||
|
5
etc/systemd/system/reseed.d/reseed.conf
Normal file
5
etc/systemd/system/reseed.d/reseed.conf
Normal file
@ -0,0 +1,5 @@
|
||||
# Use this file to configure the contact/signer email used for the reseed service.
|
||||
# without it the reseed will fail to start.
|
||||
|
||||
[Service]
|
||||
Environment="RESEED_EMAIL="
|
17
etc/systemd/system/reseed.d/reseed.service
Normal file
17
etc/systemd/system/reseed.d/reseed.service
Normal file
@ -0,0 +1,17 @@
|
||||
[Unit]
|
||||
Description=I2P reseed service
|
||||
After=network.target
|
||||
StartLimitIntervalSec=0
|
||||
Requires=i2p.service
|
||||
|
||||
[Service]
|
||||
User=i2psvc
|
||||
RuntimeDirectory=/var/lib/i2p/i2p-config/reseed
|
||||
WorkingDirectory=/var/lib/i2p/i2p-config/reseed
|
||||
ExecStart=/usr/bin/reseed-tools reseed --yes=true --netdb=/var/lib/i2p/i2p-config/netDb
|
||||
Restart=always
|
||||
RestartSec=10
|
||||
RuntimeMaxSec=43200
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
25
go.mod
25
go.mod
@ -3,39 +3,18 @@ module i2pgit.org/idk/reseed-tools
|
||||
go 1.13
|
||||
|
||||
require (
|
||||
github.com/btcsuite/btcd v0.21.0-beta // indirect
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.0 // indirect
|
||||
github.com/cretz/bine v0.1.0
|
||||
github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c // indirect
|
||||
github.com/eyedeekay/ramp v0.0.0-20190429201811-305b382042ab // indirect
|
||||
github.com/eyedeekay/checki2cp v0.0.21 // indirect
|
||||
github.com/eyedeekay/sam3 v0.32.32
|
||||
github.com/gogo/protobuf v1.3.2 // indirect
|
||||
github.com/google/gopacket v1.1.19 // indirect
|
||||
github.com/google/uuid v1.2.0 // indirect
|
||||
github.com/go-acme/lego/v4 v4.3.1
|
||||
github.com/gorilla/handlers v1.5.1
|
||||
github.com/jackpal/gateway v1.0.6 // indirect
|
||||
github.com/justinas/alice v1.2.0
|
||||
github.com/koron/go-ssdp v0.0.2 // indirect
|
||||
github.com/libp2p/go-libp2p v0.13.0
|
||||
github.com/libp2p/go-libp2p-core v0.8.0
|
||||
github.com/libp2p/go-libp2p-gostream v0.3.1
|
||||
github.com/libp2p/go-libp2p-http v0.2.0
|
||||
github.com/libp2p/go-libp2p-noise v0.1.2 // indirect
|
||||
github.com/libp2p/go-netroute v0.1.4 // indirect
|
||||
github.com/libp2p/go-sockaddr v0.1.0 // indirect
|
||||
github.com/russross/blackfriday/v2 v2.1.0 // indirect
|
||||
github.com/sridharv/gojava v0.0.0-20180117154747-891bb0316909 // indirect
|
||||
github.com/sridharv/gomobile-java v0.0.0-20160328180427-34d2814361d9 // indirect
|
||||
github.com/throttled/throttled v2.2.4+incompatible
|
||||
github.com/throttled/throttled/v2 v2.7.1
|
||||
github.com/urfave/cli v1.22.5
|
||||
gitlab.com/golang-commonmark/linkify v0.0.0-20200225224916-64bca66f6ad3 // indirect
|
||||
gitlab.com/golang-commonmark/markdown v0.0.0-20191127184510-91b5b3c99c19
|
||||
go.opencensus.io v0.22.6 // indirect
|
||||
go.uber.org/multierr v1.6.0 // indirect
|
||||
go.uber.org/zap v1.16.0 // indirect
|
||||
golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad // indirect
|
||||
golang.org/x/net v0.0.0-20210119194325-5f4716e94777 // indirect
|
||||
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c // indirect
|
||||
golang.org/x/text v0.3.5
|
||||
)
|
||||
|
4
main.go
4
main.go
@ -18,8 +18,8 @@ func main() {
|
||||
runtime.GOMAXPROCS(runtime.NumCPU() / 2)
|
||||
|
||||
app := cli.NewApp()
|
||||
app.Name = "i2p-tools-1"
|
||||
app.Version = "0.1.7"
|
||||
app.Name = "reseed-tools"
|
||||
app.Version = "0.1.9"
|
||||
app.Usage = "I2P tools and reseed server"
|
||||
app.Author = "eyedeekay"
|
||||
app.Email = "hankhill19580@gmail.com"
|
||||
|
35
postinstall-pak
Executable file
35
postinstall-pak
Executable file
@ -0,0 +1,35 @@
|
||||
#! /usr/bin/env sh
|
||||
RESEED_MESSAGE="Reseed Tools requires you to set an email for contact purposes.
|
||||
This is in case your reseed goes down.
|
||||
Please enter your email below."
|
||||
|
||||
RESEED_CONF="# Use this file to configure the contact/signer email used for the reseed service.
|
||||
# without it the reseed will fail to start.
|
||||
|
||||
[Service]
|
||||
Environment=\"RESEED_EMAIL="
|
||||
|
||||
RESEED_DEFAULT="#Edit the contact/signing email used by your reseed server here
|
||||
export RESEED_EMAIL=\""
|
||||
|
||||
mkdir -p /etc/systemd/system/reseed.d/
|
||||
|
||||
if [ -f /usr/bin/zenity ]; then
|
||||
RESEED_EMAIL=$(zenity --entry --title "Reseed Configuration" --text "$RESEED_MESSAGE" 10 30 3>&1 1>&2 2>&3)
|
||||
echo "$RESEED_DEFAULT$RESEED_EMAIL\"" >> /etc/default/reseed
|
||||
echo "$RESEED_CONF$RESEED_EMAIL\"" >> /etc/systemd/system/reseed.d/reseed.conf
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ -t 1 ] ; then
|
||||
echo "proceeding with terminal";
|
||||
else
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ -f /usr/bin/whiptail ]; then
|
||||
RESEED_EMAIL=$(whiptail --inputbox "$RESEED_MESSAGE" 10 30 3>&1 1>&2 2>&3)
|
||||
echo "$RESEED_DEFAULT$RESEED_EMAIL\"" >> /etc/default/reseed
|
||||
echo "$RESEED_CONF$RESEED_EMAIL\"" >> /etc/systemd/system/reseed.d/reseed.conf
|
||||
exit 0
|
||||
fi
|
14
su3/su3.go
14
su3/su3.go
@ -23,16 +23,20 @@ const (
|
||||
SigTypeRSAWithSHA384 = uint16(5)
|
||||
SigTypeRSAWithSHA512 = uint16(6)
|
||||
|
||||
ContentTypeUnknown = uint8(0)
|
||||
ContentTypeRouter = uint8(1)
|
||||
ContentTypePlugin = uint8(2)
|
||||
ContentTypeReseed = uint8(3)
|
||||
ContentTypeNews = uint8(4)
|
||||
ContentTypeUnknown = uint8(0)
|
||||
ContentTypeRouter = uint8(1)
|
||||
ContentTypePlugin = uint8(2)
|
||||
ContentTypeReseed = uint8(3)
|
||||
ContentTypeNews = uint8(4)
|
||||
ContentTypeBlocklist = uint8(5)
|
||||
|
||||
FileTypeZIP = uint8(0)
|
||||
FileTypeXML = uint8(1)
|
||||
FileTypeHTML = uint8(2)
|
||||
FileTypeXMLGZ = uint8(3)
|
||||
FileTypeTXTGZ = uint8(4)
|
||||
FileTypeDMG = uint8(5)
|
||||
FileTypeEXE = uint8(6)
|
||||
|
||||
magicBytes = "I2Psu3"
|
||||
)
|
||||
|
Reference in New Issue
Block a user