Skip to content

Commit b9e8225

Browse files
author
Harri Klingsten
committed
Updated the documentation.
1 parent 0c01a7a commit b9e8225

File tree

4 files changed

+26
-32
lines changed

4 files changed

+26
-32
lines changed

README.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@
44
This repo contains a Power Command Console project with different commands with some kind of security purpose
55

66
# Prerequisites
7-
You need DockerDesktop or equivalent software installed to run Cdxgen Sbom creation.
7+
If this is the first time you use a Power Commands implementation a encryption setup will be done at the first startup. The encryption key is setup for all Power Commands projects and is unique for every machine. Encryption is used by this Power Commands project to secure your **Dependency Track** API key.
8+
9+
This application is intended to use **CycloneDX** and **Dependency Track** software running as container, therefore you need to have Docker Desktop installed, this way you do not need to install software on your machine besides this Power Commands console application. Setup Docker Desktop is however not described in this documentation.
10+
11+
If you want to setup **CycloneDX** and **Dependency Track** in any other way, I recommend you to look at their respective documentation, links to their repos are present at the end of this document. You also need to adjust the ```PowerCommandsConfiguration.yaml``` configuration file with the appropriate API endpoints. You do not need to run the ```start``` command if the software is installed and already running on your machine or a server else where.
812

913
## Start
1014
```start```
@@ -15,8 +19,10 @@ You need DockerDesktop or equivalent software installed to run Cdxgen Sbom creat
1519
- Download ```docker-compose.yaml file```, path must be set in configuration file, if the file is already downloaded, this step will be skipped, that way you can change settings in the compose file if you want.
1620
- Start the Dependency Tracker Web GUI and API server. (Docker container) default url is: http://localhost:8080 login with ```admin```:```admin```
1721

22+
NOTICE! The first time you run startup the containers needed to run by DockerDesktop on your machine will be downloaded, this could take some time, but you see the process in the console, have patience with that.
23+
1824
## Good to know, before you creating Sbom files...
19-
You can create the files and add them to **Dependency Track** manually if you want but the sbom command will also try to upload them if you use the ```--upload``` option flag. For this to work you will need to configure **Dependency Track** a bit. You need to create a **Team** in the **Administration/Access Management** section, and add at least the permission that is shown in the image below.
25+
You can create the files and add them to **Dependency Track** manually in the GUI. But if you configure **Dependency Track** and **PowerCommands** you been able to us the ```--upload``` option flag and with that the sbom content is automatically uploaded to **Dependency Track**. First tou need to create a **Team** in the **Administration/Access Management** section, and add at least the permission that is shown in the image below.
2026

2127
<img src="dt-api-key.png" alt="cdxgen" width="512">
2228

@@ -35,6 +41,8 @@ Create sbom content from a local path or github repository
3541

3642
**Github repository**
3743

44+
Please notice that https://github.com/PowerCommands/PowerCommands2022.git is just for the example, you can point at any git repository, I do not think that my Power Commands repo is that interesting for you.
45+
3846
```sbom --path https://github.com/PowerCommands/PowerCommands2022.git --NAME <my-sbom-name>```
3947

4048
### --upload
@@ -44,6 +52,10 @@ If you add the --upload option, the sbom will also be uploaded to Dependency Tra
4452

4553
___
4654

55+
## Power Commands
56+
57+
Read more about Power Commands: https://github.com/PowerCommands/PowerCommands2022
58+
4759
Read more about SBOM: https://www.cisa.gov/sbom
4860

4961
## CycloneDX Generator

