Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/target/
23 changes: 23 additions & 0 deletions .project
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>java-client-example</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>
6 changes: 6 additions & 0 deletions .settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=1.6
4 changes: 4 additions & 0 deletions .settings/org.eclipse.m2e.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1
24 changes: 24 additions & 0 deletions EaaSPolicy.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* to create a token using this policy:
* vault token create -policy=eaas
*/

# Enable transit secrets engine
path "sys/mounts/transit" {
capabilities = [ "create", "read", "update", "delete", "list" ]
}

# To read enabled secrets engines
path "sys/mounts" {
capabilities = [ "read" ]
}

# Manage the transit secrets engine
path "transit/*" {
capabilities = [ "create", "read", "update", "delete", "list" ]
}

#access secrets
path "secret/*" {
capabilities = ["create", "read", "update", "delete", "list", "sudo"]
}
20 changes: 20 additions & 0 deletions EaaSPolicy2.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

path "/transit/encrypt/MyKey"{
capabilities = ["create", "read", "update", "delete", "list"]
}


path "/transit/decrypt/MyKey"{
capabilities = ["create", "read", "update", "delete", "list"]
}

path "secret/*" {
capabilities = ["create", "read", "update", "delete", "list"]
}

path "/transit/keys/*"{
capabilities = ["create", "read", "update", "delete", "list"]
allowed_parameters = {
"type" = ["aes256-gcm96", "rsa-2048"]
}
}
124 changes: 124 additions & 0 deletions admin_policy.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
path "transit/*" {
capabilities = ["create", "read", "update", "delete", "list", "sudo"]
}


# This section grants all access on "secret/*". Further restrictions can be
# applied to this broad policy, as shown below.

path "pki/*" {
capabilities = ["create", "read", "update", "delete", "list", "sudo"]
}

path "secret/*" {
capabilities = ["create", "read", "update", "delete", "list", "sudo"]
}


path "aws/*" {
capabilities = ["create", "read", "update", "delete", "list", "sudo"]
}

path "aws/creds/*" {
capabilities = ["create", "read", "update", "delete", "list", "sudo"]
}


# Even though we allowed secret/*, this line explicitly denies
# secret/super-secret. This takes precedence.
path "secret/super-secret" {
capabilities = ["deny"]
}

# Policies can also specify allowed, disallowed, and required parameters. Here
# the key "secret/restricted" can only contain "foo" (any value) and "bar" (one
# of "zip" or "zap").
path "secret/restricted" {
capabilities = ["create"]
allowed_parameters = {
"foo" = []
"bar" = ["zip", "zap"]
}

}

path "auth/*"
{
capabilities = ["create", "read", "update", "delete", "list", "sudo"]
}

# List, create, update, and delete auth methods
path "sys/auth/*"
{
capabilities = ["create", "read", "update", "delete", "list", "sudo"]
}

# policies
path "sys/policy"
{
capabilities = ["create", "update", "delete"]
control_group = {
factor "ops_manager" {
identity {
group_names = ["managers"]
approvals = 1
}
}
}
}


# List, create, update, and delete key/value secrets
path "secret/*"
{
capabilities = ["create", "read", "update", "delete", "list", "sudo"]
}

# Manage and manage secret engines broadly across Vault.
path "sys/mounts/*"
{
capabilities = ["create", "read", "update", "delete", "list", "sudo"]
}

# Read health checks
path "sys/health"
{
capabilities = ["read", "sudo"]
}

# To perform Step 4
path "sys/capabilities-self"
{
capabilities = ["create", "update"]
}

path "sys/*"
{
capabilities = ["create", "read", "update", "delete", "list", "sudo"]
}

path "sys/control-group"
{
capabilities = ["create", "read", "update", "delete", "list", "sudo"]
}


path "identity/*"
{
capabilities = ["create", "read", "update", "delete", "list", "sudo"]
}

path "ssh/*"
{
capabilities = ["create", "read", "update", "delete", "list", "sudo"]
}

path "ssh/my-role/*"
{
capabilities = ["create", "read", "update", "delete", "list", "sudo"]
}

path "sys/capabilities-self/*"
{
capabilities = ["create", "read", "update", "delete", "list", "sudo"]
}
Binary file modified java-client-example-1.0-SNAPSHOT-jar-with-dependencies.jar
Binary file not shown.
Binary file added java-client-example-1.0-SNAPSHOT.jar
Binary file not shown.
142 changes: 78 additions & 64 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,64 +1,78 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>io.vaultproject.javaclientexample</groupId>
<artifactId>java-client-example</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>java-client-example</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.bettercloud</groupId>
<artifactId>vault-java-driver</artifactId>
<version>2.0.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<archive>
<manifest>
<mainClass>io.vaultproject.javaclientexample.App</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<!-- Build an executable JAR -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
<mainClass>io.vaultproject.javaclientexample.App</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>io.vaultproject.javaclientexample</groupId>
<artifactId>java-client-example</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>java-client-example</name>
<url>http://maven.apache.org</url>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.bettercloud</groupId>
<artifactId>vault-java-driver</artifactId>
<version>5.1.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.9.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<archive>
<manifest>
<mainClass>io.vaultproject.javaclientexample.App</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<!-- Build an executable JAR -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
<mainClass>io.vaultproject.javaclientexample.App</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>
Loading