Skip to content

Commit

Permalink
Fix certs include bytes
Browse files Browse the repository at this point in the history
  • Loading branch information
CBenoit committed Dec 15, 2020
1 parent cf0719e commit 0c12edc
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions devolutions-gateway/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ pub fn load_certs(config: &CertificateConfig) -> io::Result<Vec<rustls::Certific
load_certs_from_data(data)
.map_err(|()| io::Error::new(io::ErrorKind::InvalidData, "Failed to parse certificate data"))
} else {
let certfile = include_bytes!("cert/publicCert.pem");
let certfile = include_bytes!("../cert/publicCert.pem");
let mut reader = BufReader::new(certfile.as_ref());

rustls::internal::pemfile::certs(&mut reader)
Expand Down Expand Up @@ -132,7 +132,7 @@ fn load_rsa_private_key(config: &CertificateConfig) -> io::Result<Vec<rustls::Pr
load_rsa_private_key_from_data(data)
.map_err(|_| io::Error::new(io::ErrorKind::InvalidData, "Invalid rsa private key"))
} else {
let keyfile = include_bytes!("cert/private.pem");
let keyfile = include_bytes!("../cert/private.pem");
rustls::internal::pemfile::rsa_private_keys(&mut BufReader::new(keyfile.as_ref()))
.map_err(|_| io::Error::new(io::ErrorKind::InvalidData, "File contains invalid rsa private key"))
}
Expand All @@ -151,7 +151,7 @@ fn load_pkcs8_private_key(config: &CertificateConfig) -> io::Result<Vec<rustls::
load_pkcs8_private_key_from_data(data)
.map_err(|_| io::Error::new(io::ErrorKind::InvalidData, "Invalid pkcs8 private key"))
} else {
let keyfile = include_bytes!("cert/private.pem");
let keyfile = include_bytes!("../cert/private.pem");
rustls::internal::pemfile::pkcs8_private_keys(&mut BufReader::new(keyfile.as_ref())).map_err(|_| {
io::Error::new(
io::ErrorKind::InvalidData,
Expand Down
8 changes: 4 additions & 4 deletions jet-proto/tests/rdp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ lazy_static! {
password: String::from("TargetServerPassword"),
domain: Some(String::from("TargetServerDomainName")),
};
static ref CERT_PKCS12_DER: Vec<u8> = include_bytes!("../src/cert/certificate.p12").to_vec();
static ref CERT_PKCS12_DER: Vec<u8> = include_bytes!("../devolutions-gateway/cert/certificate.p12").to_vec();
}

const IRONRDP_CLIENT_PATH: &str = "ironrdp_client";
Expand All @@ -62,8 +62,8 @@ const CHANNEL_INITIATOR_ID: u16 = 1002;
const GRAPHICS_DVC_ID: u32 = 0x06;
const DRDYNVC_CHANNEL_NAME: &str = "drdynvc";

const PUBLIC_CERT_PATH: &str = "src/cert/publicCert.pem";
const PRIVATE_CERT_PATH: &str = "src/cert/private.pem";
const PUBLIC_CERT_PATH: &str = "devolutions-gateway/cert/publicCert.pem";
const PRIVATE_CERT_PATH: &str = "devolutions-gateway/cert/private.pem";
const GRAPHICS_CHANNEL_NAME: &str = "Microsoft::Windows::RDS::Graphics";

fn run_client() -> Child {
Expand Down Expand Up @@ -227,7 +227,7 @@ impl RdpServer {
}

fn nla(&self, mut tls_stream: &mut (impl io::Write + io::Read)) {
let tls_pubkey = get_pub_key_from_pem_file("src/cert/publicCert.pem").unwrap();
let tls_pubkey = get_pub_key_from_pem_file("devolutions-gateway/cert/publicCert.pem").unwrap();

let mut cred_ssp_context = credssp::CredSspServer::new(tls_pubkey, self.identities_proxy.clone())
.expect("failed to create a CredSSP server");
Expand Down

0 comments on commit 0c12edc

Please sign in to comment.