Skip to content

Commit 70a520d

Browse files
FreedischJ12934
authored andcommitted
add scbtl section in documentation
Signed-off-by: freedisch <freeproduc@gmail.com>
1 parent 6a45b7f commit 70a520d

5 files changed

Lines changed: 292 additions & 0 deletions

File tree

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"label": "scbctl",
3+
"position": 10,
4+
"link": {
5+
"type": "generated-index",
6+
"title": "Overview",
7+
"slug": "scbctl"
8+
}
9+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# SPDX-FileCopyrightText: the secureCodeBox authors
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
---
2+
# SPDX-FileCopyrightText: the secureCodeBox authors
3+
#
4+
# SPDX-License-Identifier: Apache-2.0
5+
6+
title: "Setup Shell completion"
7+
description: "How to shell completion and leverage scbctl shell completion"
8+
sidebar_position: 3
9+
---
10+
11+
# Setting Up Shell Completion for scbctl
12+
13+
Shell completion is a feature that allows scbctl to automatically complete command names, flags, and arguments as you type them in your terminal. This can significantly improve your productivity and ease of use when working with scbctl.
14+
15+
## Supported Shells
16+
17+
scbctl supports shell completion for the following shells:
18+
- Bash
19+
- Zsh
20+
- Fish
21+
- PowerShell
22+
23+
## General Setup
24+
25+
To view the shell completion setup instructions, use the following command:
26+
27+
```bash
28+
scbctl completion --help
29+
```
30+
31+
This will display usage information and examples for different shells.
32+
33+
## Bash Completion Setup
34+
35+
1. Ensure that bash-completion is installed. If not, you can install it using your package manager:
36+
37+
```bash
38+
# For Ubuntu/Debian
39+
sudo apt-get install bash-completion
40+
41+
# For macOS (using Homebrew)
42+
brew install bash-completion
43+
```
44+
45+
2. Add the following line to your `~/.bashrc` file:
46+
47+
```bash
48+
source <(scbctl completion bash)
49+
```
50+
51+
3. Reload your shell or run:
52+
53+
```bash
54+
source ~/.bashrc
55+
```
56+
57+
## Zsh Completion Setup
58+
59+
1. Add the following line to your `~/.zshrc` file:
60+
61+
```zsh
62+
source <(scbctl completion zsh)
63+
```
64+
65+
2. If you get an error like `complete:13: command not found: compdef`, add the following to the beginning of your `~/.zshrc` file:
66+
67+
```zsh
68+
autoload -Uz compinit
69+
compinit
70+
```
71+
72+
3. Reload your shell or run:
73+
74+
```zsh
75+
source ~/.zshrc
76+
```
77+
78+
## Fish Completion Setup
79+
80+
1. Run the following command:
81+
82+
```fish
83+
scbctl completion fish | source
84+
```
85+
86+
2. To make it permanent, append the above command to your `~/.config/fish/config.fish` file:
87+
88+
```fish
89+
echo "scbctl completion fish | source" >> ~/.config/fish/config.fish
90+
```
91+
92+
## PowerShell Completion Setup
93+
94+
1. Create a new file named `scbctl_completion.ps1` in your PowerShell profile directory:
95+
96+
```powershell
97+
scbctl completion powershell > $HOME\Documents\WindowsPowerShell\scbctl_completion.ps1
98+
```
99+
100+
2. Add the following line to your PowerShell profile:
101+
102+
```powershell
103+
. $HOME\Documents\WindowsPowerShell\scbctl_completion.ps1
104+
```
105+
106+
107+
## Verifying Completion Setup
108+
109+
After setting up completion, you can verify it's working by:
110+
111+
1. Starting a new shell session or reloading your current one.
112+
2. Typing `scbctl` followed by a space and then pressing the Tab key.
113+
3. You should see available commands or options auto-completed or listed.
114+
115+
## Troubleshooting
116+
117+
If completion doesn't work after following these steps:
118+
119+
1. Ensure you've reloaded your shell or started a new session.
120+
2. Check that scbctl is in your system's PATH.
121+
3. Verify that you've correctly added the completion command to your shell's configuration file.
122+
4. For Bash and Zsh, make sure you have the required completion utilities installed.
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
---
2+
# SPDX-FileCopyrightText: the secureCodeBox authors
3+
#
4+
# SPDX-License-Identifier: Apache-2.0
5+
6+
title: "How to use scbctl"
7+
description: "Intro to the new secureCodeBox CLI tool"
8+
sidebar_position: 2
9+
---
10+
11+
# Using scbctl - CLI for secureCodeBox
12+
13+
`scbctl` is a command-line interface tool designed to simplify interactions with secureCodeBox CustomResources like Scans and ScheduledScans. It provides an easier alternative to using `kubectl` and `helm` for certain operations.
14+
15+
## Installation
16+
17+
To install `scbctl`:
18+
19+
1. Clone the secureCodeBox repository:
20+
```bash
21+
git clone https://github.com/secureCodeBox/secureCodeBox.git
22+
```
23+
24+
2. Build the tool:
25+
```bash
26+
make scbctl
27+
```
28+
29+
3. Move the binary to a directory in your PATH:
30+
```bash
31+
cd scbctl
32+
sudo mv scbctl /usr/local/bin/scbctl
33+
```
34+
35+
## Key Commands
36+
37+
### Creating a Scan
38+
39+
Use the `scan` command to create a new Scan custom resource:
40+
41+
```bash
42+
scbctl scan [scanType] -- [parameters...]
43+
```
44+
45+
Examples:
46+
- Basic scan: `scbctl scan nmap -- scanme.nmap.org`
47+
- Named scan: `scbctl scan nmap --name my-nmap-scan -- scanme.nmap.org`
48+
- Multiple parameters: `scbctl scan nuclei -- -target example.com`
49+
- Scan in a specific namespace: `scbctl scan --namespace testing nmap -- -p 80 scanme.nmap.org`
50+
51+
### Triggering a ScheduledScan
52+
53+
To manually trigger a ScheduledScan:
54+
55+
```bash
56+
scbctl trigger [scheduledScanName] [flags]
57+
```
58+
59+
Examples:
60+
- Trigger a scan: `scbctl trigger nmap-localhost`
61+
- Trigger in a different namespace: `scbctl trigger nmap-localhost --namespace production`
62+
63+
## Additional Features
64+
65+
1. **Namespace Selection**: Most commands support a `--namespace` flag to specify the Kubernetes namespace.
66+
67+
2. **Custom Naming**: You can provide custom names for scans using the `--name` flag with the `scan` command.
68+
69+
3. **Shell Completion**: `scbctl` offers shell completion to make command usage easier. Use `scbctl completion --help` for setup instructions.
70+
71+
## Tips for Effective Use
72+
73+
1. **Explore Help**: Use `scbctl --help` or `scbctl [command] --help` for detailed information about commands and flags.
74+
75+
2. **Namespace Awareness**: Always be mindful of which namespace you're operating in, especially in multi-tenant environments.
76+
77+
3. **Combining with kubectl**: While `scbctl` simplifies many operations, you may still need to use `kubectl` for more advanced Kubernetes operations.
78+
79+
4. **Automation**: Consider incorporating `scbctl` commands into scripts or CI/CD pipelines for automated security scanning.
80+
81+
By leveraging `scbctl`, you can streamline your interaction with secureCodeBox, making it easier to manage scans and scheduled scans in your Kubernetes environment.
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
---
2+
# SPDX-FileCopyrightText: the secureCodeBox authors
3+
#
4+
# SPDX-License-Identifier: Apache-2.0
5+
6+
title: "scbctl overview"
7+
description: "Intro to the new secureCodeBox CLI tool"
8+
sidebar_position: 1
9+
---
10+
11+
# scbctl Project Overview
12+
13+
scbctl is a command-line interface (CLI) tool designed to simplify interactions with secureCodeBox Operator.
14+
15+
## Purpose
16+
17+
The main purpose of scbctl is to provide an easier way to manage secureCodeBox CustomResources in Kubernetes, reducing the complexity of using kubectl and helm for common secureCodeBox operations.
18+
19+
## Key Features
20+
21+
1. **Scan Creation**
22+
- Easily create new Scan custom resources
23+
- Support for various scan types and parameters
24+
25+
2. **ScheduledScan Management**
26+
- Trigger ScheduledScans manually ahead of their schedule
27+
28+
3. **Namespace Support**
29+
- Operate across different Kubernetes namespaces
30+
31+
4. **Custom Naming**
32+
- Assign custom names to scans for better organization
33+
34+
5. **Shell Completion**
35+
- Offers completion support for easier command usage
36+
37+
## Main Commands
38+
39+
1. `scan`: Create a new Scan custom resource
40+
```
41+
scbctl scan [scanType] -- [parameters...]
42+
```
43+
44+
2. `trigger`: Trigger a ScheduledScan execution
45+
```
46+
scbctl trigger [scheduledScanName] [flags]
47+
```
48+
49+
## Installation
50+
51+
```bash
52+
git clone https://github.com/secureCodeBox/secureCodeBox.git
53+
make scbctl
54+
sudo mv scbctl/scbctl /usr/local/bin/scbctl
55+
```
56+
57+
## Use Cases
58+
59+
1. **Quick Scan Creation**: Rapidly initiate security scans without writing YAML files
60+
2. **CI/CD Integration**: Easily incorporate security scanning into automated pipelines
61+
3. **Manual Triggering**: Allows operators to run ScheduledScans on-demand
62+
4. **Cross-Namespace Operations**: Manage scans across different Kubernetes namespaces
63+
64+
## Benefits
65+
66+
1. **Simplicity**: Reduces the learning curve for managing secureCodeBox resources
67+
2. **Efficiency**: Streamlines common tasks, saving time for operators
68+
3. **Flexibility**: Supports various scan types and configurations
69+
4. **Integration**: Can be easily incorporated into scripts and automation workflows
70+
71+
72+
## Future Directions
73+
74+
1. Support scans monitoring
75+
2. Support direct installation on MacOS/Windows/Linux
76+
3. Support other commands for scheduledscans creation
77+

0 commit comments

Comments
 (0)