Config.hpp

1. Overview

Configuration data model. Declares the complete typed configuration tree and the public functions used to load, save and read daemon configuration files.

The original source path is:

include/bsc/config/Config.hpp

2. Role in the Daemon

This file participates in the privileged BastionGuard Secure Connection daemon. It uses the shared bsc models and follows the daemon-wide fallback strategy: optional high-fidelity backends are used when available, while portable polling or stub behavior preserves service startup.


3. Namespaces

  • bsc::config

4. Dependencies and Included Interfaces

  • cstdint
  • string

5. Declared Types

  • struct Config
  • struct ServerTLSOptions
  • struct ServerAuth
  • struct ServerConfig
  • struct RulesOptions
  • struct FwOptions
  • struct StatsOptions
  • struct InternalOptions
  • struct TasksOptions

6. State and Data Members

The interface declares the following relevant state members:

  • std::string cacert
  • std::string server_cert
  • std::string server_key
  • std::string client_cert
  • std::string client_key
  • ServerTLSOptions tls
  • ServerAuth authentication
  • std::string source_path
  • FwOptions fw_options
  • ServerConfig server
  • RulesOptions rules
  • InternalOptions internal
  • StatsOptions stats
  • TasksOptions tasks

7. API and Functions

The file declares or implements the following callable entry points:

  • Config load_file(const std::string& path)
  • bool save_file(const Config& cfg, const std::string& path)
  • std::string read_file(const std::string& path)

8. Configuration Groups

  • ServerConfig and TLS/authentication settings.
  • FwOptions for JSON firewall reload, NFQUEUE and monitoring intervals.
  • RulesOptions for rule paths and checksum matching.
  • InternalOptions, StatsOptions and TasksOptions for runtime limits and scheduling.
  • Top-level defaults for unknown connections, duration, process monitor and eBPF object path.

9. External Resources and Protocol Values

Relevant paths, endpoints, command names or policy values referenced by this file include:

  • unix:///tmp/bsd-daemon.sock
  • /var/log/bastionguard-secure-connectiond.log
  • /etc/bastionguard-secure-connectiond/rules/
  • /etc/bastionguard-secure-connectiond/system-fw.json
  • /etc/bastionguard-secure-connectiond/tasks/
  • nftables
  • allow
  • proc

10. Security Considerations

  • The component processes privileged operating-system or network data and should run with only the capabilities required by its backend.
  • Configuration and protocol JSON must be considered untrusted until successfully parsed and type-checked.

11. Implementation Considerations

  • The file follows the daemon-wide convention of returning status values or optional objects instead of making recoverable conditions fatal.

12. Source Metrics

MetricValue
File size2148 bytes
Lines71
Detected API entries3
Detected types9