Something not right with the key volume on user installs

This commit is contained in:
idk
2020-05-06 21:19:14 -04:00
parent da1beba872
commit 824441fa69
4 changed files with 26 additions and 12 deletions

View File

@ -10,5 +10,6 @@ RUN apt-get update && \
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"'
USER $I2P_UID
VOLUME /var/lib/i2p/i2p-config/reseed
WORKDIR /var/lib/i2p/i2p-config/reseed
ENTRYPOINT [ "/var/lib/i2p/go/src/github.com/eyedeekay/i2p-tools-1/i2p-tools-1", "reseed", "--yes=true", "--netdb=/var/lib/i2p/i2p-config/netDb" ]

View File

@ -14,6 +14,8 @@ MIN_GO_VERSION?=1.13
I2P_UID=$(shell id -u i2psvc)
I2P_GID=$(shell id -g i2psvc)
WHOAMI=$(shell whoami)
echo:
@echo "type make version to do release $(APP) $(VERSION) $(GOOS) $(GOARCH) $(MIN_GO_VERSION) $(I2P_UID) $(I2P_GID)"
@ -113,7 +115,7 @@ docker-server:
docker logs -f reseed
docker-run:
docker run --rm -itd \
docker run -itd \
--name reseed \
--user $(I2P_UID) \
--group-add $(I2P_GID) \
@ -122,3 +124,14 @@ docker-run:
--volume /var/lib/i2p/i2p-config/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 $(HOME)/i2p/reseed-keys:/var/lib/i2p/i2p-config/reseed:z \
eyedeekay/reseed \
--signer=hankhill19580@gmail.com

View File

@ -227,7 +227,7 @@ func reseedAction(c *cli.Context) {
}
// prompt to create tls keys if they don't exist?
auto := c.Bool("yes")
auto := c.Bool("yes")
err := checkOrNewTLSCert(i2pTlsHost, &i2pTlsCert, &i2pTlsKey, auto)
if nil != err {
log.Fatalln(err)
@ -267,7 +267,7 @@ func reseedAction(c *cli.Context) {
}
// prompt to create tls keys if they don't exist?
auto := c.Bool("yes")
auto := c.Bool("yes")
err := checkOrNewTLSCert(onionTlsHost, &onionTlsCert, &onionTlsKey, auto)
if nil != err {
log.Fatalln(err)
@ -289,7 +289,7 @@ func reseedAction(c *cli.Context) {
}
// prompt to create tls keys if they don't exist?
auto := c.Bool("yes")
auto := c.Bool("yes")
err := checkOrNewTLSCert(tlsHost, &tlsCert, &tlsKey, auto)
if nil != err {
log.Fatalln(err)
@ -309,7 +309,7 @@ func reseedAction(c *cli.Context) {
}
// load our signing privKey
auto := c.Bool("yes")
auto := c.Bool("yes")
privKey, err := getOrNewSigningCert(&signerKey, signerID, auto)
if nil != err {
log.Fatalln(err)

View File

@ -42,14 +42,14 @@ func signerFile(signerID string) string {
func getOrNewSigningCert(signerKey *string, signerID string, auto bool) (*rsa.PrivateKey, error) {
if _, err := os.Stat(*signerKey); nil != err {
fmt.Printf("Unable to read signing key '%s'\n", *signerKey)
if !auto {
fmt.Printf("Would you like to generate a new signing key for %s? (y or n): ", signerID)
reader := bufio.NewReader(os.Stdin)
input, _ := reader.ReadString('\n')
if []byte(input)[0] != 'y' {
return nil, fmt.Errorf("A signing key is required")
if !auto {
fmt.Printf("Would you like to generate a new signing key for %s? (y or n): ", signerID)
reader := bufio.NewReader(os.Stdin)
input, _ := reader.ReadString('\n')
if []byte(input)[0] != 'y' {
return nil, fmt.Errorf("A signing key is required")
}
}
}
if err := createSigningCertificate(signerID); nil != err {
return nil, err
}