Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
83cf8bdcde | ||
![]() |
2a23c5ea13 | ||
![]() |
a666afef7c | ||
![]() |
ba79de0135 | ||
![]() |
0ede48bfc6 |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -22,3 +22,5 @@ audit.json
|
|||||||
client.yaml
|
client.yaml
|
||||||
plugin.yaml
|
plugin.yaml
|
||||||
err
|
err
|
||||||
|
/plugin-linux-amd64.yaml
|
||||||
|
/client-linux-amd64.yaml
|
123
Makefile
123
Makefile
@@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
VERSION=$(shell ./reseed-tools-linux-amd64 version 2>/dev/null)
|
VERSION=$(shell /usr/bin/go run . version 2>/dev/null)
|
||||||
APP=reseed-tools
|
APP=reseed-tools
|
||||||
USER_GH=eyedeekay
|
USER_GH=eyedeekay
|
||||||
SIGNER=hankhill19580@gmail.com
|
SIGNER=hankhill19580@gmail.com
|
||||||
@@ -12,7 +12,7 @@ prefix?=/
|
|||||||
GOOS?=$(shell uname -s | tr A-Z a-z)
|
GOOS?=$(shell uname -s | tr A-Z a-z)
|
||||||
GOARCH?="amd64"
|
GOARCH?="amd64"
|
||||||
|
|
||||||
ARG=-v -tags netgo -ldflags '-w -extldflags "-static"'
|
ARG=-v -tags netgo,osusergo -ldflags '-w -extldflags "-static"'
|
||||||
|
|
||||||
#MIN_GO_VERSION=`ls /usr/lib/go-1.14 2>/dev/null >/dev/null && echo 1.14`
|
#MIN_GO_VERSION=`ls /usr/lib/go-1.14 2>/dev/null >/dev/null && echo 1.14`
|
||||||
MIN_GO_VERSION?=1.16
|
MIN_GO_VERSION?=1.16
|
||||||
@@ -23,10 +23,10 @@ I2P_GID=$(shell id -g i2psvc)
|
|||||||
WHOAMI=$(shell whoami)
|
WHOAMI=$(shell whoami)
|
||||||
|
|
||||||
echo:
|
echo:
|
||||||
@echo "type make version to do release $(APP) $(VERSION) $(GOOS) $(GOARCH) $(MIN_GO_VERSION) $(I2P_UID) $(I2P_GID)"
|
@echo "type make version to do release '$(APP)' '$(VERSION)' $(GOOS) $(GOARCH) $(MIN_GO_VERSION) $(I2P_UID) $(I2P_GID)"
|
||||||
|
|
||||||
host:
|
host:
|
||||||
/usr/bin/go build -o reseed-tools-host
|
/usr/bin/go build -o reseed-tools-host 2>/dev/null 1>/dev/null
|
||||||
|
|
||||||
index:
|
index:
|
||||||
edgar
|
edgar
|
||||||
@@ -101,70 +101,7 @@ unfork:
|
|||||||
make gofmt build-unfork
|
make gofmt build-unfork
|
||||||
|
|
||||||
gofmt:
|
gofmt:
|
||||||
gofmt -w main.go cmd/*.go reseed/*.go su3/*.go
|
find . -name '*.go' -exec gofumpt -w -s -extra {} \;
|
||||||
|
|
||||||
try:
|
|
||||||
mkdir -p tmp && \
|
|
||||||
cd tmp && \
|
|
||||||
../reseed-tools-$(GOOS)-$(GOARCH) reseed --signer=fake@mail.i2p --netdb=${HOME}/.i2p/netDb --tlsHost=your-domain.tld --i2p
|
|
||||||
|
|
||||||
stop:
|
|
||||||
mkdir -p tmp && \
|
|
||||||
cd tmp && \
|
|
||||||
../reseed-tools-$(GOOS)-$(GOARCH) reseed --signer=fake@mail.i2p --netdb=${HOME}/.i2p/netDb --tlsHost=your-domain.tld --i2p
|
|
||||||
|
|
||||||
docker:
|
|
||||||
docker build -t eyedeekay/reseed .
|
|
||||||
|
|
||||||
docker-push: docker
|
|
||||||
docker push --disable-content-trust=false eyedeekay/reseed:$(VERSION)
|
|
||||||
|
|
||||||
users:
|
|
||||||
docker run --rm eyedeekay/reseed cat /etc/passwd
|
|
||||||
|
|
||||||
docker-ls:
|
|
||||||
docker run --rm \
|
|
||||||
--user $(I2P_UID) \
|
|
||||||
--group-add $(I2P_GID) \
|
|
||||||
--name reseed \
|
|
||||||
--publish 8443:8443 \
|
|
||||||
--volume /var/lib/i2p/i2p-config/netDb:/var/lib/i2p/i2p-config/netDb \
|
|
||||||
eyedeekay/reseed ls /var/lib/i2p/i2p-config -lah
|
|
||||||
|
|
||||||
docker-server:
|
|
||||||
docker run -itd \
|
|
||||||
--name reseed \
|
|
||||||
--user $(I2P_UID) \
|
|
||||||
--group-add $(I2P_GID) \
|
|
||||||
--publish 8443:8443 \
|
|
||||||
--restart=always \
|
|
||||||
--volume /var/lib/i2p/i2p-config/netDb:/var/lib/i2p/i2p-config/netDb:z \
|
|
||||||
--volume reseed-keys:/var/lib/i2p/i2p-config/reseed \
|
|
||||||
eyedeekay/reseed \
|
|
||||||
--signer=hankhill19580@gmail.com
|
|
||||||
docker logs -f reseed
|
|
||||||
|
|
||||||
docker-run:
|
|
||||||
docker run -itd \
|
|
||||||
--name reseed \
|
|
||||||
--user $(I2P_UID) \
|
|
||||||
--group-add $(I2P_GID) \
|
|
||||||
--publish 8443:8443 \
|
|
||||||
--volume /var/lib/i2p/i2p-config/netDb:/var/lib/i2p/i2p-config/netDb:z \
|
|
||||||
--volume reseed-keys:/var/lib/i2p/i2p-config/reseed \
|
|
||||||
eyedeekay/reseed \
|
|
||||||
--signer=hankhill19580@gmail.com
|
|
||||||
|
|
||||||
docker-homerun:
|
|
||||||
docker run -itd \
|
|
||||||
--name reseed \
|
|
||||||
--user 1000 \
|
|
||||||
--group-add 1000 \
|
|
||||||
--publish 8443:8443 \
|
|
||||||
--volume $(HOME)/i2p/netDb:/var/lib/i2p/i2p-config/netDb:z \
|
|
||||||
--volume reseed-keys:/var/lib/i2p/i2p-config/reseed:z \
|
|
||||||
eyedeekay/reseed \
|
|
||||||
--signer=hankhill19580@gmail.com
|
|
||||||
|
|
||||||
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64/jre/
|
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64/jre/
|
||||||
export CGO_CFLAGS=-I/usr/lib/jvm/java-8-openjdk-amd64/include/ -I/usr/lib/jvm/java-8-openjdk-amd64/include/linux/
|
export CGO_CFLAGS=-I/usr/lib/jvm/java-8-openjdk-amd64/include/ -I/usr/lib/jvm/java-8-openjdk-amd64/include/linux/
|
||||||
@@ -177,10 +114,15 @@ jar: gojava
|
|||||||
echo $(JAVA_HOME)
|
echo $(JAVA_HOME)
|
||||||
./gojava -v -o reseed.jar -s . build ./reseed
|
./gojava -v -o reseed.jar -s . build ./reseed
|
||||||
|
|
||||||
release: version upload binary upload-bin plugins upload-su3s debs upload-debs
|
release: version plugins upload-su3s
|
||||||
|
|
||||||
|
tag:
|
||||||
|
git tag -a v$(VERSION) -m "Release $(VERSION)"
|
||||||
|
git push --tags
|
||||||
|
|
||||||
version:
|
version:
|
||||||
head -n 5 README.md | github-release release -s $(GITHUB_TOKEN) -u $(USER_GH) -r $(APP) -t v$(VERSION) -d -; true
|
#head -n 5 README.md | github-release release -s $(GITHUB_TOKEN) -u $(USER_GH) -r $(APP) -t v$(VERSION) -d -; true
|
||||||
|
echo "make version is deprecated, use make tag instead"
|
||||||
|
|
||||||
delete-version:
|
delete-version:
|
||||||
github-release delete -s $(GITHUB_TOKEN) -u $(USER_GH) -r $(APP) -t v$(VERSION)
|
github-release delete -s $(GITHUB_TOKEN) -u $(USER_GH) -r $(APP) -t v$(VERSION)
|
||||||
@@ -188,22 +130,6 @@ delete-version:
|
|||||||
edit:
|
edit:
|
||||||
cat README.md | github-release edit -s $(GITHUB_TOKEN) -u $(USER_GH) -r $(APP) -t v$(VERSION) -d -
|
cat README.md | github-release edit -s $(GITHUB_TOKEN) -u $(USER_GH) -r $(APP) -t v$(VERSION) -d -
|
||||||
|
|
||||||
upload: tar
|
|
||||||
github-release upload -s $(GITHUB_TOKEN) -u $(USER_GH) -r $(APP) -t v$(VERSION) -f reseed-tools.tar.gz -n "reseed-tools.tar.gz"; true
|
|
||||||
|
|
||||||
binary:
|
|
||||||
##export GOOS=darwin; export GOARCH=amd64; make build
|
|
||||||
###export GOOS=darwin; export GOARCH=arm64; make build
|
|
||||||
export GOOS=linux; export GOARCH=amd64; make build
|
|
||||||
export GOOS=linux; export GOARCH=386; make build
|
|
||||||
export GOOS=linux; export GOARCH=arm; make build
|
|
||||||
export GOOS=linux; export GOARCH=arm64; make build
|
|
||||||
export GOOS=openbsd; export GOARCH=amd64; make build
|
|
||||||
export GOOS=freebsd; export GOARCH=386; make build
|
|
||||||
export GOOS=freebsd; export GOARCH=amd64; make build
|
|
||||||
export GOOS=windows; export GOARCH=amd64; make build
|
|
||||||
export GOOS=windows; export GOARCH=386; make build
|
|
||||||
|
|
||||||
plugins:
|
plugins:
|
||||||
#export GOOS=darwin; export GOARCH=amd64; make su3s
|
#export GOOS=darwin; export GOARCH=amd64; make su3s
|
||||||
#export GOOS=darwin; export GOARCH=arm64; make su3s
|
#export GOOS=darwin; export GOARCH=arm64; make su3s
|
||||||
@@ -223,25 +149,6 @@ debs:
|
|||||||
export GOOS=linux; export GOARCH=arm; make build checkinstall
|
export GOOS=linux; export GOARCH=arm; make build checkinstall
|
||||||
export GOOS=linux; export GOARCH=arm64; make build checkinstall
|
export GOOS=linux; export GOARCH=arm64; make build checkinstall
|
||||||
|
|
||||||
upload-debs:
|
|
||||||
export GOOS=linux; export GOARCH=386; make upload-single-deb
|
|
||||||
export GOOS=linux; export GOARCH=amd64; make upload-single-deb
|
|
||||||
export GOOS=linux; export GOARCH=arm; make upload-single-deb
|
|
||||||
export GOOS=linux; export GOARCH=arm64; make upload-single-deb
|
|
||||||
|
|
||||||
upload-bin:
|
|
||||||
#export GOOS=darwin; export GOARCH=amd64; make upload-single-bin
|
|
||||||
#export GOOS=darwin; export GOARCH=arm64; make upload-single-bin
|
|
||||||
export GOOS=linux; export GOARCH=386; make upload-single-bin
|
|
||||||
export GOOS=linux; export GOARCH=amd64; make upload-single-bin
|
|
||||||
export GOOS=linux; export GOARCH=arm; make upload-single-bin
|
|
||||||
export GOOS=linux; export GOARCH=arm64; make upload-single-bin
|
|
||||||
export GOOS=openbsd; export GOARCH=amd64; make upload-single-bin
|
|
||||||
export GOOS=freebsd; export GOARCH=386; make upload-single-bin
|
|
||||||
export GOOS=freebsd; export GOARCH=amd64; make upload-single-bin
|
|
||||||
export GOOS=windows; export GOARCH=amd64; make upload-single-bin
|
|
||||||
export GOOS=windows; export GOARCH=386; make upload-single-bin
|
|
||||||
|
|
||||||
rm-su3s:
|
rm-su3s:
|
||||||
rm *.su3 -f
|
rm *.su3 -f
|
||||||
|
|
||||||
@@ -274,12 +181,6 @@ upload-su3s:
|
|||||||
download-single-su3:
|
download-single-su3:
|
||||||
wget-ds "https://github.com/eyedeekay/reseed-tools/releases/download/v$(VERSION)/reseed-tools-$(GOOS)-$(GOARCH).su3"
|
wget-ds "https://github.com/eyedeekay/reseed-tools/releases/download/v$(VERSION)/reseed-tools-$(GOOS)-$(GOARCH).su3"
|
||||||
|
|
||||||
upload-single-deb:
|
|
||||||
github-release upload -s $(GITHUB_TOKEN) -u $(USER_GH) -r $(APP) -t v$(VERSION) -f reseed-tools_$(VERSION)-1_"$(GOARCH)".deb -l "`sha256sum reseed-tools_$(VERSION)-1_$(GOARCH).deb`" -n "reseed-tools_$(VERSION)-1_$(GOARCH).deb"; true
|
|
||||||
|
|
||||||
upload-single-bin:
|
|
||||||
github-release upload -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)"; true
|
|
||||||
|
|
||||||
upload-single-su3:
|
upload-single-su3:
|
||||||
github-release upload -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"; true
|
github-release upload -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"; true
|
||||||
|
|
||||||
|
@@ -6,6 +6,7 @@ import (
|
|||||||
"github.com/urfave/cli/v3"
|
"github.com/urfave/cli/v3"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// NewKeygenCommand creates a new CLI command for generating keys.
|
||||||
func NewKeygenCommand() *cli.Command {
|
func NewKeygenCommand() *cli.Command {
|
||||||
return &cli.Command{
|
return &cli.Command{
|
||||||
Name: "keygen",
|
Name: "keygen",
|
||||||
|
@@ -56,6 +56,7 @@ func providedReseeds(c *cli.Context) []string {
|
|||||||
return reseed.AllReseeds
|
return reseed.AllReseeds
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NewReseedCommand creates a new CLI command for starting a reseed server.
|
||||||
func NewReseedCommand() *cli.Command {
|
func NewReseedCommand() *cli.Command {
|
||||||
ndb, err := getmeanetdb.WhereIstheNetDB()
|
ndb, err := getmeanetdb.WhereIstheNetDB()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -394,7 +395,7 @@ func reseedAction(c *cli.Context) error {
|
|||||||
if onionTlsHost == "" {
|
if onionTlsHost == "" {
|
||||||
onionTlsHost = torutil.OnionServiceIDFromPrivateKey(ed25519.PrivateKey(ok)) + ".onion"
|
onionTlsHost = torutil.OnionServiceIDFromPrivateKey(ed25519.PrivateKey(ok)) + ".onion"
|
||||||
}
|
}
|
||||||
err = ioutil.WriteFile(c.String("onionKey"), ok, 0644)
|
err = ioutil.WriteFile(c.String("onionKey"), ok, 0o644)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalln(err.Error())
|
log.Fatalln(err.Error())
|
||||||
}
|
}
|
||||||
@@ -655,7 +656,6 @@ func reseedI2P(c *cli.Context, i2pTlsCert, i2pTlsKey string, i2pIdentKey i2pkeys
|
|||||||
if err := server.ListenAndServeI2P(c.String("samaddr"), i2pIdentKey); err != nil {
|
if err := server.ListenAndServeI2P(c.String("samaddr"), i2pIdentKey); err != nil {
|
||||||
log.Fatalln(err)
|
log.Fatalln(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Printf("Onion server started on %s\n", server.Addr)
|
log.Printf("Onion server started on %s\n", server.Addr)
|
||||||
@@ -710,7 +710,7 @@ func downloadRemoteNetDB(remote, password, path, samaddr string) error {
|
|||||||
if bodyBytes, err := ioutil.ReadAll(resp.Body); err != nil {
|
if bodyBytes, err := ioutil.ReadAll(resp.Body); err != nil {
|
||||||
return err
|
return err
|
||||||
} else {
|
} else {
|
||||||
if err := ioutil.WriteFile("netDb.tar.gz", bodyBytes, 0644); err != nil {
|
if err := ioutil.WriteFile("netDb.tar.gz", bodyBytes, 0o644); err != nil {
|
||||||
return err
|
return err
|
||||||
} else {
|
} else {
|
||||||
dbPath := filepath.Join(path, "reseed-netDb")
|
dbPath := filepath.Join(path, "reseed-netDb")
|
||||||
|
@@ -19,6 +19,8 @@ import (
|
|||||||
"github.com/eyedeekay/onramp"
|
"github.com/eyedeekay/onramp"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// NewShareCommand creates a new CLI Command for sharing the netDb over I2P with a password.
|
||||||
|
// Can be used to combine the local netDb with the netDb of a remote I2P router.
|
||||||
func NewShareCommand() *cli.Command {
|
func NewShareCommand() *cli.Command {
|
||||||
ndb, err := getmeanetdb.WhereIstheNetDB()
|
ndb, err := getmeanetdb.WhereIstheNetDB()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
20
cmd/utils.go
20
cmd/utils.go
@@ -55,9 +55,11 @@ type MyUser struct {
|
|||||||
func (u *MyUser) GetEmail() string {
|
func (u *MyUser) GetEmail() string {
|
||||||
return u.Email
|
return u.Email
|
||||||
}
|
}
|
||||||
|
|
||||||
func (u MyUser) GetRegistration() *registration.Resource {
|
func (u MyUser) GetRegistration() *registration.Resource {
|
||||||
return u.Registration
|
return u.Registration
|
||||||
}
|
}
|
||||||
|
|
||||||
func (u *MyUser) GetPrivateKey() crypto.PrivateKey {
|
func (u *MyUser) GetPrivateKey() crypto.PrivateKey {
|
||||||
return u.key
|
return u.key
|
||||||
}
|
}
|
||||||
@@ -150,7 +152,7 @@ func checkUseAcmeCert(tlsHost, signer, cadirurl string, tlsCert, tlsKey *string,
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
filename := tlsHost + signer + ".acme.key"
|
filename := tlsHost + signer + ".acme.key"
|
||||||
keypem, err := os.OpenFile(filename, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0600)
|
keypem, err := os.OpenFile(filename, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0o600)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -201,8 +203,8 @@ func renewAcmeIssuedCert(client *lego.Client, user MyUser, tlsHost string, tlsCe
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
ioutil.WriteFile(tlsHost+".pem", certificates.PrivateKey, 0600)
|
ioutil.WriteFile(tlsHost+".pem", certificates.PrivateKey, 0o600)
|
||||||
ioutil.WriteFile(tlsHost+".crt", certificates.Certificate, 0600)
|
ioutil.WriteFile(tlsHost+".crt", certificates.Certificate, 0o600)
|
||||||
// ioutil.WriteFile(tlsHost+".crl", certificates.PrivateKey, 0600)
|
// ioutil.WriteFile(tlsHost+".crl", certificates.PrivateKey, 0600)
|
||||||
*tlsCert = tlsHost + ".crt"
|
*tlsCert = tlsHost + ".crt"
|
||||||
*tlsKey = tlsHost + ".pem"
|
*tlsKey = tlsHost + ".pem"
|
||||||
@@ -238,8 +240,8 @@ func newAcmeIssuedCert(client *lego.Client, user MyUser, tlsHost string, tlsCert
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
ioutil.WriteFile(tlsHost+".pem", certificates.PrivateKey, 0600)
|
ioutil.WriteFile(tlsHost+".pem", certificates.PrivateKey, 0o600)
|
||||||
ioutil.WriteFile(tlsHost+".crt", certificates.Certificate, 0600)
|
ioutil.WriteFile(tlsHost+".crt", certificates.Certificate, 0o600)
|
||||||
// ioutil.WriteFile(tlsHost+".crl", certificates.PrivateKey, 0600)
|
// ioutil.WriteFile(tlsHost+".crl", certificates.PrivateKey, 0600)
|
||||||
*tlsCert = tlsHost + ".crt"
|
*tlsCert = tlsHost + ".crt"
|
||||||
*tlsKey = tlsHost + ".pem"
|
*tlsKey = tlsHost + ".pem"
|
||||||
@@ -303,7 +305,7 @@ func createSigningCertificate(signerID string) error {
|
|||||||
|
|
||||||
// save signing private key
|
// save signing private key
|
||||||
privFile := signerFile(signerID) + ".pem"
|
privFile := signerFile(signerID) + ".pem"
|
||||||
keyOut, err := os.OpenFile(privFile, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0600)
|
keyOut, err := os.OpenFile(privFile, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0o600)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to open %s for writing: %v", privFile, err)
|
return fmt.Errorf("failed to open %s for writing: %v", privFile, err)
|
||||||
}
|
}
|
||||||
@@ -314,7 +316,7 @@ func createSigningCertificate(signerID string) error {
|
|||||||
|
|
||||||
// CRL
|
// CRL
|
||||||
crlFile := signerFile(signerID) + ".crl"
|
crlFile := signerFile(signerID) + ".crl"
|
||||||
crlOut, err := os.OpenFile(crlFile, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0600)
|
crlOut, err := os.OpenFile(crlFile, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0o600)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to open %s for writing: %s", crlFile, err)
|
return fmt.Errorf("failed to open %s for writing: %s", crlFile, err)
|
||||||
}
|
}
|
||||||
@@ -373,7 +375,7 @@ func CreateTLSCertificate(host string) error {
|
|||||||
|
|
||||||
// save the TLS private key
|
// save the TLS private key
|
||||||
privFile := host + ".pem"
|
privFile := host + ".pem"
|
||||||
keyOut, err := os.OpenFile(privFile, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0600)
|
keyOut, err := os.OpenFile(privFile, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0o600)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to open %s for writing: %v", privFile, err)
|
return fmt.Errorf("failed to open %s for writing: %v", privFile, err)
|
||||||
}
|
}
|
||||||
@@ -388,7 +390,7 @@ func CreateTLSCertificate(host string) error {
|
|||||||
|
|
||||||
// CRL
|
// CRL
|
||||||
crlFile := host + ".crl"
|
crlFile := host + ".crl"
|
||||||
crlOut, err := os.OpenFile(crlFile, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0600)
|
crlOut, err := os.OpenFile(crlFile, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0o600)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to open %s for writing: %s", crlFile, err)
|
return fmt.Errorf("failed to open %s for writing: %s", crlFile, err)
|
||||||
}
|
}
|
||||||
|
@@ -32,7 +32,6 @@ func I2PHome() string {
|
|||||||
return usrCheck
|
return usrCheck
|
||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewSu3VerifyCommand() *cli.Command {
|
func NewSu3VerifyCommand() *cli.Command {
|
||||||
@@ -101,7 +100,7 @@ func su3VerifyAction(c *cli.Context) error {
|
|||||||
|
|
||||||
if c.Bool("extract") {
|
if c.Bool("extract") {
|
||||||
// @todo: don't assume zip
|
// @todo: don't assume zip
|
||||||
ioutil.WriteFile("extracted.zip", su3File.BodyBytes(), 0755)
|
ioutil.WriteFile("extracted.zip", su3File.BodyBytes(), 0o755)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@@ -33,11 +33,14 @@ var SupportedLanguages = []language.Tag{
|
|||||||
language.Korean,
|
language.Korean,
|
||||||
language.Bengali,
|
language.Bengali,
|
||||||
}
|
}
|
||||||
var CachedLanguagePages = map[string]string{}
|
|
||||||
var CachedDataPages = map[string][]byte{}
|
var (
|
||||||
|
CachedLanguagePages = map[string]string{}
|
||||||
|
CachedDataPages = map[string][]byte{}
|
||||||
|
)
|
||||||
|
|
||||||
func StableContentPath() (string, error) {
|
func StableContentPath() (string, error) {
|
||||||
var BaseContentPath, ContentPathError = ContentPath()
|
BaseContentPath, ContentPathError := ContentPath()
|
||||||
if _, err := os.Stat(BaseContentPath); os.IsNotExist(err) {
|
if _, err := os.Stat(BaseContentPath); os.IsNotExist(err) {
|
||||||
if err := unembed.Unembed(f, BaseContentPath); err != nil {
|
if err := unembed.Unembed(f, BaseContentPath); err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
@@ -59,6 +62,7 @@ var header = []byte(`<!DOCTYPE html>
|
|||||||
<script src="script.js"></script>
|
<script src="script.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>`)
|
<body>`)
|
||||||
|
|
||||||
var footer = []byte(` </body>
|
var footer = []byte(` </body>
|
||||||
</html>`)
|
</html>`)
|
||||||
|
|
||||||
@@ -69,7 +73,7 @@ func ContentPath() (string, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
//exPath := filepath.Dir(ex)
|
// exPath := filepath.Dir(ex)
|
||||||
if _, err := os.Stat(filepath.Join(exPath, "content")); err != nil {
|
if _, err := os.Stat(filepath.Join(exPath, "content")); err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
@@ -60,11 +60,11 @@ func PingWriteContent(urlInput string) error {
|
|||||||
result, err := Ping(urlInput)
|
result, err := Ping(urlInput)
|
||||||
if result {
|
if result {
|
||||||
log.Printf("Ping: %s OK", urlInput)
|
log.Printf("Ping: %s OK", urlInput)
|
||||||
err := ioutil.WriteFile(path, []byte("Alive: Status OK"), 0644)
|
err := ioutil.WriteFile(path, []byte("Alive: Status OK"), 0o644)
|
||||||
return err
|
return err
|
||||||
} else {
|
} else {
|
||||||
log.Printf("Ping: %s %s", urlInput, err)
|
log.Printf("Ping: %s %s", urlInput, err)
|
||||||
err := ioutil.WriteFile(path, []byte("Dead: "+err.Error()), 0644)
|
err := ioutil.WriteFile(path, []byte("Dead: "+err.Error()), 0o644)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -114,7 +114,7 @@ func SecureRandomAlphaString() string {
|
|||||||
|
|
||||||
// SecureRandomBytes returns the requested number of bytes using crypto/rand
|
// SecureRandomBytes returns the requested number of bytes using crypto/rand
|
||||||
func SecureRandomBytes(length int) []byte {
|
func SecureRandomBytes(length int) []byte {
|
||||||
var randomBytes = make([]byte, length)
|
randomBytes := make([]byte, length)
|
||||||
_, err := rand.Read(randomBytes)
|
_, err := rand.Read(randomBytes)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal("Unable to generate random bytes")
|
log.Fatal("Unable to generate random bytes")
|
||||||
|
@@ -1,3 +1,3 @@
|
|||||||
package reseed
|
package reseed
|
||||||
|
|
||||||
const Version = "0.3.3"
|
const Version = "0.3.4"
|
||||||
|
@@ -105,7 +105,7 @@ func NewSigningCertificate(signerID string, privateKey *rsa.PrivateKey) ([]byte,
|
|||||||
publicKey := &privateKey.PublicKey
|
publicKey := &privateKey.PublicKey
|
||||||
|
|
||||||
// create a self-signed certificate. template = parent
|
// create a self-signed certificate. template = parent
|
||||||
var parent = template
|
parent := template
|
||||||
cert, err := x509.CreateCertificate(rand.Reader, template, parent, publicKey, privateKey)
|
cert, err := x509.CreateCertificate(rand.Reader, template, parent, publicKey, privateKey)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
Reference in New Issue
Block a user