Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ RUN ls -la third_party/iam-dataset/aws/ && ls -la third_party/iam-dataset/azure/
# Build the application with CGO enabled for sqlite3 support
RUN GOEXPERIMENT=jsonv2 CGO_ENABLED=1 GOOS=linux go build -a \
-ldflags "-X github.com/thand-io/agent/internal/common.Version=${VERSION} -X github.com/thand-io/agent/internal/common.GitCommit=${COMMIT}" \
-o bin/agent .
-o bin/thand .

# Final stage
FROM alpine:latest
Expand All @@ -49,22 +49,22 @@ LABEL org.opencontainers.image.licenses=BSL-1.1
RUN apk --no-cache add ca-certificates gcompat

# Create a non-root user
RUN addgroup -S agent && adduser -S agent -G agent
RUN addgroup -S thand && adduser -S thand -G thand

# Set working directory
WORKDIR /app

# Copy the binary from builder stage
COPY --from=builder /app/bin/agent ./agent
COPY --from=builder /app/bin/thand ./thand

# Copy configuration example file if it exists
COPY config.example.yaml ./

# Change ownership to non-root user
RUN chown -R agent:agent /app
RUN chown -R thand:thand /app

# Switch to non-root user
USER agent
USER thand

# Expose the default port (adjust if your server uses a different port)
EXPOSE 8080
Expand All @@ -76,4 +76,4 @@ HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
ENV THAND_SERVER_PORT=8080

# Default command is to run the server
CMD ["./agent", "server"]
CMD ["./thand", "server"]
12 changes: 6 additions & 6 deletions Dockerfile.cicd
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,25 @@ ARG COMMIT=unknown
RUN apk --no-cache add ca-certificates gcompat

# Create a non-root user
RUN addgroup -S agent && adduser -S agent -G agent
RUN addgroup -S thand && adduser -S thand -G thand

# Set working directory
WORKDIR /app

# Copy pre-built binary based on target architecture
COPY dist/agent-linux-${TARGETARCH} ./agent
COPY dist/agent-linux-${TARGETARCH} ./thand

# Make binary executable
RUN chmod +x ./agent
RUN chmod +x ./thand

# Copy configuration example file if it exists
COPY config.example.yaml ./

# Change ownership to non-root user
RUN chown -R agent:agent /app
RUN chown -R thand:thand /app

# Switch to non-root user
USER agent
USER thand

# Expose the default port (adjust if your server uses a different port)
EXPOSE 8080
Expand All @@ -44,4 +44,4 @@ HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
ENV THAND_SERVER_PORT=8080

# Default command is to run the server
CMD ["./agent", "server"]
CMD ["./thand", "server"]
94 changes: 47 additions & 47 deletions cmd/cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ The CLI connects to a running instance of the Thand Agent, which hosts, manages

```bash
# Login to your Thand server
agent login --login-server <server-url>
thand login --login-server <server-url>

# Request access using AI (natural language)
agent request "I need admin access to AWS production for database maintenance"
thand request "I need admin access to AWS production for database maintenance"

# Or use specific access request
agent request access --provider aws-prod --role admin --duration 4h --reason "Database maintenance"
thand request access --provider aws-prod --role admin --duration 4h --reason "Database maintenance"
```

## Global Options
Expand All @@ -29,43 +29,43 @@ All commands support these global flags:

### Core Commands

#### `agent` (default)
#### `thand` (default)
Interactive access request wizard when no subcommand is specified.

**Usage:**
```bash
agent
thand
```

When run without arguments, launches an interactive wizard to request access if a login server is configured.

#### `agent login`
#### `thand login`
Authenticate with the login server and establish a session.

**Usage:**
```bash
agent login
thand login
```

Opens a browser to authenticate with the configured login server and establishes a session for subsequent requests.

#### `agent request <reason>`
#### `thand request <reason>`
Request access using AI to determine the appropriate role and permissions.

**Usage:**
```bash
agent request "I need access to production database for troubleshooting"
agent request "Grant me read access to S3 bucket for data analysis"
thand request "I need access to production database for troubleshooting"
thand request "Grant me read access to S3 bucket for data analysis"
```

The AI analyzes your natural language request and automatically determines the appropriate provider, role, and permissions needed.

#### `agent request access`
#### `thand request access`
Request access to a specific provider with explicit parameters.

**Usage:**
```bash
agent request access --provider <provider> --role <role> --duration <duration> --reason <reason>
thand request access --provider <provider> --role <role> --duration <duration> --reason <reason>
```

**Options:**
Expand All @@ -76,17 +76,17 @@ agent request access --provider <provider> --role <role> --duration <duration> -

