86 Commits
Author SHA1 Message Date
TheWitness 54aad57980 docs: document gitignore negation trap and main/develop divergence (#22) 2026-09-23 08:07:44 -04:00
TheWitnessandThomas Vincent 629971cc73 Harden RRDtool proxy request handling (#20)
* Harden RRDtool proxy request handling

* Address PR review feedback: encrypt oversized-request errors, fix env inheritance, spacing, and symlink test

Addresses review comments on PR #17:
- lib/client.php: encrypt the 'Request too large' error frame once the
  client is authenticated, matching the existing encrypted-error pattern
- lib/client.php: build the removespikes child-process environment from
  getenv() instead of $_ENV so the full current environment (e.g. TEMP on
  Windows) is inherited, with RRDP_RRDTOOL_PATH merged on top
- lib/client.php: add the missing space in the RRDTOOL_PIPE_UNAVAILABLE
  error frame so it matches the other 'ERROR: ...' responses
- tests/run.php: check the symlink() fixture return value and skip the
  symlink-escape assertion (instead of producing a false positive) when
  symlink() is unavailable

* Upgrade phpseclib 3.x to phpseclib/phpseclib ^4.0

- composer.json/composer.lock: require phpseclib/phpseclib ^4.0 (was ^3.0)
- Update phpseclib3\\... namespace usages to phpseclib4\\... across
  rrdtool-proxy.php, lib/client.php, lib/functions.php, lib/wizard.php,
  and tests/run.php
- lib/functions.php: phpseclib4 removed the Random class, so
  Random::string(32) is replaced with random_bytes(32)
- Fix lib/__master__.php and lib/replicator.php, which PR #17 never
  migrated off the old pre-Composer phpseclib API (new \\phpseclib\\Crypt\\RSA(),
  ->loadKey(), ->getPublicKeyFingerprint() -- none of which exist in
  phpseclib 3.x or 4.x, so these MSR/replicator peer-authentication code
  paths would fatal at runtime). Both now use
  RSA::loadPublicKey()->getFingerprint('md5') wrapped in try/catch,
  matching the pattern already used in lib/client.php, plus a
  constant-time hash_equals() fingerprint comparison
- tests/run.php: relabel the phpseclib round-trip check from 'phpseclib 3'
  to 'phpseclib 4'

* Bump minimum PHP version to 8.2 and add CHANGELOG.md

- composer.json: require php ^8.2 (was ^8.1)
- include/global.php: bump RRDP_PHP_VERSION_REQUIRED to 80200 to match
- README.md: update minimum/recommended PHP version to 8.2
- composer.lock: refreshed for the new php platform constraint
- Add CHANGELOG.md tracking changes prefixed security:/issue:/feature:

* Add PHPDoc blocks to all functions

Adds a PHPDoc block above every function in rrdtool-proxy.php,
lib/functions.php, lib/client.php, lib/__master__.php, lib/replicator.php,
lib/wizard.php, cli/removespikes.php, tests/run.php, and
.phpstan-bootstrap.php, each with a brief description and inferred
@param/@return types. Function signatures themselves are unchanged; PHPStan
will flag any inferred types that turn out to be inaccurate.

* Add .github/copilot-instructions.md

Generated from README.md and this session's learnings: project architecture
(daemon entrypoint, shared lib helpers, client/master/replicator roles,
wizard, removespikes CLI), build/lint/test commands (composer scripts,
php tests/run.php, Windows platform-req caveats), and conventions (tabs,
GPL header block, PHPDoc-only typing, phpseclib4 gotchas, CHANGELOG entry
prefixes).

Also fix .gitignore: the '.git*' pattern was unintentionally also matching
and ignoring the .github/ directory; added a '!.github/' exception so files
under .github/ (like this one) are tracked.

* Add .gitattributes enforcing LF line endings; normalize existing CRLF files

- Add .gitattributes with '* text=auto eol=lf' so Git normalizes line
  endings to LF on checkout/commit regardless of local core.autocrlf
  settings.
- .gitignore: add '!.gitattributes' alongside the existing '!.github/'
  exception, since '.git*' was also unintentionally ignoring .gitattributes
  itself.
- Normalize the two tracked files that had CRLF line endings
  (.github/copilot-instructions.md, CHANGELOG.md) to LF; no other tracked
  files were affected.

* Manual PSR coding-style adjustments

Manual formatting/coding-style cleanup in cli/removespikes.php,
lib/__master__.php, lib/client.php, and lib/replicator.php.

* Address automated review feedback: symlink confinement, key-pair validation, and misc fixes

Addresses 10 unresolved copilot-pull-request-reviewer comments on PR #20:

- lib/functions.php: rewrite rrdp_resolve_path_within() to walk the path one
  segment at a time (instead of only checking the nearest existing ancestor
  via file_exists()), so a symlink anywhere along a not-yet-fully-existing
  path is resolved and confined even if the symlink itself is dangling.
- lib/functions.php: add rrdp_resolve_command_paths(), which resolves every
  RRD file path operand referenced by an RRDtool command (leading bare file
  arguments and DEF:/SDEF: clauses) against the RRA root and rewrites the
  command to use the canonical resolved paths, closing the symlink-escape
  gap left by the lexical-only rrdp_command_has_unsafe_path() check.
- lib/client.php: wire rrdp_resolve_command_paths() into the RRDtool command
  dispatch path, rejecting/rewriting unsafe operands before they reach the
  RRDtool pipe.
- lib/client.php: enforce the request-size limit on each completed
  transaction and the trailing unfinished remainder, instead of on the
  aggregate receive buffer before splitting on _EOT_, so multiple legitimate
  transactions in one read no longer trip a false 'Request too large'.
- rrdtool-proxy.php: validate at startup that the loaded public/private key
  files actually form a matching pair (comparing derived fingerprints)
  instead of only deriving a fingerprint from the public key, failing
  startup instead of accepting requests that will all fail to decrypt.
- lib/__master__.php, lib/replicator.php: resolve peer-supplied FULLSCAN
  folder/file names (and RRDLAST/RRDDUMP request filenames) through
  rrdp_resolve_rra_path() before using them in mkdir()/touch()/
  file_put_contents()/RRDtool restore-dump-last-flushcached operations,
  instead of concatenating raw peer-supplied text; reject and skip entries
  that fail confinement.
- lib/replicator.php, lib/__master__.php: guard rrdtool_pipe_init() failures
  in the main replication loop the same way lib/client.php already does,
  instead of indexing into a false return value and never retrying.
- cli/removespikes.php: make createRRDFileFromXML() return whether the
  RRDtool restore actually succeeded, and exit non-zero when it fails
  instead of silently exiting 0.
- .phpstan.neon: restore level 6 (was lowered to 2, contradicting
  .github/copilot-instructions.md) and add .phpstan-baseline.neon to
  capture the 42 pre-existing findings surfaced at level 6 without hiding
  future regressions.
- tests/run.php: add the standard Cacti Group GPL header block required for
  every PHP file.

---------

Co-authored-by: Thomas Vincent <thomasvincent@gmail.com>
2026-09-19 09:04:05 -04:00
Sean Mancini 7456c5e697 Add shared PHP coding instructions (#21) 2026-09-17 19:36:12 -04:00
Thomas Vincent 2af67f634f chore: add enterprise Dependabot configuration (#16)
* chore: add enterprise Dependabot configuration

* chore: use repository-supported Dependabot labels
2026-09-16 18:32:21 -04:00
dependabot[bot] bbedda4728 Bump phpseclib/phpseclib from 3.0.52 to 3.0.54 (#15)
Bumps [phpseclib/phpseclib](https://github.com/phpseclib/phpseclib) from 3.0.52 to 3.0.54.
- [Release notes](https://github.com/phpseclib/phpseclib/releases)
- [Changelog](https://github.com/phpseclib/phpseclib/blob/master/CHANGELOG.md)
- [Commits](https://github.com/phpseclib/phpseclib/compare/3.0.52...3.0.54)

---
updated-dependencies:
- dependency-name: phpseclib/phpseclib
  dependency-version: 3.0.54
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-06-21 14:22:22 -04:00
dependabot[bot] f0ea77b09e Bump symfony/yaml from 6.4.34 to 6.4.41 (#14)
Bumps [symfony/yaml](https://github.com/symfony/yaml) from 6.4.34 to 6.4.41.
- [Release notes](https://github.com/symfony/yaml/releases)
- [Changelog](https://github.com/symfony/yaml/blob/8.1/CHANGELOG.md)
- [Commits](https://github.com/symfony/yaml/compare/v6.4.34...v6.4.41)

---
updated-dependencies:
- dependency-name: symfony/yaml
  dependency-version: 6.4.41
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-05-27 21:20:17 -04:00
dependabot[bot] f60ee176b2 Bump symfony/cache from 6.4.34 to 6.4.41 (#13)
Bumps [symfony/cache](https://github.com/symfony/cache) from 6.4.34 to 6.4.41.
- [Release notes](https://github.com/symfony/cache/releases)
- [Changelog](https://github.com/symfony/cache/blob/8.1/CHANGELOG.md)
- [Commits](https://github.com/symfony/cache/compare/v6.4.34...v6.4.41)

---
updated-dependencies:
- dependency-name: symfony/cache
  dependency-version: 6.4.41
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-05-27 20:43:27 -04:00
7a00885222 typo - loadPulicKey (#11)
* typo - loadPulicKey

* Update rrdtool-proxy.php

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: TheWitness <thewitness@cacti.net>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-05-10 21:30:13 -06:00
dependabot[bot] 2399bbb04f Bump phpseclib/phpseclib from 3.0.51 to 3.0.52 (#12)
Bumps [phpseclib/phpseclib](https://github.com/phpseclib/phpseclib) from 3.0.51 to 3.0.52.
- [Release notes](https://github.com/phpseclib/phpseclib/releases)
- [Changelog](https://github.com/phpseclib/phpseclib/blob/master/CHANGELOG.md)
- [Commits](https://github.com/phpseclib/phpseclib/compare/3.0.51...3.0.52)

---
updated-dependencies:
- dependency-name: phpseclib/phpseclib
  dependency-version: 3.0.52
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-05-07 19:06:24 -04:00
dependabot[bot] eefdbf7985 Bump phpseclib/phpseclib from 3.0.50 to 3.0.51 (#10)
Bumps [phpseclib/phpseclib](https://github.com/phpseclib/phpseclib) from 3.0.50 to 3.0.51.
- [Release notes](https://github.com/phpseclib/phpseclib/releases)
- [Changelog](https://github.com/phpseclib/phpseclib/blob/master/CHANGELOG.md)
- [Commits](https://github.com/phpseclib/phpseclib/compare/3.0.50...3.0.51)

---
updated-dependencies:
- dependency-name: phpseclib/phpseclib
  dependency-version: 3.0.51
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-10 17:46:38 -04:00
dependabot[bot] 80cb235123 Bump phpseclib/phpseclib from 3.0.49 to 3.0.50 (#9)
Bumps [phpseclib/phpseclib](https://github.com/phpseclib/phpseclib) from 3.0.49 to 3.0.50.
- [Release notes](https://github.com/phpseclib/phpseclib/releases)
- [Changelog](https://github.com/phpseclib/phpseclib/blob/master/CHANGELOG.md)
- [Commits](https://github.com/phpseclib/phpseclib/compare/3.0.49...3.0.50)

---
updated-dependencies:
- dependency-name: phpseclib/phpseclib
  dependency-version: 3.0.50
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-03-23 09:49:20 -04:00
TheWitnessandCopilot 94c8171aa5 Updating rrdproxy for phpseclib3 and composer (#8)
* Updating rrdproxy for phpseclib3 and composer

* QA: Fixing some initialization errors

* QA: A few more updates

* Update lib/replicator.php

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* QA More cleanup

* QA Update the README.md and composer.json

* Update lib/functions.php

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Remove redundant includes

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-02-26 23:15:03 -05:00
TheWitness ffc4e6eff7 Copyrights (#7)
* Update copyrights to 2026

* Update copyrights to 2026
2026-02-15 22:35:32 -05:00
TheWitness 4a4d56949e QA: Remove .travis.yml 2025-06-16 08:47:17 -04:00
TheWitness 14e43e13d8 QA: Updating Copyrights to 2024 2024-03-16 04:54:20 +05:30
Linegod f282696895 typos 2023-12-13 22:29:34 -06:00
Browniebraun 60f491f11b remove old test commit 2022-10-24 22:23:50 +02:00
Browniebraun 1196b8013e Set permissions and enable recursive paths for mkdir() per default. required to support enhanced structured rra paths. 2022-10-24 22:07:10 +02:00
Browniebraun 6afdad854c Update phpseclib to 2.0.38, required for PHP 8.1 and above 2022-10-03 19:39:54 +02:00
Browniebraun f76b73277a Merge branch 'develop' of https://github.com/Cacti/rrdproxy into develop 2022-08-12 22:30:04 +02:00
TheWitness 67fdf69057 PHP 8.2 Support 2022-07-20 19:12:24 -04:00
Browniebraun e429ae1f6a testing git
just a test
2022-07-07 08:14:16 +02:00
netniV e19d441e14 Fix up ignore list 2021-05-11 21:51:09 +00:00
netniV 6f1701ada3 Update Github Templates 2021-05-11 21:50:12 +00:00
Browniebraun 08c59cf26c trim transactions
addressing  #6
2021-05-02 21:47:45 +02:00
Holly Lotor Montalvo 1c9031685c Minor regex fix for RSA fingerprints (#5)
Good Catch,

has been introduced by some code clean-up.
2021-03-12 08:33:15 +01:00
browniebraun 9f891f85e9 update for PHP8
take care of resource | object handling.
2021-02-24 19:46:14 +01:00
browniebraun 38aba79da1 support PHP8
make Cacti's RRDproxy compatible to PHP8
2021-01-17 00:58:01 +01:00
TheWitness c49575fa1e More light PSR 2020-07-02 17:52:57 -04:00
TheWitness f6a2b29f27 PSR Changes and use of constants
- Light PSR Changes
- There was once warning all the time during initialization
- Also use NL instead of "\r\n" throughout code.
2020-07-02 17:17:03 -04:00
browniebraun 18cefe9bab bug fixes
fixings a few bugs
2020-07-02 19:01:49 +02:00
browniebraun ca5e558b3b debugging mode swallows responses that have already been successfully sent out to the clients
- issues with internal IPC communication writing too quickly to the socket.
- logical issues while using __sizeof() wrapper function
- upgrade phpseclib
- do some code clean
2020-05-15 22:10:47 +02:00
cigamit ee4ccd0183 Add GPL License
Update License per RPMlint
2020-01-04 13:25:32 -06:00
browniebraun f5519f0884 Update README.md
remove a few typos
2019-12-13 19:43:03 +01:00
browniebraun b55dcfd1e3 fix upgrade wizard loop
version of an existing configuration file used instead of a new one causes an upgrade loop.
2019-11-29 11:13:04 +01:00
browniebraun 60af757b72 support systemd
- Update PHPSECLIB to the lastest version 2.0.23
- add a basic UNIT file to support systemd (#TODO - configure PATH within wizard)
- adjust output messages for systemd
- improve output of "show version"
2019-11-29 00:15:52 +01:00
Browniebraun ea8f5288f1 use wrapper functions 2019-11-27 13:55:34 +01:00
Browniebraun 6bd54b0626 use wrapper functions 2019-11-27 13:53:29 +01:00
Browniebraun 413da9c92e use wrapper functions 2019-11-27 13:50:55 +01:00
Browniebraun 4c8d9aec2e use wrapper functions
replace all calls of sizeof and count.
2019-11-27 13:47:26 +01:00
Browniebraun a26b60b5d7 add alternative functions
required to support PHP 7.2 and above.
2019-11-27 13:32:46 +01:00
Browniebraun 558b07ac2f remove client file
client configuration file should not be part of the initial software load, because it will always be created during the first server setup routine.
2019-11-17 17:48:40 +01:00
browniebraun b69d84c5f1 fix copy and paste error
see title
2019-11-17 17:45:45 +01:00
browniebraun 4fb791874a small bugfixes for client removal and shut down process
- CLI: fix broken client removal
- CLI: inform open instances about SHUT down state and avoid notification for the instance of the initiator.
2019-11-17 17:39:20 +01:00
netniV 074bc0b107 Allow version to be queried via client/server 2019-10-02 20:59:00 +00:00
netniV 3ca89d6bbf Make admin port show logo/version 2019-10-02 20:20:37 +00:00
netniV bd94da1226 Make version response in line with Cacti Core 2019-10-02 20:01:23 +00:00
netniV 525e9c37fd More QA fixes
Some more QA fixes from discussions that were made and attempts to
reduce repeating code.

- Created functions to determine if RRDtool Proxy Server or
  RRDcached are running

- Created several functions for code readability

  - wizard_handle_title() to handle the top blue title bar

  - wizard_prompt_wordwrap() to provide a colored prompt and
    indent any text that is wrapped to show it is part of said
    prompt

  - wizard_handle_settings() to handle display and input of
    settings in a common fashion.  There are one or two values
    that require custom functionality such as the enable password
    and IP version which can be found inside there

- Corrected issues with ANSI codes causing wordwrap() to wrap sooner
  than expected resulting in strange layouts rather than properly
  justified

- Make enable password secure by using the built in PHP functions
  password_hash() and password_verify()
2019-10-01 22:20:00 +00:00
Browniebraun 91abd5be6d Existing config file has been ignored
During the initial start-up phase an existing configuration has been loaded. In that case include_once called once again within the wizard will not work.
2019-10-01 13:14:46 +02:00
netniV d33d479888 QA updates to correct some minor issues
Fixes the following items:

- Update README.md to provide more information

- Add password to enabled mode

- Add 'help' as another alias to 'list'

- Make Cacti RRDProxy logo have color!

- Move ANSi color codes to defines for code review

- Minor reformatting of various messages
2019-10-01 02:27:18 +00:00