Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

sarmahaj
Copy link
Contributor

@sarmahaj sarmahaj commented Nov 23, 2023

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.

integration-tests/tests/di_diun.rs Fixed Show fixed Hide fixed
integration-tests/tests/di_diun.rs Fixed Show fixed Hide fixed
integration-tests/tests/di_diun.rs Fixed Show fixed Hide 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
integration-tests/tests/di_diun_https.rs Dismissed Show dismissed Hide dismissed
- 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 <[email protected]>
- changes on client side to support https request

Signed-off-by: Sarita Mahajan <[email protected]>
- still WIP

Signed-off-by: Sarita Mahajan <[email protected]>
// 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. Note test

Do not leave debug code in production
@@ -801,6 +900,7 @@
"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. Note test

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. Note test

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.

1 participant