30
30
31
31
if configuration ['spire-server' ].get ('pre-command' ) :
32
32
spire_interactions .pre_command = configuration ['spire-server' ]['pre-command' ]
33
+ if configuration ['spire-server' ]['pre-command' ] == "\" \" " :
34
+ spire_interactions .pre_command = ""
33
35
34
36
# Defining the trust domain (SPIRE Trust Domain)
35
37
trust_domain = configuration ['spire-server' ]['trust-domain' ]
@@ -49,7 +51,7 @@ async def handle_dummy_token_endpoint():
49
51
if hostname != None :
50
52
51
53
# Create spiffeID based on the hostname
52
- spiffeID = SpiffeId . parse (f"spiffe://{ trust_domain } /h/{ hostname } " )
54
+ spiffeID = SpiffeId (f"spiffe://{ trust_domain } /h/{ hostname } " )
53
55
54
56
# Associate a token to the spiffeID
55
57
result = token_generate (spiffeID )
@@ -87,7 +89,7 @@ async def handle_client_registration():
87
89
write_client_policy (hvac_client , f"client_{ client_id } " )
88
90
89
91
# Create spiffeID out of this client id
90
- agent_spiffeID = SpiffeId . parse (f"spiffe://{ trust_domain } /c/{ client_id } " )
92
+ agent_spiffeID = SpiffeId (f"spiffe://{ trust_domain } /c/{ client_id } " )
91
93
92
94
# Generate a token to register the agent (again, based on the client id)
93
95
result = token_generate (agent_spiffeID )
@@ -99,7 +101,7 @@ async def handle_client_registration():
99
101
100
102
# Create a spiffeID for the workloads on the client.
101
103
# Register workloads that have to run on this agent
102
- workload_spiffeID = SpiffeId . parse (
104
+ workload_spiffeID = SpiffeId (
103
105
f"spiffe://{ trust_domain } /c/{ client_id } /workload"
104
106
)
105
107
@@ -163,7 +165,7 @@ async def handle_workload_creation():
163
165
client_id = hashlib .sha256 (client_id .encode ()).hexdigest ()[0 :9 ]
164
166
165
167
# Parse the spiffeID that will access the application
166
- spiffeID = SpiffeId . parse (
168
+ spiffeID = SpiffeId (
167
169
f"spiffe://{ trust_domain } /c/{ client_id } /s/{ data ['secret' ]} "
168
170
)
169
171
@@ -179,7 +181,7 @@ async def handle_workload_creation():
179
181
groups_added = []
180
182
181
183
# Compute node's agent spiffeID
182
- parentID = SpiffeId . parse (f"spiffe://{ trust_domain } /h/{ compute_node } " )
184
+ parentID = SpiffeId (f"spiffe://{ trust_domain } /h/{ compute_node } " )
183
185
184
186
# For each user
185
187
if data ["users" ] != None :
0 commit comments