-
Notifications
You must be signed in to change notification settings - Fork 69
Self-signed certificate support #2270
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
Changes from 18 commits
67d2585
31b1e37
72873ff
abf9ff0
65ceb8d
5946bbb
930f816
a57e474
7b65d88
6901bae
48e5991
4cb3cf9
41663b2
90d795d
d8c0b16
9354ceb
f1b0180
6d0d98a
64ba358
9214f64
caa3559
6696dee
22a03c9
6eb69ae
2fa3f3d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -68,6 +68,12 @@ impl ProductHTTPClient { | |
| self.client.get("/software/registration").await | ||
| } | ||
|
|
||
| pub async fn set_registration_url(&self, url: &String) -> Result<(), ServiceError> { | ||
| self.client | ||
| .put_void("/software/registration/url", url) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It looks weird to me to have separate endpoints to set the registration code/email and the URL. Perhaps in the future we might consider to add the URL to the registration params.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeap, but code+email is together registration...not sure if it should be also part of registration method param and expect that all following registration of addons is forced to be on identical url. |
||
| .await | ||
| } | ||
|
|
||
| // get list of registered addons | ||
| pub async fn get_registered_addons(&self) -> Result<Vec<AddonSettings>, ServiceError> { | ||
| self.client | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| pub mod client; | ||
| pub mod http_client; | ||
| pub mod model; | ||
| pub mod proxies; | ||
| pub mod settings; | ||
| pub mod store; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| // Copyright (c) [2025] SUSE LLC | ||
| // | ||
| // All Rights Reserved. | ||
| // | ||
| // This program is free software; you can redistribute it and/or modify it | ||
| // under the terms of the GNU General Public License as published by the Free | ||
| // Software Foundation; either version 2 of the License, or (at your option) | ||
| // any later version. | ||
| // | ||
| // This program is distributed in the hope that it will be useful, but WITHOUT | ||
| // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
| // more details. | ||
| // | ||
| // You should have received a copy of the GNU General Public License along | ||
| // with this program; if not, contact SUSE LLC. | ||
| // | ||
| // To contact SUSE LLC about this file by physical or electronic mail, you may | ||
| // find current contact information at www.suse.com. | ||
|
|
||
| use zbus::Connection; | ||
|
|
||
| use crate::error::ServiceError; | ||
|
|
||
| use super::{model::SSLFingerprint, proxies::SecurityProxy}; | ||
|
|
||
| /// D-Bus client for the security service | ||
| #[derive(Clone)] | ||
| pub struct SecurityClient<'a> { | ||
| security_proxy: SecurityProxy<'a>, | ||
| } | ||
|
|
||
| impl SecurityClient<'_> { | ||
| pub async fn new(connection: Connection) -> Result<Self, ServiceError> { | ||
| Ok(Self { | ||
| security_proxy: SecurityProxy::new(&connection).await?, | ||
| }) | ||
| } | ||
|
|
||
| pub async fn get_ssl_fingerprints(&self) -> Result<Vec<SSLFingerprint>, ServiceError> { | ||
| let dbus_list = self.security_proxy.ssl_fingerprints().await?; | ||
| dbus_list | ||
| .into_iter() | ||
| .map(|(alg, value)| { | ||
| Ok(SSLFingerprint { | ||
| fingerprint: value, | ||
| algorithm: alg.try_into()?, | ||
| }) | ||
| }) | ||
| .collect() | ||
| } | ||
|
|
||
| pub async fn set_ssl_fingerprints( | ||
| &self, | ||
| list: &Vec<SSLFingerprint>, | ||
| ) -> Result<(), ServiceError> { | ||
| let dbus_list: Vec<(&str, &str)> = list | ||
| .iter() | ||
| .map(|s| (s.algorithm.to_str(), s.fingerprint.as_str())) | ||
| .collect(); | ||
| self.security_proxy.set_ssl_fingerprints(&dbus_list).await?; | ||
| Ok(()) | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| // Copyright (c) [2024] SUSE LLC | ||
jreidinger marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| // | ||
| // All Rights Reserved. | ||
| // | ||
| // This program is free software; you can redistribute it and/or modify it | ||
| // under the terms of the GNU General Public License as published by the Free | ||
| // Software Foundation; either version 2 of the License, or (at your option) | ||
| // any later version. | ||
| // | ||
| // This program is distributed in the hope that it will be useful, but WITHOUT | ||
| // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
| // more details. | ||
| // | ||
| // You should have received a copy of the GNU General Public License along | ||
| // with this program; if not, contact SUSE LLC. | ||
| // | ||
| // To contact SUSE LLC about this file by physical or electronic mail, you may | ||
| // find current contact information at www.suse.com. | ||
|
|
||
| use crate::{base_http_client::BaseHTTPClient, error::ServiceError}; | ||
|
|
||
| use super::model::SSLFingerprint; | ||
|
|
||
| pub struct SecurityHTTPClient { | ||
| client: BaseHTTPClient, | ||
| } | ||
|
|
||
| impl SecurityHTTPClient { | ||
| pub fn new(base: BaseHTTPClient) -> Self { | ||
| Self { client: base } | ||
| } | ||
|
|
||
| pub async fn get_ssl_fingerprints(&self) -> Result<Vec<SSLFingerprint>, ServiceError> { | ||
| self.client.get("/security/ssl_fingerprints").await | ||
| } | ||
|
|
||
| pub async fn set_ssl_fingerprints( | ||
| &self, | ||
| fps: &Vec<SSLFingerprint>, | ||
| ) -> Result<(), ServiceError> { | ||
| self.client | ||
| .put_void("/security/ssl_fingerprints", fps) | ||
| .await | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| // Copyright (c) [2025] SUSE LLC | ||
| // | ||
| // All Rights Reserved. | ||
| // | ||
| // This program is free software; you can redistribute it and/or modify it | ||
| // under the terms of the GNU General Public License as published by the Free | ||
| // Software Foundation; either version 2 of the License, or (at your option) | ||
| // any later version. | ||
| // | ||
| // This program is distributed in the hope that it will be useful, but WITHOUT | ||
| // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
| // more details. | ||
| // | ||
| // You should have received a copy of the GNU General Public License along | ||
| // with this program; if not, contact SUSE LLC. | ||
| // | ||
| // To contact SUSE LLC about this file by physical or electronic mail, you may | ||
| // find current contact information at www.suse.com. | ||
|
|
||
| use serde::{Deserialize, Serialize}; | ||
|
|
||
| #[derive(Clone, Debug, Serialize, Deserialize, utoipa::ToSchema)] | ||
| pub enum SSLFingerprintAlgorithm { | ||
| SHA1, | ||
| SHA256, | ||
| } | ||
|
|
||
| impl TryFrom<String> for SSLFingerprintAlgorithm { | ||
|
||
| type Error = crate::ServiceError; | ||
|
|
||
| fn try_from(value: String) -> Result<Self, Self::Error> { | ||
| match value.to_uppercase().as_str() { | ||
| "SHA1" => Ok(Self::SHA1), | ||
| "SHA256" => Ok(Self::SHA256), | ||
| _ => Err(crate::error::ServiceError::UnsupportedSSLFingerprintAlgorithm(value)), | ||
|
||
| } | ||
| } | ||
| } | ||
|
|
||
| impl SSLFingerprintAlgorithm { | ||
| pub fn to_str(&self) -> &'static str { | ||
|
||
| match self { | ||
| SSLFingerprintAlgorithm::SHA1 => "SHA1", | ||
| SSLFingerprintAlgorithm::SHA256 => "SHA256", | ||
| } | ||
| } | ||
| } | ||
|
|
||
| impl Default for SSLFingerprintAlgorithm { | ||
|
||
| fn default() -> Self { | ||
| Self::SHA256 | ||
| } | ||
| } | ||
|
|
||
| #[derive(Clone, Debug, Serialize, Deserialize, utoipa::ToSchema)] | ||
| pub struct SSLFingerprint { | ||
| pub fingerprint: String, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please, document (for OpenAPI). |
||
| #[serde(default)] | ||
| pub algorithm: SSLFingerprintAlgorithm, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Document (openAPI). |
||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.