brainstorming & first draft data model

This commit is contained in:
Mans Ziesel 2024-12-03 20:25:46 +01:00
parent 2837fa2c47
commit ccaa2ce40b
2 changed files with 92 additions and 66 deletions

View File

@ -1,13 +1,4 @@
<a id="readme-top"></a>
<!-- PROJECT SHIELDS -->
<!--
*** I'm using markdown "reference style" links for readability.
*** Reference links are enclosed in brackets [ ] instead of parentheses ( ).
*** See the bottom of this document for the declaration of the reference variables
*** for contributors-url, forks-url, etc. This is an optional, concise syntax you may use.
*** https://www.markdownguide.org/basic-syntax/#reference-style-links
-->
<!-- PROJECT LOGO -->
<br />
<div align="center">
@ -17,27 +8,28 @@
<h3 align="center">Zadmin</h3>
<p align="center">
Zadmin is a C2 system for managing devices.
Zadmin is a RMM system for managing devices.
</p>
</div>
- It will have the following features
- Logging???
- Remote power controll
- Remote controll of screens
Features
- Logging of actions preformed on hosts
- User <name> started remote CMD
- Remote power control
- Seamless Teamviewer like remote control
- optionally show end-user that an administrator is connected
- Remote shell
- Remote file manager
- Task scheduling
- Status notifications
- Web interface
- CLI
- API
- Multi tenancy??
- Device Monitoring: Real-time monitoring of hardware and software performance, including CPU usage, memory usage, disk space, and network activity.
- Alerting and Notifications: Customizable alerts for system performance issues, security threats, and other critical events, sent via email, SMS, or in-app notifications.
- User management, RBAC for teams???
- Ticket software integration???
- Device profiles
- Bulk device installer
- Multi tenancy
- Perms
- device classes (servers, dektops, phones)
Supported platforms
- Linux
@ -45,8 +37,27 @@ Supported platforms
- Android??
- BSD???
## Qualities
Datapoints collected of hosts
- Hostname
- Wan IP
- Interface details
- IP addresses
- MAC address
- Usage statistics
- Installed agent info
- Agent version
- Antivirus state
- Windows defender?
- CPU usage, memory usage and disk space
- Reboot pending
- Software catalog
- all installed software
- OS information
- OS type
- OS version
- OS patch
- Currently logged on users
- Uptime
- mTLS for communication
- Kernel level client????
- AV integration
Ideas???
- NATS.io as a transport layer?

View File

@ -1,60 +1,75 @@
package models
import "time"
// Model for the user accounts
type AccountModel struct {
ID string
FirstName string
LastName string
PasswordHash string
Roles []RoleModel
ID string `json:"id"`
FirstName string `json:"first_name"`
LastName string `json:"last_name"`
PasswordHash string `json:"password_hash"`
CreatedAt time.Time `json:"created_at"`
}
type RoleModel struct {
TenantPattern string
AllowedPerms Permission
DeniedPerms Permission
type OrganizationModel struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
CreatedAt time.Time `json:"created_at"`
}
type Permission string
const (
PermissionBillingAll Permission = "billing"
PermissionBillingReader Permission = "billing/reader"
PermissionBillingEdit Permission = "billing/edit"
PermissionDevicesAll Permission = "devices"
PermissionDevicesAdmin Permission = "devices/admin"
PermissionDevicesServicedeskagent Permission = "devices/servicedeskagent"
)
// Model for the hosts managed by zadmin
type MachineModel struct {
ID string
OsType string
ID string `json:"id"` // machine ID
Organization OrganizationModel `json:"organization"` // Organization this machine belongs to
CreatedAt time.Time `json:"created_at"` // Time created in zadmin
Description string `json:"description"` // Description of machine
AgentConfig MachineAgentConfig `json:"agent_config"` // Config used by this machine
OsType string `json:"os_type"` // OS Type TODO: make constants
GoArch string `json:"go_arch"` // Go arch
}
// Model for a tenant within zadmin
type TenantModel struct {
ID string
type MachineData struct {
MomentCollected time.Time `json:"moment_collected"`
FirstSeen time.Time `json:"first_seen"` // Time of first contact with zadmin
LastSeen time.Time `json:"last_seen"` // Time of last contact with zadmin
Hostname string `json:"hostname"` // Configured system hostname
PublicIPv4Address string `json:"public_ipv4_address"` // Public IPv4 address
PublicIPv6Address string `json:"public_ipv6_address"` // Public IPv6 address
Interfaces []MachineInterfaceDetails `json:"machine_interfaces"` // Interface details
AgentVersion string
AntivirusInfo AntivirusInfo
UsageStatistics UsageStatistics
}
type ActionType string
const (
ShutDownAction ActionType = "shutdown"
RestartAction ActionType = "restart"
)
// A command to be executed on a Machine
type CommandModel struct {
ID string
ActionType ActionType
Result any
type AntivirusInfo struct {
AVType string `json:"av_type"`
OK bool `json:"ok"`
}
// Profile with configuration
type MachineProfile struct {
ID string
type UsageStatistics struct {
AvailCPU int `json:"avail_cpu"` // Available mCPU
UsedCPU int `json:"used_cpu"` // Used mCPU
AvailRAM int `json:"avail_ram"` // Avaiable RAM in MB
UsedRAM int `json:"used_ram"` // Used RAM in MB
}
type DiskInformation struct {
Name string `json:"name"` // Name of disk
Mountpoint string `json:"mountpoint"` // Mountpoint of disk
SizeB int `json:"size_b"` // Size of disk in bytes
UsedB int `json:"used_b"` // Used disk space in bytes
FreeB int `json:"free_b"` // Free disk space in bytes
}
type MachineInterfaceDetails struct {
InterfaceName string `json:"interface_name"` // Name of the network interface
InterfaceMac string `json:"interface_mac"` // Interface MAC address
Addressess []string `json:"addressess"` // Interface IP addressess
}
// Configuration to be used by the agent on an machine
type MachineAgentConfig struct {
ServerHostname string `json:"server_hostname"`
CheckinInterval int `json:"checkin_interval"`
}