**Example:**
```bash
agent request access --provider aws-prod --role admin --duration 4h --reason "Database maintenance required"
thand request access --provider aws-prod --role admin --duration 4h --reason "Database maintenance required"
```

### Session Management

#### `agent sessions`
#### `thand sessions`
Interactive session manager for authentication sessions.

**Usage:**
```bash
agent sessions
thand sessions
```

Launches an interactive terminal interface that allows you to:
Expand All @@ -105,62 +105,62 @@ Launches an interactive terminal interface that allows you to:

### Configuration and Information

#### `agent config`
#### `thand config`
Display current agent configuration.

**Usage:**
```bash
agent config
thand config
```

Shows current configuration including:
- Server host and port
- Login endpoint
- Logging level

#### `agent roles`
#### `thand roles`
List available roles from the remote login server.

**Usage:**
```bash
agent roles [--provider <provider>]
thand roles [--provider <provider>]
```

**Options:**
- `--provider` - Filter roles by provider (e.g., `aws`, `gcp`, `azure`)

**Examples:**
```bash
agent roles # List all available roles
agent roles --provider aws # List only AWS roles
thand roles # List all available roles
thand roles --provider aws # List only AWS roles
```

#### `agent version`
#### `thand version`
Show version information.

**Usage:**
```bash
agent version
thand version
```

### Server Management

#### `agent server`
#### `thand server`
Run the agent server directly in the foreground.

**Usage:**
```bash
agent server
thand server
```

Starts the Thand Agent server that handles authentication and authorization requests. Useful for development or when running the agent as a standalone service.

#### `agent service`
#### `thand service`
System service management commands.

**Usage:**
```bash
agent service <subcommand>
thand service <subcommand>
```

**Subcommands:**
Expand All @@ -172,21 +172,21 @@ agent service <subcommand>

**Examples:**
```bash
agent service install # Install as system service
agent service start # Start the service
agent service status # Check if service is running
agent service stop # Stop the service
agent service remove # Uninstall the service
thand service install # Install as system service
thand service start # Start the service
thand service status # Check if service is running
thand service stop # Stop the service
thand service remove # Uninstall the service
```

### Maintenance

#### `agent update`
#### `thand update`
Update the agent to the latest version.

**Usage:**
```bash
agent update [--force] [--check]
thand update [--force] [--check]
```

**Options:**
Expand All @@ -197,17 +197,17 @@ Checks GitHub repository for the latest release and automatically updates the bi

**Examples:**
```bash
agent update # Check and install updates with confirmation
agent update --check # Only check for available updates
agent update --force # Update without confirmation prompt
thand update # Check and install updates with confirmation
thand update --check # Only check for available updates
thand update --force # Update without confirmation prompt
```

#### `agent wizard` (hidden)
#### `thand wizard` (hidden)
Interactive wizard to configure access requests with validation.

**Usage:**
```bash
agent wizard
thand wizard
```

Launches a guided wizard that walks through creating an access request with proper validation using your configured workflows, roles, and providers.
Expand Down Expand Up @@ -238,26 +238,26 @@ logging:

```bash
# Basic workflow
agent login --login-server https://thand.company.com
agent request "I need read access to the customer database"
thand login --login-server https://thand.company.com
thand request "I need read access to the customer database"

# Explicit access request
agent request access \
thand request access \
--provider database-prod \
--role readonly \
--duration 2h \
--reason "Customer support ticket investigation"

# Manage sessions
agent sessions
thand sessions

# Check available roles for AWS
agent roles --provider aws
thand roles --provider aws

# Install as system service
sudo agent service install
agent service start
sudo thand service install
thand service start

# Update to latest version
agent update --check
thand update --check
```
6 changes: 3 additions & 3 deletions cmd/cli/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,11 @@ func printInstallInstructions() {
exePath, _ := os.Executable()
fmt.Println("\nService installation failed. You may need to run with elevated privileges:")
fmt.Println("\nLinux:")
fmt.Printf(" sudo %s agent install\n", exePath)
fmt.Printf(" sudo %s thand service install\n", exePath)
Comment thread
hughneale marked this conversation as resolved.
fmt.Println("\n🪟 Windows:")
fmt.Printf(" Run as Administrator: %s agent install\n", exePath)
fmt.Printf(" Run as Administrator: %s thand service install\n", exePath)
Comment thread
hughneale marked this conversation as resolved.
fmt.Println("\nmacOS:")
fmt.Printf(" sudo %s agent install\n", exePath)
fmt.Printf(" sudo %s thand service install\n", exePath)
Comment thread
hughneale marked this conversation as resolved.
}

func init() {
Expand Down
Loading