proxy-bridge: add keyring-based HTTP CONNECT proxy bridge

This commit is contained in:
tke
2026-04-27 14:27:27 +02:00
parent 71bffc77ae
commit ac3245b78f
3 changed files with 161 additions and 0 deletions
+34
View File
@@ -0,0 +1,34 @@
const readline = require('readline');
const { execSync } = require('child_process');
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
console.log("=== Proxy Bridge Keyring Setup ===");
rl.question('Enter your corporate username: ', (user) => {
rl.question('Enter your corporate password: ', (pass) => {
try {
// Securely store the password in the Ubuntu Keyring using secret-tool
// We use standard input to pass the password so it doesn't appear in process lists
execSync(`secret-tool store --label="Proxy Bridge Credentials" service proxy-bridge account ${user}`, {
input: pass
});
// Store the username in a local config just so the bridge knows WHICH account to look up
require('fs').writeFileSync('/opt/proxy-bridge/user.json', JSON.stringify({ username: user }));
console.log("\n✅ Credentials successfully stored in the system keyring.");
} catch (error) {
console.error("\n❌ Failed to store credentials in keyring:", error.message);
}
rl.close();
});
// Hide typing for password (basic implementation)
rl._writeToOutput = function _writeToOutput(stringToWrite) {
if (rl.history.length === 0) rl.output.write("*");
};
});