First install Go and then configure Go environment.
brew install go
yum install golang
mkdir -p ~/go/{src,bin}
cat << EOF >>~/.bash_profile
export GOPATH=~/go
export PATH=\$PATH:\$GOPATH/bin
EOF
source ~/.bash_profile
mkdir -p $GOPATH/src/github.com/mickep76
cd $GOPATH/src/github.com/mickep76
git clone https://github.com/mickep76/grpc-exec-example.git
First generate TLS Certificates for localhost and RSA public/private key.
cd $GOPATH/src/github.com/mickep76/grpc-exec-example/tls_setup
make preq ca req
cd $GOPATH/src/github.com/mickep76/grpc-exec-example/ldap-server
make build run
cd $GOPATH/src/github.com/mickep76/grpc-exec-example
go get -u ./...
Configure auth-server LDAP/AD settings in ~/.auth-server.toml.
cat << EOF >~/.auth-server.toml
addr = "localhost:389"
base = "dc=example,dc=com"
ou = "ou=users"
ca = "../tls_setup/certs/ca.pem"
verify = true
EOF
Build auth-server.
cd $GOPATH/src/github.com/mickep76/grpc-exec-example/auth-server
go build
./auth-server
You can find the settings for auth-server using ./auth-server --help or ./auth-server -print-conf.
cd $GOPATH/src/github.com/mickep76/grpc-exec-example/info-server
go build
./info-server
cd $GOPATH/src/github.com/mickep76/grpc-exec-example/exec-server
go build
./exec-server
Build the client so you can interact with the services.
cd $GOPATH/src/github.com/mickep76/grpc-exec-example/client
go build
Generate a JWT token by logging in.
For user "jdoe" use password "secret".
./client login -user jdoe
./client verify
Query host info from one or more hosts.
./client info localhost
./client info localhost,localhost
Execute command on one or more hosts.
./client exec localhost /bin/ls -la /
./client exec localhost,localhost /bin/ls -la /
Catalog server will allow each info-server to register and send a keep-alive.
cd $GOPATH/src/github.com/mickep76/grpc-exec-example/catalog-server
go build
./catalog-server
Stop info-server CTRL+C then start it with the option -register. This requires that you have created a token.
cd $GOPATH/src/github.com/mickep76/grpc-exec-example/info-server
./info-server -register
cd $GOPATH/src/github.com/mickep76/grpc-exec-example/client
./client list