Subject: [alpine-aports] [PATCH] testing/vault: new aport

From: Christian Kampka <[email-masked]>
Date: Sat, 19 Sep 2015 12:37:45 +0200

https://www.vaultproject.io
Vault is a tool for securely accessing secrets. A secret is anything
that you want to tightly control access to, such as API keys, passwords,
certificates, and more. Vault provides a unified interface to any
secret, while providing tight access control and recording a detailed
audit log.
---
 testing/vault/APKBUILD    |  99 +++++++++++++++++++++
 testing/vault/Godeps.json | 221 ++++++++++++++++++++++++++++++++++++++++++++++
 testing/vault/vault.confd |   1 +
 testing/vault/vault.hcl   |  15 ++++
 testing/vault/vault.initd |  33 +++++++
 5 files changed, 369 insertions(+)
 create mode 100644 testing/vault/APKBUILD
 create mode 100644 testing/vault/Godeps.json
 create mode 100644 testing/vault/vault.confd
 create mode 100644 testing/vault/vault.hcl
 create mode 100644 testing/vault/vault.initd

diff --git a/testing/vault/APKBUILD b/testing/vault/APKBUILD
new file mode 100644
index 0000000..15e47df
--- /dev/null
+++ b/testing/vault/APKBUILD
@@ -0,0 +1,99 @@
+# Contributor: Christian Kampka <[email-masked]>
+# Maintainer:
+pkgname=vault
+pkgver=0.2.0
+pkgrel=0
+pkgdesc="Vault is a tool for securely accessing secrets."
+url="https://www.vaultproject.io/"
+arch="all"
+license="MPL 2.0"
+depends=""
+depends_dev=""
+makedepends="go godep $depends_dev"
+#install="$pkgname.pre-install $pkgname.pre-deinstall $pkgname.post-deinstall"
+pkgusers="vault"
+pkggroups="vault"
+subpackages=""
+options="!strip"
+source="http://dev.alpinelinux.org/archive/$pkgname/$pkgname-$pkgver.tar.gz
+  Godeps.json
+  vault.confd
+  vault.hcl
+  vault.initd"
+
+prepare() {
+  cd "${_builddir}"
+  local i
+  for i in $source; do
+    case $i in
+      *.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
+    esac
+  done
+}
+
+_disturl="dev.alpinelinux.org:/archive/$pkgname/"
+_gourl="github.com/hashicorp/vault"
+_builddir="${srcdir}/vault"
+
+snapshot() {
+  abuild clean
+  abuild deps
+
+  export GOPATH="${_builddir}"
+  mkdir -p $_builddir
+  cd "$srcdir"
+
+  msg "Checking out v${pkgver} tag"
+  git clone -q --branch v${pkgver} https://$_gourl || return 1
+
+  cd ${_builddir}
+  # use custom godeps file
+
+  install -D "$startdir"/Godeps.json \
+		$_builddir/Godeps/Godeps.json || return 1
+
+  #go get -v -d || return 1
+  godep restore || return 1
+
+  cd "$srcdir"
+  tar zcf $pkgname-$pkgver.tar.gz vault || return 1
+  rsync --progress -La $pkgname-$pkgver.tar.gz \
+    $_disturl || return 1
+  cd $startdir && abuild undeps
+}
+
+build() {
+  cd "$_builddir" || return 1
+  export GOPATH="${_builddir}"
+  mkdir -p "${_builddir}/src/github.com/hashicorp"
+  ln -s "${_builddir}" "${_builddir}/src/github.com/hashicorp/vault"
+  go build -x -v -o bin/${pkgname} || return 1
+}
+
+package() {
+  cd "$_builddir"
+  install -m755 -D "${srcdir}/${pkgname}.initd" \
+  "${pkgdir}/etc/init.d/${pkgname}" || return 1
+  install -m644 -D "${srcdir}/${pkgname}.confd" \
+  "${pkgdir}/etc/conf.d/$pkgname" || return 1
+  install -m750 -o root -g vault \
+  -D "${_builddir}/bin/${pkgname}" \
+  "${pkgdir}/usr/sbin/${pkgname}" || return 1
+  install -m750 -o vault -g vault -d "$pkgdir/var/lib/${pkgname}" || return 1
+  install -m750 -o root -g vault -D "$srcdir/${pkgname}.hcl" "$pkgdir/etc/${pkgname}.hcl" || return 1
+}
+md5sums="643de042da4583a16e9d5ecd0c7fffea  vault-0.2.0.tar.gz
+c7c60a8240345c248e72a57030239b03  Godeps.json
+2148a788620484be07e1e24feb1cbd34  vault.confd
+1f7802f479024809856e3be2e44a1b19  vault.hcl
+8b75990815b758db94f400de001cbc81  vault.initd"
+sha256sums="92502d43a10a0903c9d1add944dde2c36ba3af09e20e4bd6e0e3648313a7eab7  vault-0.2.0.tar.gz
+3ce579dfe7f7dc2a0519f835e55c85d314b1f90e5d74b29cc2966b6b0534a0d7  Godeps.json
+f197536bc5bf4531072c0a5cb17627bf01abd188b0cc2005e0ff1768e6143d32  vault.confd
+cacbd75cbaccf1034cd21d3015797cf0c1c1ce9c7e7ef7c1e4db4b54b92fe696  vault.hcl
+cdbeba798d2b06a178e9c6eb638ff88c4f1c21eaa6c8881a87fac679c8e7c46e  vault.initd"
+sha512sums="9417147e2e271dcd5d96176095d62666538f21981dc22d8353a864e8a2eee368067d1ae761bb3955d0fa30dcfdaa93b5d6b5c4d8267028d3fb7a422eb417bfa6  vault-0.2.0.tar.gz
+6092da41eeda3c3fb1766e310fa7ac73b26fcc34cf2b9a51574387eb1137d4e8322631a05b5d75bdc96b15f1d08da2bf98d299856a76ebe92e40d89743288f49  Godeps.json
+6f3f30e5c9d9dd5117f18fce0e669f0cd752a6be4910405d6b394f15273372731ee887a5ba4c700293e5b8bc2bf40fd69d4337156f77b03549d2dc2c0a666bec  vault.confd
+8c064aa5dcca84822c1fa85e9d0ff520df46f794b2e9c689a9b4f81f74279387b3aebc08b3ca26cf786c2fcf1a330e765bf5a511074c24f87e5346672346ba1c  vault.hcl
+038f5fd0b7bc84bd8be82a1cb8ac7a5357319bdb77e07936b4072fcb00a30add1cb3744f3a333d2a8b860c821aab0d88249033f61d2a2125de6bb6b2a4c9aef6  vault.initd"
diff --git a/testing/vault/Godeps.json b/testing/vault/Godeps.json
new file mode 100644
index 0000000..7dcdc3f
--- /dev/null
+++ b/testing/vault/Godeps.json
@@ -0,0 +1,221 @@
+{
+	"ImportPath": "github.com/hashicorp/vault",
+	"GoVersion": "go1.4.2",
+	"Packages": [
+		"."
+	],
+	"Deps": [
+		{
+			"ImportPath": "github.com/armon/go-metrics",
+			"Rev": "b2d95e5291cdbc26997d1301a5e467ecbb240e25"
+		},
+		{
+			"ImportPath": "github.com/armon/go-radix",
+			"Rev": "fbd82e84e2b13651f3abc5ffd26b65ba71bc8f93"
+		},
+		{
+			"ImportPath": "github.com/aws/aws-sdk-go/aws",
+			"Comment": "v0.6.4-5-g127313c",
+			"Rev": "127313c1b41e534a0456a68b6b3a16712dacb35d"
+		},
+		{
+			"ImportPath": "github.com/aws/aws-sdk-go/internal/endpoints",
+			"Comment": "v0.6.4-5-g127313c",
+			"Rev": "127313c1b41e534a0456a68b6b3a16712dacb35d"
+		},
+		{
+			"ImportPath": "github.com/aws/aws-sdk-go/internal/protocol/query",
+			"Comment": "v0.6.4-5-g127313c",
+			"Rev": "127313c1b41e534a0456a68b6b3a16712dacb35d"
+		},
+		{
+			"ImportPath": "github.com/aws/aws-sdk-go/internal/protocol/rest",
+			"Comment": "v0.6.4-5-g127313c",
+			"Rev": "127313c1b41e534a0456a68b6b3a16712dacb35d"
+		},
+		{
+			"ImportPath": "github.com/aws/aws-sdk-go/internal/protocol/restxml",
+			"Comment": "v0.6.4-5-g127313c",
+			"Rev": "127313c1b41e534a0456a68b6b3a16712dacb35d"
+		},
+		{
+			"ImportPath": "github.com/aws/aws-sdk-go/internal/protocol/xml/xmlutil",
+			"Comment": "v0.6.4-5-g127313c",
+			"Rev": "127313c1b41e534a0456a68b6b3a16712dacb35d"
+		},
+		{
+			"ImportPath": "github.com/aws/aws-sdk-go/internal/signer/v4",
+			"Comment": "v0.6.4-5-g127313c",
+			"Rev": "127313c1b41e534a0456a68b6b3a16712dacb35d"
+		},
+		{
+			"ImportPath": "github.com/aws/aws-sdk-go/service/s3",
+			"Comment": "v0.6.4-5-g127313c",
+			"Rev": "127313c1b41e534a0456a68b6b3a16712dacb35d"
+		},
+		{
+			"ImportPath": "github.com/coreos/go-etcd/etcd",
+			"Comment": "v2.0.0-18-gc904d70",
+			"Rev": "c904d7032a70da6551c43929f199244f6a45f4c1"
+		},
+		{
+			"ImportPath": "github.com/fatih/structs",
+			"Rev": "a9f7daa9c2729e97450c2da2feda19130a367d8f"
+		},
+		{
+			"ImportPath": "github.com/go-ldap/ldap",
+			"Comment": "v1-14-g406aa05",
+			"Rev": "406aa05eb8272fb8aa201e410afa6f9fdcb2bf68"
+		},
+		{
+			"ImportPath": "github.com/go-sql-driver/mysql",
+			"Comment": "v1.2-112-gfb72997",
+			"Rev": "fb7299726d2e68745a8805b14f2ff44b5c2cfa84"
+		},
+		{
+			"ImportPath": "github.com/gocql/gocql",
+			"Comment": "1st_gen_framing-187-g80e812a",
+			"Rev": "80e812acf0ab386dd34271acc10d22514c0a67ba"
+		},
+		{
+			"ImportPath": "github.com/golang/groupcache/lru",
+			"Rev": "604ed5785183e59ae2789449d89e73f3a2a77987"
+		},
+		{
+			"ImportPath": "github.com/golang/snappy",
+			"Rev": "eaa750b9bf4dcb7cb20454be850613b66cda3273"
+		},
+		{
+			"ImportPath": "github.com/google/go-github/github",
+			"Rev": "fccd5bb66f985db0a0d150342ca0a9529a23488a"
+		},
+		{
+			"ImportPath": "github.com/google/go-querystring/query",
+			"Rev": "547ef5ac979778feb2f760cdb5f4eae1a2207b86"
+		},
+		{
+			"ImportPath": "github.com/hashicorp/aws-sdk-go/aws",
+			"Comment": "tf0.4.0-3-ge6ea019",
+			"Rev": "e6ea0192eee4640f32ec73c0cbb71f63e4f2b65a"
+		},
+		{
+			"ImportPath": "github.com/hashicorp/aws-sdk-go/gen/ec2",
+			"Comment": "tf0.4.0-3-ge6ea019",
+			"Rev": "e6ea0192eee4640f32ec73c0cbb71f63e4f2b65a"
+		},
+		{
+			"ImportPath": "github.com/hashicorp/aws-sdk-go/gen/endpoints",
+			"Comment": "tf0.4.0-3-ge6ea019",
+			"Rev": "e6ea0192eee4640f32ec73c0cbb71f63e4f2b65a"
+		},
+		{
+			"ImportPath": "github.com/hashicorp/aws-sdk-go/gen/iam",
+			"Comment": "tf0.4.0-3-ge6ea019",
+			"Rev": "e6ea0192eee4640f32ec73c0cbb71f63e4f2b65a"
+		},
+		{
+			"ImportPath": "github.com/hashicorp/consul/api",
+			"Comment": "v0.5.2-144-g2783f2b",
+			"Rev": "2783f2bfec1823362602924f5cd3c894743dca08"
+		},
+		{
+			"ImportPath": "github.com/hashicorp/errwrap",
+			"Rev": "7554cd9344cec97297fa6649b055a8c98c2a1e55"
+		},
+		{
+			"ImportPath": "github.com/hashicorp/go-multierror",
+			"Rev": "56912fb08d85084aa318edcf2bba735b97cf35c5"
+		},
+		{
+			"ImportPath": "github.com/hashicorp/go-syslog",
+			"Rev": "42a2b573b664dbf281bd48c3cc12c086b17a39ba"
+		},
+		{
+			"ImportPath": "github.com/hashicorp/golang-lru",
+			"Rev": "995efda3e073b6946b175ed93901d729ad47466a"
+		},
+		{
+			"ImportPath": "github.com/hashicorp/hcl",
+			"Rev": "54864211433d45cb780682431585b3e573b49e4a"
+		},
+		{
+			"ImportPath": "github.com/hashicorp/logutils",
+			"Rev": "0dc08b1671f34c4250ce212759ebd880f743d883"
+		},
+		{
+			"ImportPath": "github.com/kardianos/osext",
+			"Rev": "6e7f843663477789fac7c02def0d0909e969b4e5"
+		},
+		{
+			"ImportPath": "github.com/lib/pq",
+			"Comment": "go1.0-cutoff-51-ga8d8d01",
+			"Rev": "a8d8d01c4f91602f876bf5aa210274e8203a6b45"
+		},
+		{
+			"ImportPath": "github.com/mitchellh/cli",
+			"Rev": "8102d0ed5ea2709ade1243798785888175f6e415"
+		},
+		{
+			"ImportPath": "github.com/mitchellh/copystructure",
+			"Rev": "6fc66267e9da7d155a9d3bd489e00dad02666dc6"
+		},
+		{
+			"ImportPath": "github.com/mitchellh/go-homedir",
+			"Rev": "1f6da4a72e57d4e7edd4a7295a585e0a3999a2d4"
+		},
+		{
+			"ImportPath": "github.com/mitchellh/mapstructure",
+			"Rev": "2caf8efc93669b6c43e0441cdc6aed17546c96f3"
+		},
+		{
+			"ImportPath": "github.com/mitchellh/reflectwalk",
+			"Rev": "eecf4c70c626c7cfbb95c90195bc34d386c74ac6"
+		},
+		{
+			"ImportPath": "github.com/ryanuber/columnize",
+			"Comment": "v2.0.1-6-g44cb478",
+			"Rev": "44cb4788b2ec3c3d158dd3d1b50aba7d66f4b59a"
+		},
+		{
+			"ImportPath": "github.com/samuel/go-zookeeper/zk",
+			"Rev": "c86eba8e7e95efab81f6c0455332e49d39aed12f"
+		},
+		{
+			"ImportPath": "github.com/ugorji/go/codec",
+			"Rev": "821cda7e48749cacf7cad2c6ed01e96457ca7e9d"
+		},
+		{
+			"ImportPath": "github.com/vaughan0/go-ini",
+			"Rev": "a98ad7ee00ec53921f08832bc06ecf7fd600e6a1"
+		},
+		{
+			"ImportPath": "golang.org/x/crypto/bcrypt",
+			"Rev": "cc04154d65fb9296747569b107cfd05380b1ea3e"
+		},
+		{
+			"ImportPath": "golang.org/x/crypto/blowfish",
+			"Rev": "cc04154d65fb9296747569b107cfd05380b1ea3e"
+		},
+		{
+			"ImportPath": "golang.org/x/crypto/ssh/terminal",
+			"Rev": "cc04154d65fb9296747569b107cfd05380b1ea3e"
+		},
+		{
+			"ImportPath": "golang.org/x/net/context",
+			"Rev": "d9558e5c97f85372afee28cf2b6059d7d3818919"
+		},
+		{
+			"ImportPath": "golang.org/x/oauth2",
+			"Rev": "b5adcc2dcdf009d0391547edc6ecbaff889f5bb9"
+		},
+		{
+			"ImportPath": "gopkg.in/asn1-ber.v1",
+			"Comment": "v1",
+			"Rev": "9eae18c3681ae3d3c677ac2b80a8fe57de45fc09"
+		},
+		{
+			"ImportPath": "speter.net/go/exp/math/dec/inf",
+			"Rev": "42ca6cd68aa922bc3f32f1e056e61b65945d9ad7"
+		}
+	]
+}
diff --git a/testing/vault/vault.confd b/testing/vault/vault.confd
new file mode 100644
index 0000000..79bf72f
--- /dev/null
+++ b/testing/vault/vault.confd
@@ -0,0 +1 @@
+vault_opts="server -config=/etc/vault.hcl"
diff --git a/testing/vault/vault.hcl b/testing/vault/vault.hcl
new file mode 100644
index 0000000..b74da5e
--- /dev/null
+++ b/testing/vault/vault.hcl
@@ -0,0 +1,15 @@
+/*
+ * Vault configuration. See: https://vaultproject.io/docs/config/
+ */
+
+backend "file" {
+	path = "/var/lib/vault"
+}
+
+listener "tcp" {
+	/*
+	 * By default Vault listens on localhost only.
+	 * Make sure to enable TLS support otherwise.
+	 */
+	tls_disable = 1
+}
diff --git a/testing/vault/vault.initd b/testing/vault/vault.initd
new file mode 100644
index 0000000..f539db7
--- /dev/null
+++ b/testing/vault/vault.initd
@@ -0,0 +1,33 @@
+#!/sbin/openrc-run
+
+name=vault
+daemon=/usr/sbin/$name
+daemon_user=$name
+daemon_group=$name
+pidfile="/run/${name}.pid"
+
+depend() {
+        need net
+        after firewall
+}
+
+start() {
+
+        checkpath -f -m 0644 -o "${daemon_user}":"${daemon_group}" "$pidfile"
+
+        ebegin "Starting ${name}"
+                start-stop-daemon --start --quiet \
+                        -m --pidfile "$pidfile" \
+                        --user ${daemon_user} --group ${daemon_group} \
+                        -b -1 /dev/null -2 /dev/null \
+                        -k 027 --exec ${daemon} -- ${vault_opts}
+        eend $?
+}
+
+stop() {
+        ebegin "Stopping ${name}"
+                start-stop-daemon --stop --quiet \
+                        --pidfile "$pidfile" \
+                        --exec ${daemon}
+        eend $?
+}
-- 
2.5.1

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---