Skip to content

(WIP) : HTTPS support for manufacturing-server and manufacturing-client for DI - #579

Draft
sarmahaj wants to merge 3 commits into
fdo-rs:mainfrom
sarmahaj:fdo_di_https
Draft

(WIP) : HTTPS support for manufacturing-server and manufacturing-client for DI#579
sarmahaj wants to merge 3 commits into
fdo-rs:mainfrom
sarmahaj:fdo_di_https

Conversation

@sarmahaj

@sarmahaj sarmahaj commented Nov 23, 2023

Copy link
Copy Markdown
Contributor

This PR (currently in draft state) contains-

  • changes in manufacturing_server and manufacturing_client to support HTTPS requests.
  • HTTP & HTTPS both requests work
  • accordingly changes in manufacturing_server config file for http & https port number
  • CI tests are still WIP

(Meanwhile to test manually, use following commands )

To create key & certs:
openssl genpkey -algorithm RSA -out server.key
openssl req -new -key server.key -out server.csr
openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt

Mention this address in manufacturing_server_https_key and manufacturing_server_https_cert fields in manufacturing_server.config file.
(This part to generate cert and key will be taken care in separate PR as a part of admin-tool)

sudo MANUFACTURING_SERVER_CONF=/usr/share/fdo/manufacturing_server.yml LOG_LEVEL=trace ./target/debug/fdo-manufacturing-server

HTTPS request:
sudo DEV_ENVIRONMENT=1 MANUFACTURING_SERVER_URL=https://localhost:8084 LOG_LEVEL=trace DIUN_PUB_KEY_ROOTCERTS=aio-dir/keys/diun_cert.pem ./target/debug/fdo-manufacturing-client

HTTP request:
sudo DEV_ENVIRONMENT=0 MANUFACTURING_SERVER_URL=http://localhost:8080 LOG_LEVEL=trace DIUN_PUB_KEY_ROOTCERTS=aio-dir/keys/diun_cert.pem ./target/debug/fdo-manufacturing-client

DI should work and create device_credentials file under /etc/device-credentials.

Comment thread integration-tests/tests/di_diun.rs Fixed
Comment thread integration-tests/tests/di_diun.rs Fixed
Comment thread integration-tests/tests/di_diun.rs Fixed
@sarmahaj sarmahaj changed the title HTTPS support for manufacturing-server and manufacturing-client for DI (WIP) : HTTPS support for manufacturing-server and manufacturing-client for DI Jan 18, 2024
Some(&mfg_server),
|cfg| {
cfg.env("DEVICE_CREDENTIAL_FILENAME", "devicecredential.dc")
.env("MANUFACTURING_SERVER_URL", "https://localhost:8086")

Check notice

Code scanning / devskim

Accessing localhost could indicate debug code, or could hinder scaling.

Do not leave debug code in production
Comment thread integration-tests/tests/di_diun_https.rs Fixed
@sarmahaj
sarmahaj force-pushed the fdo_di_https branch 2 times, most recently from 3a58471 to f0c60c0 Compare February 7, 2024 11:54
- warp::service and hyper::server combination used to run https server
- separate bind address for http and https
- tls_config containes tls config for htpps
- now manufacturing-server supports both http and https requests from
client.

Signed-off-by: Sarita Mahajan <sarmahaj@redhat.com>
- changes on client side to support https request

Signed-off-by: Sarita Mahajan <sarmahaj@redhat.com>
- still WIP

Signed-off-by: Sarita Mahajan <sarmahaj@redhat.com>
// cfg.insert("manufacturing_server_https_cert_path", "/workspaces/fido-device-onboard-rs/integration-tests/tests/test-data/https-test");
// cfg.insert("manufacturing_server_https_key_path", "/workspaces/fido-device-onboard-rs/integration-tests/tests/test-data/https-test");
// cfg.insert("bind_http", "8085");
// cfg.insert("bind_https", &("127.0.0.1:{}" ));

Check notice

Code scanning / devskim

Accessing localhost could indicate debug code, or could hinder scaling.

Do not leave debug code in production
"bind",
&format!("127.0.0.1:{}", self.server_number.server_port().unwrap()),
);
cfg.insert("bind_https", &format!("127.0.0.1:{}", 6000));

Check notice

Code scanning / devskim

Accessing localhost could indicate debug code, or could hinder scaling.

Do not leave debug code in production

// Set subject for the certificate
let mut name_builder = X509NameBuilder::new()?;
name_builder.append_entry_by_nid(openssl::nid::Nid::COMMONNAME, "localhost")?;

Check notice

Code scanning / devskim

Accessing localhost could indicate debug code, or could hinder scaling.

Do not leave debug code in production
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants