Skip to content
This repository was archived by the owner on Mar 5, 2019. It is now read-only.

Commit ee92b54

Browse files
spkjpfaustbrian
authored andcommitted
fix: dont expose bip38 password in process monitor (#74)
1 parent 9ccb40b commit ee92b54

File tree

3 files changed

+23
-12
lines changed

3 files changed

+23
-12
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,16 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1212
- A new npm dependency `dotenv` has been added. When updating from a previous
1313
version it is necessary to install it by executing `sudo npm install -g dotenv`
1414
followed by `npm link dotenv` inside the commander directory.
15+
- When using `bip38` the password is no longer exposed in the process monitor.
16+
- Starting the relay/forger/explorer manually is now easier:
17+
Relay:
18+
`pm2 start --only ark-core-relay`
19+
Forger without bip38 encryption:
20+
`pm2 start --only ark-core-forger`
21+
Forger with bip38 encryption:
22+
`pm2 start --only ark-core-forger -- --password ark`
23+
Explorer:
24+
`pm2 start --only ark-core-explorer`
1525

1626
### Removed
1727
- Redis

actions/apps/forger.sh

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,8 @@ __forger_configure_bip38 ()
140140

141141
__forger_start_with_bip38 ()
142142
{
143-
local bip38=$(jq -r '.bip38' "$CORE_CONFIG/delegates.json")
144-
145143
read -sp "Please enter your bip38 password: " password
146-
147-
pm2 start $commander_ecosystem --only ark-core-forger -- --bip38 "$bip38" --password "$password" >> "$commander_log" 2>&1
144+
pm2 start $commander_ecosystem --only ark-core-forger -- --password "$password" >> "$commander_log" 2>&1
148145
}
149146

150147
__forger_start_without_bip38 ()

ecosystem.config.js

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
require('dotenv').config({ path: `${process.env.HOME}/.commander` })
22

3-
const parseArg = (key) => {
4-
const index = process.argv.indexOf(key)
3+
const delegates = require(`${process.env.CORE_CONFIG}/delegates.json`)
4+
5+
const getPasswordFromArgs = () => {
6+
const index = process.argv.indexOf('--password')
57
if (index !== -1) {
6-
return `${key} ${process.argv[index + 1]}`
8+
return process.argv[index + 1]
79
}
810

9-
return ''
11+
return undefined
1012
}
1113

1214
module.exports = {
@@ -25,11 +27,13 @@ module.exports = {
2527
args: `forger --data ${process.env.CORE_DATA}
2628
--config ${process.env.CORE_CONFIG}
2729
--token ${process.env.CORE_TOKEN}
28-
--network ${process.env.CORE_NETWORK}
29-
${parseArg('--bip38')}
30-
${parseArg('--password')}`,
30+
--network ${process.env.CORE_NETWORK}`,
3131
max_restarts: 5,
32-
min_uptime: '5m'
32+
min_uptime: '5m',
33+
env: {
34+
ARK_FORGER_BIP38: delegates.bip38,
35+
ARK_FORGER_PASSWORD: getPasswordFromArgs()
36+
}
3337
}, {
3438
name: 'ark-explorer',
3539
script: `${process.env.EXPLORER_DIR}/express-server.js`,

0 commit comments

Comments
 (0)