aboutsummaryrefslogtreecommitdiffstats
path: root/src/server_register.c
Commit message (Collapse)AuthorAgeFilesLines
* Drop auth parameter from create_unsecure_client_configThomas Vanbesien35 hours1-1/+1
| | | | | Credentials over plaintext SecurityPolicy#None are insecure, so the unsecure client path now always uses anonymous authentication.
* Refactor: reduce duplication and tighten helpersThomas Vanbesien36 hours1-39/+47
| | | | | | | | | - Remove redundant applicationUri log in print_application_description - Use UA_SECURITY_POLICY_NONE_URI macro instead of hardcoded string - Extract _s_register_with_lds / _s_deregister_from_lds helpers - Rename signal handler param 'sign' to 'sig' for consistency - Add INT_MIN/INT_MAX bounds check to config_require_int - Extract shared test helpers into tests/test_helpers.sh
* Rename all identifiers to strict Linux snake_caseThomas Vanbesien36 hours1-78/+79
| | | | | | Types PascalCase→snake_case, functions camelCase→snake_case, static functions get _s_ prefix, globals get g_ prefix, struct members and locals to snake_case.
* Extract configureAccessControl() into commonThomas Vanbesien37 hours1-25/+1
| | | | | | The access-control switch block was duplicated in server_lds.c and server_register.c. Move it to a shared helper in common.c with a Doxygen block that consolidates the rationale from both call sites.
* Refactor auth and security params into aggregate typesThomas Vanbesien38 hours1-131/+36
| | | | | | | | Introduce AuthConfig tagged union (AUTH_ANONYMOUS/AUTH_USER/AUTH_CERT) and SecurityConfig struct to replace scattered parameters. Add parseSecurityConfig helper to consolidate duplicated security parsing across all three programs. Simplify opReadTime by moving all auth handling into the client config factory functions.
* Add X509 certificate identity token authenticationThomas Vanbesien38 hours1-6/+16
| | | | | | | | Support authMode=cert alongside anonymous and user. The client reuses its application certificate as the X509 identity token (open62541 requires both to match). Server-side access control advertises the certificate token policy automatically when sessionPKI is configured.
* Extract createUnsecureClientConfig, fix None endpoint negotiationThomas Vanbesien39 hours1-8/+2
| | | | | | | | | | | | UA_ClientConfig_setDefault leaves securityMode at SignAndEncrypt, so unsecure clients failed endpoint negotiation when the LDS only offered None endpoints. Extract the unsecure client setup into createUnsecureClientConfig() which explicitly sets securityMode and securityPolicyUri to None. Also enable discovery-only None endpoint on ServerRegister so unencrypted clients can discover it, and update the unsecure_anonymous test configs to run fully without encryption.
* Make discovery-only None endpoint a createServer optionThomas Vanbesien42 hours1-1/+1
| | | | | | | | Add a discoveryOnly parameter to createServer(). All secure servers still get the None security policy (needed for the client's initial GetEndpoints handshake) and securityPolicyNoneDiscoveryOnly, but only the LDS registers a None endpoint so purely unencrypted clients can discover it. ServerRegister no longer advertises a None endpoint.
* Make client/server encryption optional, rename tests to full namesThomas Vanbesien44 hours1-38/+73
| | | | | | | | | | | | | | | | | | | Make encryption optional for both ServerRegister's LDS client connection and the server side of ServerLDS/ServerRegister: when certificate, privateKey, and trustStore are omitted the programs run with SecurityPolicy#None only. Secure servers also add a discovery-only None endpoint so unencrypted clients can still call FindServers and GetEndpoints. Consolidate tests from 5 policy-specific cases (nosec_anon, none_user, basic256sha256_anon, aes256_anon, aes128_user) down to 3 that cover the important axes: unsecure_anonymous, secure_anonymous, secure_user. Rename directories to use full names. Auto-generate certificates and trust stores in run_test.sh. Update readme and CLAUDE.md to reflect the current program interface (unified Client binary, split ServerRegister configs) and the new test names.
* Fix memory leak, add volatile, reduce duplicationThomas Vanbesien2 days1-28/+61
| | | | | | | | | - config.c: free partial strdup on configAppend failure - common.c: consolidate loadTrustStore error paths with goto - server_lds.c, server_register.c: make running volatile, remove non-async-signal-safe call from signal handler - server_register.c: extract LdsClientParams + makeLdsClientConfig to deduplicate the register/deregister client config setup
* Extract createServer and parseAuthConfig, simplify programsThomas Vanbesien2 days1-171/+46
| | | | | | | | | | | | | | Rename createSecureServer to createServer and add an unsecure path (UA_ServerConfig_setMinimal) when certPath is NULL, eliminating the if/else server creation blocks in server_lds.c and server_register.c. Add parseAuthConfig() to common.c to replace four near-identical authMode parsing blocks across the three programs. Restructure server_register.c error handling with goto cleanup, removing ~20 duplicated cleanup sequences. Rename the CMake library target from DiscoveryCommon to common.
* Make LDS security config optional, add nosec_anon testThomas Vanbesien3 days1-29/+59
| | | | | | | | | | | | | ServerLDS and ServerRegister can now run without encryption when certificate, privateKey, and trustStore are all omitted from the server config file. When any of the three is present, all three are still required. The unsecured server uses UA_ServerConfig_setMinimal with SecurityPolicy#None only. Add nosec_anon integration test covering the LDS unsecured path. Update readme: use symlinks instead of copies for trust stores, note that ServerLDS and ServerRegister support running without certs.
* Replace ClientFindServers with unified Client, use trust store directoriesThomas Vanbesien3 days1-75/+152
| | | | | | | | | | | | | | | | | | | | | | Replace the single-purpose ClientFindServers program with a unified Client that supports three operations via CLI: find-servers, get-endpoints, and read-time. This simplifies the architecture by using one client binary with a single config file instead of a monolithic program that did everything in one run. Split the ServerRegister config into separate server and client config files so the LDS-registration credentials are isolated from the server's own settings. The discovery URL moves from config to a CLI argument. Replace repeated trustList config entries with a single trustStore directory path. Each program now points to a directory under certs/trust/ containing .der files, so adding or removing trust is a file-copy operation rather than editing every config file. Add loadTrustStore()/freeTrustStore() to common.c and remove the now-unused configGetAll() from the config parser. Simplify the test matrix from 6 to 4 cases (security and auth are orthogonal, so the full 3x2 matrix is unnecessary). Update run_test.sh to invoke the new Client three times and use port-polling instead of sleep.
* Add comments to build files and shell scripts, fix minor inconsistenciesThomas Vanbesien3 days1-0/+1
| | | | | | | | | | | | | - CMakeLists.txt: add file-level comment, section banners, target docs, and test-section explanation - cmake/BuildDeps.cmake: add file-level comment describing the configure/build/install workflow - tools/generate_certificate.sh: document arguments and outputs in header block, comment set -euo pipefail - src/config.h: move include guard before Doxygen block (match common.h) - src/server_register.c: add comment to empty anonymous-auth block (match client_find_servers.c)
* Add configurable log level as optional CLI argumentThomas Vanbesien3 days1-2/+17
| | | | | | | | | All three programs now accept an optional second argument [log-level] (trace, debug, info, warning, error, fatal) defaulting to info. The level is applied by setting the logger context pointer directly, avoiding a memory leak that would occur from overwriting the heap-allocated logger struct. Also documents the ASan leak-check workflow in CLAUDE.md.
* Replace CLI arguments with config-file parser and add integration testsThomas Vanbesien3 days1-61/+84
| | | | | | | | Introduce a reusable key=value config parser (config.h/c) and convert all three programs to read their settings from config files instead of positional command-line arguments. Add example config files in config/ and 6 CTest integration tests covering None/Basic256Sha256/Aes128 with anonymous and user authentication. Remove the now-obsolete launch.sh.
* Improve comments in server_register.cThomas Vanbesien3 days1-1/+6
| | | | | | Remove a useless comment on an empty branch and add intent comments before the manual event loop startup, the periodic re-registration loop, and the shutdown deregistration block.
* Make authentication mode and credentials configurable via CLIThomas Vanbesien3 days1-22/+102
| | | | | | | | | | | | | Replace hardcoded user/password credentials with a new <auth-mode> parameter that accepts "anonymous" or "user". When "user" is chosen, two additional <username> <password> arguments are required. ServerRegister accepts two independent auth modes: one for its own server-side access control and one for authenticating to the LDS when registering. ClientFindServers passes credentials to readServerTime, which selects UA_Client_connectUsername or UA_Client_connect accordingly. Update CLAUDE.md running examples and add an auth modes table.
* Add username/password authentication to servers and clientThomas Vanbesien3 days1-0/+20
| | | | | | | | | Disallow anonymous sessions on both the LDS and registering server by configuring UA_AccessControl_default with a hardcoded user/password credential pair. Set UA_ClientConfig_setAuthenticationUsername on the client configs used for register, re-register, and deregister calls. Use UA_Client_connectUsername in the FindServers client when reading server time.
* Initial commit: OPC UA discovery projectThomas Vanbesien3 days1-0/+170
CMake-based C project using open62541 for OPC UA discovery. Includes Local Discovery Server, register server, and find servers client with OpenSSL encryption support.