Giter Site home page Giter Site logo

Comments (22)

cypherhat avatar cypherhat commented on August 30, 2024 1

Ok, let me review. Probably won't get to it until later this evening.

from vault-ethereum.

caddoo avatar caddoo commented on August 30, 2024 1

@cypherhat The official vault docker image is based off this OS:
https://alpinelinux.org FYI

from vault-ethereum.

caddoo avatar caddoo commented on August 30, 2024 1

Due to the difference in the libraries between glibc and musl I recompiled in the docker file and seem to have got it working.

For reference is my new vault docker file:

FROM vault:latest

# Install build tools
RUN apk add --update alpine-sdk

# Make new directory for plugins
RUN mkdir /vault/plugins
# Download and compile Ethereum plugin
RUN apk update \
    && apk add go git
RUN go get github.com/immutability-io/vault-ethereum \
    && go build github.com/immutability-io/vault-ethereum
RUN mv /root/go/bin/vault-ethereum /vault/plugins/vault-etheruem

from vault-ethereum.

caddoo avatar caddoo commented on August 30, 2024

After some help from https://github.com/sirlatrom on the docker community slack, he determined because the base vault docker image uses alpine which uses musl and the plugin needs glibc it failed.

I then updated my vault dockerfile to install the following:
https://github.com/sgerrand/alpine-pkg-glibc

The error now is

Error enabling: Error making API request.

URL: POST http://192.168.1.60:9200/v1/sys/mounts/ethereum
Code: 400. Errors:

* plugin exited before we could connect

from vault-ethereum.

cypherhat avatar cypherhat commented on August 30, 2024

What does your vault config look like? Specifically, is api_addr set?

from vault-ethereum.

cypherhat avatar cypherhat commented on August 30, 2024

My vault config (on Darwin) looks like this. Note: I am using TLS to talk to vault:

"default_lease_ttl" = "24h"

"max_lease_ttl" = "24h"

"backend" "file" {
  "path" = "/Users/immutability/etc/vault.d/data"
}

"api_addr" = "https://localhost:8200"

"listener" "tcp" {
  "address" = "localhost:8200"

  "tls_cert_file" = "/Users/immutability/etc/vault.d/vault.crt"
  "tls_client_ca_file" = "/Users/immutability/etc/vault.d/root.crt"
  "tls_key_file" = "/Users/immutability/etc/vault.d/vault.key"
}

"plugin_directory" = "/Users/immutability/etc/vault.d/vault_plugins"

from vault-ethereum.

caddoo avatar caddoo commented on August 30, 2024

{ "api_addr":"http://127.0.0.1:8200", "plugin_directory":"/vault/plugins", "backend":{ "consul":{ "scheme":"http", "address":"192.168.1.60:9500", "advertise_addr":"http://192.168.1.60", "path":"vault/" } }, "listener":{ "tcp":{ "address":"0.0.0.0:8200", "tls_disable":"true" } } }

That is exactly the config that is running. If I use postman to interact with the API publically. I get the same error message:

POST /sys/mounts/ethereum

{
	"type": "plugin",
  "config": {
    "force_no_cache": true
  },
  "plugin_name": "ethereum-plugin"
}

Response:

{
    "errors": [
        "plugin exited before we could connect"
    ]
}

from vault-ethereum.

caddoo avatar caddoo commented on August 30, 2024

@cypherhat Is there anywhere I can see more verbose errors to try and debug?

from vault-ethereum.

caddoo avatar caddoo commented on August 30, 2024

Here is the output of ldd /vault/plugins/vault-ethereum

 /lib64/ld-linux-x86-64.so.2 (0x7f0661440000)
 libpthread.so.0 => /lib64/ld-linux-x86-64.so.2 (0x7f0661440000)
 libc.so.6 => /lib64/ld-linux-x86-64.so.2 (0x7f0661440000)
Error relocating /vault/plugins/vault-ethereum: __fprintf_chk: symbol not found

from vault-ethereum.

cypherhat avatar cypherhat commented on August 30, 2024

I am in the last stages of testing a release for the new go-ethereum release (Iceberg). I will cut a Darwin and Ubuntu-tested Linux build of that; then, I will start testing this on the official vault docker image. I apologize for the delay - I use a Xenial-based Vagrant box for testing the plugin rather than a Docker environment.

from vault-ethereum.

caddoo avatar caddoo commented on August 30, 2024

I think I need to build from source on Alpine, can you provide instructions on how to do this with Make or go build.
Unfamiliar with both of these and I thought go build needs a src directory

from vault-ethereum.

cypherhat avatar cypherhat commented on August 30, 2024

I meant to return to this. Apologies.

Can you PR your Dockerfile? That way we can let others work from the official Docker image. Thanks!

from vault-ethereum.

caddoo avatar caddoo commented on August 30, 2024

Where would you like the Dockerfile? Also I'm still not up and running yet. Currently have this error:

vault write ethereum/accounts/test chain_id=1977 rpc_url=http://192.168.1.60:8545
Error writing data to ethereum/accounts/test: Error making API request.

URL: PUT http://192.168.1.60:9200/v1/ethereum/accounts/test
Code: 500. Errors:

* 1 error occurred:

* unexpected EOF

I've confirmed that from the Vault container I can create ethereum accounts via the JSON RPC:

curl 192.168.1.60:8545 -X POST --data '{"jsonrpc":"2.0","method":"personal_newAccount","params":["********"],"id":1}'
 -H "Content-Type: application/json"
{"jsonrpc":"2.0","id":1,"result":"0x589f9ae1df19d051661ee27b3c937269b62ddd6a"}

Any idea how to debug?

from vault-ethereum.

cypherhat avatar cypherhat commented on August 30, 2024

You can put it in the root directory of the repo. As regards your error, the plugin doesn't talk to the Ethereum node to create an account, so it is something related to Vault-Plugin communication most likely. I can give it a try this weekend - I had thought you had success.

from vault-ethereum.

cypherhat avatar cypherhat commented on August 30, 2024

Closing due to lack of activity.

from vault-ethereum.

zambien avatar zambien commented on August 30, 2024

According to @jefferai here: hashicorp/vault#3417

plugins should be built with CGO_ENABLED=0

from vault-ethereum.

0x234 avatar 0x234 commented on August 30, 2024

@zambien this makes the build fail with:

go build github.com/ethereum/go-ethereum/crypto/secp256k1: build constraints exclude all Go files in /go/pkg/mod/github.com/ethereum/[email protected]/crypto/secp256k1
# github.com/ethereum/go-ethereum/rpc
/go/pkg/mod/github.com/ethereum/[email protected]/rpc/endpoints.go:96:19: undefined: ipcListen
/go/pkg/mod/github.com/ethereum/[email protected]/rpc/ipc.go:50:10: undefined: newIPCConnection

from vault-ethereum.

zambien avatar zambien commented on August 30, 2024

@JBunCE, yep. Sorry about that. I forgot I had posted this here. The right way to handle this is to use some other means of cross-compilation if that is what you are going for (for example, compiling darwin in linux).

You can use xgo for this:

https://github.com/techknowlogick/xgo

Although perhaps that isn't maintained anymore so use [email protected]:techknowlogick/xgo.git.

The following will work assuming the following:

  • must compile OUTSIDE of GOPATH
  • must clear vendor folder

For example:

# get/build xgo with vendoring support
go get github.com/techknowlogick/xgo
cd $GOPATH/src/github.com/techknowlogick/xgo
go build .

# build with xgo
cd /tmp
git clone [email protected]:immutability-io/vault-ethereum.git
cd vault-ethereum
rm -rf vendor
$GOPATH/src/github.com/techknowlogick/xgo/xgo -out vault-ethereum  --targets=darwin/amd64,linux/amd64,windows/amd64 -deps=https://gmplib.org/download/gmp/gmp-6.0.0a.tar.bz2 .

Perhaps a better approach would be to use goreleaser cross-compilation but I haven't looked into that yet.

https://medium.com/@robdefeo/cross-compile-with-cgo-and-goreleaser-6af884731222

from vault-ethereum.

zambien avatar zambien commented on August 30, 2024

In order to resolve this I'd like to recommend the following:

  1. We move this repo to use goreleaser.
  2. We use the goreleaser-xcgo library for cross compilation

Anyone have issues with this?

from vault-ethereum.

cypherhat avatar cypherhat commented on August 30, 2024

Please PR. I'll approve.

This plugin is long overdue for a re-factor. I want to provide a way to allow smart contracts to be more elegantly integrated. Working on this...

from vault-ethereum.

zambien avatar zambien commented on August 30, 2024

As far as the initial issue, this blog explains the problem and the solution:

http://kefblog.com/2017-07-04/Golang-ang-docker

I'll include this in a PR shortly.

from vault-ethereum.

NorbertSzydlik avatar NorbertSzydlik commented on August 30, 2024

As far as the initial issue, this blog explains the problem and the solution:

http://kefblog.com/2017-07-04/Golang-ang-docker

FYI link changed to https://kefblog.com/Post/2017-07-04_golang-in-docker-without-disabling-cgo-on-alpine

from vault-ethereum.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.