Link to this headingKeepass
Link to this headingCLI
Create Database:
Add to the database:
#Add a new folder to the database
#Add a new entry into the database
Show Entry:
Open Database:
Link to this headingScript to set env from database
Script to use:
#!/bin/bash
# Default KeePass database path
KEEPASS_DB="/Keepass/Password.kdbx"
KEEPASS_CLI="keepassxc-cli"
# Function to fetch secrets from KeePass
# Load secrets into environment variables
# Handle 'kp read <entry[@field]>' behavior
if ; then
ENTRY=""
FIELD=""
if ; then
FIELD="password"
fi
fi
# Handle 'kp inject --template=... --output=...'
if ; then
TEMPLATE_FILE=""
OUTPUT_FILE=""
while ; do
case "" in
--template=*)
TEMPLATE_FILE=""
;;
--output=*)
OUTPUT_FILE=""
;;
esac
done
if ; then
fi
# Replace {{kp://Entry@field}} or {{kp://Entry}} with fetched secrets
OUTPUT=
while ; do
ENTRY=""
FIELD=""
VALUE=
OUTPUT=""
done
fi
# Prompt for KeePass password securely
# Parse arguments for --env-file=<file> and --db=<file>
ENV_FILE=""
NEW_ARGS=()
PARSE_ARGS=true
for; do
if ; then
case "" in
--env-file=*)
ENV_FILE=""
;;
--db=*)
KEEPASS_DB=""
if ; then
fi
;;
--)
PARSE_ARGS=false
;;
*)
NEW_ARGS+=("")
;;
esac
else
NEW_ARGS+=("")
fi
done
# Use default .env if no --env-file was passed
if ; then
ENV_FILE=".env"
fi
# Load env file if found
if ; then
if ; then
|
else
fi
fi
# Replace env variables with KeePass secrets
# Ensure there is a command to execute
if ; then
fi
# Run the specified command with injected environment
Run example:
KEEPASS_TEST_OUTPUT="kp://production/test"
KEEPASS_TEST_OUTPUT=Password123!
Template Examples:
=
root=password123!