forked from proxmox-mirrors/proxmox
rest-server: tls-acceptor: allow setting cipher suite and list
just pass the strings to openssl Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
parent
6873926dea
commit
b4bb3feef3
@ -34,13 +34,16 @@ enum Tls {
|
||||
/// A builder for an `SslAcceptor` which can be configured either with certificates (or path to PEM
|
||||
/// files), or otherwise builds a self-signed certificate on the fly (mostly useful during
|
||||
/// development).
|
||||
#[derive(Default)]
|
||||
pub struct TlsAcceptorBuilder {
|
||||
tls: Option<Tls>,
|
||||
cipher_suites: Option<String>,
|
||||
cipher_list: Option<String>,
|
||||
}
|
||||
|
||||
impl TlsAcceptorBuilder {
|
||||
pub fn new() -> Self {
|
||||
Self { tls: None }
|
||||
Self::default()
|
||||
}
|
||||
|
||||
pub fn certificate(mut self, key: PKey<Private>, cert: X509) -> Self {
|
||||
@ -57,6 +60,16 @@ impl TlsAcceptorBuilder {
|
||||
self
|
||||
}
|
||||
|
||||
pub fn cipher_suites(mut self, suites: String) -> Self {
|
||||
self.cipher_suites = Some(suites);
|
||||
self
|
||||
}
|
||||
|
||||
pub fn cipher_list(mut self, list: String) -> Self {
|
||||
self.cipher_list = Some(list);
|
||||
self
|
||||
}
|
||||
|
||||
pub fn build(self) -> Result<SslAcceptor, Error> {
|
||||
let mut acceptor = SslAcceptor::mozilla_intermediate_v5(SslMethod::tls()).unwrap();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user