-
Notifications
You must be signed in to change notification settings - Fork 407
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
OpenSSLContext::Config: added set_cn_reject_handler() hook
The set_cn_reject_handler() method allows users to specify a hook for examining the leaf Common Name during SSL/TLS handshakes, with the option to reject the handshake. Signed-off-by: James Yonan <[email protected]>
- Loading branch information
1 parent
0571a11
commit 689f3ed
Showing
4 changed files
with
82 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// OpenVPN -- An application to securely tunnel IP networks | ||
// over a single port, with support for SSL/TLS-based | ||
// session authentication and key exchange, | ||
// packet encryption, packet authentication, and | ||
// packet compression. | ||
// | ||
// Copyright (C) 2012- OpenVPN Inc. | ||
// | ||
// SPDX-License-Identifier: MPL-2.0 OR AGPL-3.0-only WITH openvpn3-openssl-exception | ||
// | ||
|
||
#pragma once | ||
|
||
#include <string> | ||
#include <memory> | ||
|
||
namespace openvpn { | ||
|
||
/** | ||
* Abstract base class used to provide early rejection | ||
* of specific Common Names during SSL/TLS handshake. | ||
*/ | ||
class CommonNameReject | ||
{ | ||
public: | ||
typedef std::unique_ptr<CommonNameReject> UPtr; | ||
|
||
/** | ||
* Should a leaf certificate having Common Name cn | ||
* be rejected during SSL/TLS handshake? | ||
* | ||
* @param cn Common Name | ||
* @return true if certificate should be rejected. | ||
*/ | ||
virtual bool reject(const std::string &cn) = 0; | ||
|
||
virtual ~CommonNameReject() = default; | ||
}; | ||
|
||
} // namespace openvpn |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters