| 326 | |
| 327 | |
| 328 | const bool ServiceHandler::Authorize(const DBus::Authz::Request::Ptr req) |
| 329 | { |
| 330 | if (DBus::Object::Operation::METHOD_CALL == req->operation) |
| 331 | { |
| 332 | if ("net.openvpn.v3.log.AssignSession" == req->target) |
| 333 | { |
| 334 | // All VPN backend client processes (openvpn3-service-client) have |
| 335 | // a well-known D-Bus name being net.openvpn.v3.backends.be$PID, |
| 336 | // where $PID is the process ID of the proccess. This process |
| 337 | // owner should also be the OPENVPN_USERNAME. |
| 338 | // |
| 339 | // This checks that the caller is from this process and has the |
| 340 | // proper credentials |
| 341 | return check_busname_vpn_client(req->caller); |
| 342 | } |
| 343 | else if ("net.openvpn.v3.log.ProxyLogEvents" == req->target) |
| 344 | { |
| 345 | // This is only available to the net.openvpn.v3.session service |
| 346 | // when accessed as the OPENVPN_USERNAME |
| 347 | return check_busname_service_name(req->caller, |
| 348 | Constants::GenServiceName("sessions")); |
| 349 | } |
| 350 | } |
| 351 | return true; |
| 352 | }; |
| 353 | |
| 354 | |
| 355 | // LogService::ServiceHandler - D-Bus method callback functions |
nothing calls this directly
no outgoing calls
no test coverage detected