53 lines
2.5 KiB
Markdown
53 lines
2.5 KiB
Markdown
# Work Control CLI (workctl)
|
|
|
|
## Description
|
|
|
|
This Golang program is a versatile command-line tool designed to streamline common work-related tasks. It offers functions such as work time tracking (using an internal SQLite database), remote computer wake-up (Wake-on-LAN), and establishing SSH tunnels and RDP connections.
|
|
|
|
## Main Features
|
|
|
|
- **Work Time Tracking:** Start, stop, and track work time and breaks using an internal SQLite database (`~/.config/work/worktime.sqlite`). Summaries (daily, weekly, monthly) and yearly Excel export are available.
|
|
- **Remote Computer Wake-up:** Wake remote computers using Wake-on-LAN, potentially via an SSH jump host.
|
|
- **SSH Tunneling:** Establish SSH connections and set up port forwarding for accessing remote services (like SSH or RDP on a workstation) securely.
|
|
- **RDP Connection:** Helper command to launch an RDP client (`xfreerdp`) through an established tunnel.
|
|
|
|
## Prerequisites
|
|
|
|
- Go (Golang) installed (for building or development)
|
|
- SSH client (`ssh`) installed and configured (keys recommended)
|
|
- `lsof` command (for killing tunnels, usually pre-installed on Linux/macOS)
|
|
- `wakeonlan` command installed _on the jump host_ if waking via jump host.
|
|
- `xfreerdp` command (or another RDP client) installed for RDP connections.
|
|
|
|
## Configuration
|
|
|
|
The program expects a configuration file at `~/.config/work/config.toml`. Create this directory and file if they don't exist.
|
|
|
|
Example `config.toml`:
|
|
|
|
```toml
|
|
# ~/.config/work/config.toml
|
|
|
|
[default]
|
|
# SSH connection details for the first hop (e.g., Jump Host or Gateway)
|
|
SSH_USER = "your_ssh_user"
|
|
SSH_HOST = "[jumphost.example.com](https://www.google.com/search?q=jumphost.example.com)"
|
|
SSH_PORT = 22 # Optional, defaults to 22
|
|
|
|
# Optional: Details for a second SSH hop (if waking requires jumping)
|
|
JUMP_USER = "user_on_jump_host" # User needed to run wakeonlan on jump host
|
|
JUMP_HOST = "internal_host_reachable_from_jump" # Host from which wakeonlan is run
|
|
|
|
# Workstation details
|
|
WORKSTATION_HOST = "workstation.internal.network" # Hostname/IP from Jump Host's perspective
|
|
WORKSTATION_IP = "192.168.1.100" # IP for direct tunneling target
|
|
WORKSTATION_MAC = "AA:BB:CC:DD:EE:FF" # MAC address for Wake-on-LAN
|
|
WORKSTATION_USER = "your_workstation_ssh_user" # SSH user on the workstation
|
|
|
|
# RDP connection details (used by the 'connect rdp' command)
|
|
RDP_USER = "your_windows_domain\\your_rdp_user"
|
|
RDP_PASSWORD = "your_rdp_password" # SECURITY RISK: Avoid storing passwords here. Consider alternatives.
|
|
|
|
# Optional: Specify database path explicitly
|
|
# DATABASE_PATH = "/path/to/your/worktime.sqlite"
|
|
```
|