Skip to content

Commit

Permalink
v1.4.1: Adds SSL renewal, AccountResolver and upgrades config
Browse files Browse the repository at this point in the history
  • Loading branch information
evias committed Apr 11, 2022
2 parents 7a9654f + 76f6b46 commit 1db3163
Show file tree
Hide file tree
Showing 41 changed files with 1,524 additions and 149 deletions.
2 changes: 1 addition & 1 deletion docs/clean.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ EXAMPLE
$ yourdlt clean
```

_See code: [src/commands/clean.ts](https://github.com/usingblockchain/yourdlt/blob/v1.4.0/src/commands/clean.ts)_
_See code: [src/commands/clean.ts](https://github.com/usingblockchain/yourdlt/blob/v1.4.1/src/commands/clean.ts)_
2 changes: 1 addition & 1 deletion docs/compose.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ EXAMPLE
$ yourdlt compose
```

_See code: [src/commands/compose.ts](https://github.com/usingblockchain/yourdlt/blob/v1.4.0/src/commands/compose.ts)_
_See code: [src/commands/compose.ts](https://github.com/usingblockchain/yourdlt/blob/v1.4.1/src/commands/compose.ts)_
4 changes: 2 additions & 2 deletions docs/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ OPTIONS
--upgrade
It regenerates the configuration reusing the previous keys. Use this flag when upgrading the version of bootstrap to
keep your node up to date without dropping the local data. The original preset (-t), assembly (-a), and custom
preset (-a) must be used. Backup the target folder before upgrading.
preset (-c) must be used. Backup the target folder before upgrading.
EXAMPLES
$ yourdlt config -p bootstrap
$ yourdlt config -p testnet -a dual --password 1234
$ echo "$MY_ENV_VAR_PASSWORD" | yourdlt config -p testnet -a dual
```

_See code: [src/commands/config.ts](https://github.com/usingblockchain/yourdlt/blob/v1.4.0/src/commands/config.ts)_
_See code: [src/commands/config.ts](https://github.com/usingblockchain/yourdlt/blob/v1.4.1/src/commands/config.ts)_
2 changes: 1 addition & 1 deletion docs/decrypt.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@ EXAMPLES
$ echo "$MY_ENV_VAR_PASSWORD" | yourdlt decrypt --source target/addresses.yml --destination plain-addresses.yml
```

_See code: [src/commands/decrypt.ts](https://github.com/usingblockchain/yourdlt/blob/v1.4.0/src/commands/decrypt.ts)_
_See code: [src/commands/decrypt.ts](https://github.com/usingblockchain/yourdlt/blob/v1.4.1/src/commands/decrypt.ts)_
2 changes: 1 addition & 1 deletion docs/encrypt.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@ EXAMPLES
encrypted-custom-preset.yml
```

_See code: [src/commands/encrypt.ts](https://github.com/usingblockchain/yourdlt/blob/v1.4.0/src/commands/encrypt.ts)_
_See code: [src/commands/encrypt.ts](https://github.com/usingblockchain/yourdlt/blob/v1.4.1/src/commands/encrypt.ts)_
2 changes: 1 addition & 1 deletion docs/enrollRewardProgram.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ EXAMPLES
$ echo "$MY_ENV_VAR_PASSWORD" | yourdlt enrollRewardProgram --url http://external-rest:3000
```

_See code: [src/commands/enrollRewardProgram.ts](https://github.com/usingblockchain/yourdlt/blob/v1.4.0/src/commands/enrollRewardProgram.ts)_
_See code: [src/commands/enrollRewardProgram.ts](https://github.com/usingblockchain/yourdlt/blob/v1.4.1/src/commands/enrollRewardProgram.ts)_
2 changes: 1 addition & 1 deletion docs/healthCheck.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ EXAMPLE
$ yourdlt healthCheck
```

_See code: [src/commands/healthCheck.ts](https://github.com/usingblockchain/yourdlt/blob/v1.4.0/src/commands/healthCheck.ts)_
_See code: [src/commands/healthCheck.ts](https://github.com/usingblockchain/yourdlt/blob/v1.4.1/src/commands/healthCheck.ts)_
2 changes: 1 addition & 1 deletion docs/link.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ EXAMPLES
$ echo "$MY_ENV_VAR_PASSWORD" | yourdlt link --unlink --useKnownRestGateways
```

_See code: [src/commands/link.ts](https://github.com/usingblockchain/yourdlt/blob/v1.4.0/src/commands/link.ts)_
_See code: [src/commands/link.ts](https://github.com/usingblockchain/yourdlt/blob/v1.4.1/src/commands/link.ts)_
51 changes: 51 additions & 0 deletions docs/renewCertificates.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
`yourdlt renewCertificates`
===========================

It renews the SSL certificates of the node regenerating the node.csr.pem files but reusing the current private keys.
The certificates are only regenerated when they are closed to expiration (30 days). If you want to renew anyway, use the --force param.
This command does not change the node private key (yet). This change would require a harvesters.dat migration and relinking the node key.
It's recommended to backup the target folder before running this operation!

* [`yourdlt renewCertificates`](#yourdlt-renewcertificates)

## `yourdlt renewCertificates`

```
USAGE
$ yourdlt renewCertificates
OPTIONS
-c, --customPreset=customPreset This command uses the encrypted addresses.yml to resolve the main and transport
private key. If the main and transport privates are only stored in the custom preset,
you can provide them using this param. Otherwise, the command may ask for them when
required.
-h, --help It shows the help of this command.
-t, --target=target [default: target] The target folder where the symbol-bootstrap network is generated
-u, --user=user [default: current] User used to run docker images when generating the certificates.
"current" means the current user.
--force Renew the certificates even though they are not close to expire.
--noPassword When provided, Bootstrap will not use a password, so private keys will be stored in
plain text. Use with caution.
--password=password A password used to encrypt and decrypt private keys in preset files like
addresses.yml and preset.yml. Bootstrap prompts for a password by default, can be
provided in the command line (--password=XXXX) or disabled in the command line
(--noPassword).
DESCRIPTION
The certificates are only regenerated when they are closed to expiration (30 days). If you want to renew anyway, use
the --force param.
This command does not change the node private key (yet). This change would require a harvesters.dat migration and
relinking the node key.
It's recommended to backup the target folder before running this operation!
EXAMPLE
$ yourdlt renewCertificates
```

_See code: [src/commands/renewCertificates.ts](https://github.com/usingblockchain/yourdlt/blob/v1.4.1/src/commands/renewCertificates.ts)_
2 changes: 1 addition & 1 deletion docs/report.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ EXAMPLE
$ yourdlt report
```

_See code: [src/commands/report.ts](https://github.com/usingblockchain/yourdlt/blob/v1.4.0/src/commands/report.ts)_
_See code: [src/commands/report.ts](https://github.com/usingblockchain/yourdlt/blob/v1.4.1/src/commands/report.ts)_
2 changes: 1 addition & 1 deletion docs/resetData.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ EXAMPLE
$ yourdlt resetData
```

_See code: [src/commands/resetData.ts](https://github.com/usingblockchain/yourdlt/blob/v1.4.0/src/commands/resetData.ts)_
_See code: [src/commands/resetData.ts](https://github.com/usingblockchain/yourdlt/blob/v1.4.1/src/commands/resetData.ts)_
2 changes: 1 addition & 1 deletion docs/run.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ EXAMPLE
$ yourdlt run
```

_See code: [src/commands/run.ts](https://github.com/usingblockchain/yourdlt/blob/v1.4.0/src/commands/run.ts)_
_See code: [src/commands/run.ts](https://github.com/usingblockchain/yourdlt/blob/v1.4.1/src/commands/run.ts)_
4 changes: 2 additions & 2 deletions docs/start.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ OPTIONS
--upgrade
It regenerates the configuration reusing the previous keys. Use this flag when upgrading the version of bootstrap to
keep your node up to date without dropping the local data. The original preset (-t), assembly (-a), and custom
preset (-a) must be used. Backup the target folder before upgrading.
preset (-c) must be used. Backup the target folder before upgrading.
EXAMPLES
$ yourdlt start
Expand All @@ -88,4 +88,4 @@ EXAMPLES
$ echo "$MY_ENV_VAR_PASSWORD" | yourdlt start -p testnet -a dual
```

_See code: [src/commands/start.ts](https://github.com/usingblockchain/yourdlt/blob/v1.4.0/src/commands/start.ts)_
_See code: [src/commands/start.ts](https://github.com/usingblockchain/yourdlt/blob/v1.4.1/src/commands/start.ts)_
2 changes: 1 addition & 1 deletion docs/stop.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ EXAMPLE
$ yourdlt stop
```

_See code: [src/commands/stop.ts](https://github.com/usingblockchain/yourdlt/blob/v1.4.0/src/commands/stop.ts)_
_See code: [src/commands/stop.ts](https://github.com/usingblockchain/yourdlt/blob/v1.4.1/src/commands/stop.ts)_
2 changes: 1 addition & 1 deletion docs/updateVotingKeys.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ EXAMPLE
$ yourdlt updateVotingKeys
```

_See code: [src/commands/updateVotingKeys.ts](https://github.com/usingblockchain/yourdlt/blob/v1.4.0/src/commands/updateVotingKeys.ts)_
_See code: [src/commands/updateVotingKeys.ts](https://github.com/usingblockchain/yourdlt/blob/v1.4.1/src/commands/updateVotingKeys.ts)_
2 changes: 1 addition & 1 deletion docs/verify.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ EXAMPLE
$ symbol-bootstrap verify
```

_See code: [src/commands/verify.ts](https://github.com/usingblockchain/yourdlt/blob/v1.4.0/src/commands/verify.ts)_
_See code: [src/commands/verify.ts](https://github.com/usingblockchain/yourdlt/blob/v1.4.1/src/commands/verify.ts)_
32 changes: 16 additions & 16 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "yourdlt",
"description": "Tool that lets you connect to existing YourDLT and/or Symbol distributed ledger networks",
"version": "1.4.0",
"version": "1.4.1",
"author": "Using Blockchain Ltd (https://ubc.digital)",
"contributors": [
{
Expand Down
2 changes: 1 addition & 1 deletion presets/dhealth/network.yml
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ knownPeers:
metadata:
name: dhealth-dual-03
roles: Api,Peer,Voting
- publicKey: B871A6C0B54224089797A5D089C91B0956E102DA33B327F6846FD987E12E45F6
- publicKey: 17A225334046DED548FA8494CE1340B4305F53824EDBBFB602108655755E3535
endpoint:
host: api-01.dhealth.cloud
port: 7900
Expand Down
3 changes: 3 additions & 0 deletions presets/shared.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ catapultAppFolder: /usr/catapult
rewardProgramAgentPort: 7881
enableRevoteOnBoot: true
totalVotingBalanceCalculationFix: 0
caCertificateExpirationInDays: 7300 # 20 years
nodeCertificateExpirationInDays: 375 # 1.02 years
certificateExpirationWarningInDays: 30 # certificates are allowed to be renewed 30 before expiring

# config database
databaseName: catapult
Expand Down
15 changes: 12 additions & 3 deletions src/commands/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,12 @@
*/

import { Command, flags } from '@oclif/command';
import { BootstrapService, BootstrapUtils, CommandUtils, ConfigService, Preset } from '../service';
import { BootstrapAccountResolver, BootstrapService, BootstrapUtils, CommandUtils, ConfigService, Preset } from '../service';
import { LogType } from '../logger';
import Logger from '../logger/Logger';
import LoggerFactory from '../logger/LoggerFactory';

const logger: Logger = LoggerFactory.getLogger(LogType.System);

export default class Config extends Command {
static description = 'Command used to set up the configuration files and the nemesis block for the current network';
Expand Down Expand Up @@ -62,7 +67,7 @@ export default class Config extends Command {
}),

upgrade: flags.boolean({
description: `It regenerates the configuration reusing the previous keys. Use this flag when upgrading the version of bootstrap to keep your node up to date without dropping the local data. The original preset (-t), assembly (-a), and custom preset (-a) must be used. Backup the target folder before upgrading.`,
description: `It regenerates the configuration reusing the previous keys. Use this flag when upgrading the version of bootstrap to keep your node up to date without dropping the local data. The original preset (-t), assembly (-a), and custom preset (-c) must be used. Backup the target folder before upgrading.`,
default: ConfigService.defaultParams.reset,
}),

Expand All @@ -89,6 +94,10 @@ export default class Config extends Command {
CommandUtils.passwordPromptDefaultMessage,
true,
);
await new BootstrapService(this.config.root).config(flags);
const accountResolver = new BootstrapAccountResolver(logger);
await new BootstrapService(this.config.root).config({
...flags,
accountResolver,
});
}
}

0 comments on commit 1db3163

Please sign in to comment.