src/SecTools/Core/PainKiller.PowerCommands.Core/Commands/SecretCommand.cs

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
namespace PainKiller.PowerCommands.Core.Commands
44
{
55
[PowerCommandDesign(description: "Get, creates, removes or view secrets, first you need to configure your encryption key with initialize argument",
6-
options: "initialize|configuration|create|get|remove|salt",
6+
options: "create|initialize|configuration|remove|salt",
77
disableProxyOutput: true,
8-
example: "//View all declared secrets|secret|//Get the decrypted value of named secret|secret --get \"mycommand-pass\"|secret --create \"mycommand-pass\"|secret --remove \"mycommand-pass\"|//Initialize your machine with a new encryption key (stops if this is already done)|secret --initialize")]
8+
example: "//View all declared secrets|secret|secret --create \"mycommand-pass\"|secret --remove \"mycommand-pass\"|//Initialize your machine with a new encryption key (stops if this is already done)|secret --initialize")]
99
public class SecretCommand : CommandBase<CommandsConfiguration>
1010
{
1111
public SecretCommand(string identifier, CommandsConfiguration configuration) : base(identifier, configuration) { }
@@ -14,7 +14,6 @@ public override RunResult Run()
1414
if (Input.HasOption("initialize")) return Init();
1515
if (Input.HasOption("")) return CheckEncryptConfiguration();
1616
if (Input.HasOption("salt")) return Salt();
17-
if (Input.HasOption("get")) return Get();
1817
if (Input.HasOption("create")) return Create();
1918
if (Input.HasOption("remove")) return Remove();
2019
if ((Input.Arguments.Length + Input.Quotes.Length < 2) && Input.Arguments.Length > 0) throw new MissingFieldException("Two parameters must be provided");
@@ -62,17 +61,6 @@ private RunResult List()
6261
foreach (var secret in Configuration.Secret.Secrets) ConsoleService.Service.WriteObjectDescription($"{GetType().Name}", secret.Name, $"{string.Join(',', secret.Options.Keys)}");
6362
return Ok();
6463
}
65-
private RunResult Get()
66-
{
67-
var name = Input.SingleQuote;
68-
var secret = Configuration.Secret.Secrets.FirstOrDefault(s => s.Name.ToLower() == name.ToLower());
69-
if (secret == null) return BadParameterError($"No secret with name \"{name}\" found.");
70-
71-
var val = SecretService.Service.GetSecret(name, secret.Options, EncryptionService.Service.DecryptString);
72-
ConsoleService.Service.WriteObjectDescription($"{GetType().Name}", name, val);
73-
74-
return Ok();
75-
}
7664
private RunResult Create()
7765
{
7866
var name = Input.SingleQuote;

src/SecTools/SecToolsCommands/Commands/DockerDesktopCommand.cs

Lines changed: 0 additions & 16 deletions
This file was deleted.

src/SecTools/SecToolsCommands/Commands/StartCommand.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,16 @@ public override RunResult Run()
1818
CycloneDxManager.Start(xCfg.HostMount, xCfg.ContainerMount, xCfg.HostPort, xCfg.ContainerPort, xCfg.SdxGenServerVolumeMount, xCfg.ImageUrl, xCfg.ServerHost);
1919

2020
DependencyTrackManager.Start(Configuration.DependencyTracker.UrlToDockerComposeFile, Configuration.DependencyTracker.AdminUrl, Configuration.DependencyTracker.StartupTime);
21+
22+
WriteHeadLine("You are now ready to create SBOM files\n");
23+
WriteLine("Notice that to automatically upload the SBOM to Dependency Track, you first need to do two things:");
24+
WriteLine("1) Create a Team in Dependency Track give the Team BOM_UPLOAD, PROJECT_CREATION, PORTFOLIO_MANAGEMENT permissions");
25+
WriteLine("2) Copy the API key, and create a secret in PowerCommands like this:");
26+
WriteCodeExample("secret","--create \"DT_PowerCommand\"");
27+
28+
WriteLine("\nNow you can upload your sbom after it has been created with the sbom command like this:");
29+
WriteCodeExample("sbom","https://github.com/PowerCommands/PowerCommands2022.git --name exampleRepo --upload");
30+
2131
return Ok();
2232
}
2333
}

0 commit comments

Comments
 (0)