initial: xop source tree
This commit is contained in:
commit
e4c93e1e13
43 files changed
+7599
No files matched your search
Executable
+26
@@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env bash
|
||||
# Real MySQL exec — secrets stored locally, gated by Touch ID / PAM + passphrase.
|
||||
#
|
||||
# Before running, you must have stored the secret:
|
||||
# xop init # set vault passphrase
|
||||
# echo "..." | xop set MYSQL_PWD # store MySQL password
|
||||
#
|
||||
# At spawn time, xop will:
|
||||
# 1. Prompt Touch ID (macOS) or pkexec (Linux) to confirm your identity
|
||||
# 2. Prompt for the vault passphrase (hidden)
|
||||
# 3. Decrypt MYSQL_PWD from ~/.xop/key.db
|
||||
# 4. Spawn `mysql` with MYSQL_PWD env var set
|
||||
#
|
||||
# Why MYSQL_PWD env var? mysql's `-p` flag leaks the password via argv
|
||||
# (visible in `ps aux`). Env var avoids that exposure.
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
./target/release/xop \
|
||||
--secret MYSQL_PWD='MYSQL_PWD' \
|
||||
--allow-net='mysql.internal:3306' \
|
||||
--deny-net='*' \
|
||||
-- \
|
||||
mysql -h mysql.internal -u readonly -D mydb --table -e 'SELECT 1 AS connected'
|
||||
Reference in new issue
Block a user