8000 feat(certificates): add self-signed certs on Ubuntu by RayProud · Pull Request #234 · mentimeter/linkup · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat(certificates): add self-signed certs on Ubuntu #234

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

Conversation

RayProud
Copy link
Contributor
@RayProud RayProud commented Apr 23, 2025

There's no such cli tool like security on Ubuntu, so everything is mostly manual.

Where do certs live in Linux
Certs live in /etc/ssl/certs, but this directory is mostly a collection of symlinks that shouldn't be updated directly.
Instead, we copy our cert to /usr/local/share/ca-certificates and then run update-ca-certificates to update the symlinks.

Where do Firefox certs live in Linux
Depends!
I found three places depending on how Firefox was installed and what your Linux is.

    let profile_dirs = [
        ".mozilla/firefox",
        "snap/firefox/common/.mozilla/firefox",
        ".var/app/org.mozilla.firefox/.mozilla/firefox",
    ];

How to test

  • pull the branch on a Ubuntu machine
  • cd linkup-cli && cargo install --path .
  • cd .. — get back to the root of the repo
  • sudo setcap cap_net_bind_service=+ep ~/.cargo/bin/linkup
  • export LINKUP_CONFIG=~/linkup/linkup-config.yaml
  • export PATH=$PATH:~/.cargo/bin/linkup >> ~/.bashrc
  • source ~/.bashrc
  • linkup start
  • linkup local-dns install
  • linkup health

Resourses:

@RayProud RayProud requested a review from Copilot April 23, 2025 12:34
Copy link
@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces support for adding self-signed certificates on Ubuntu by implementing Linux-specific functions for certificate management while preserving the macOS implementation. Key changes include defining a constant for the CA PEM filename, adding Linux-specific implementations for checking, adding, and removing the CA certificate, and updating Firefox profile directory detection based on the operating system.

Comments suppressed due to low confidence (2)

local-server/src/certificates/mod.rs:205

  • The Linux implementation of ca_exists_in_keychain uses expect which may panic if the 'find' command fails; consider handling the error gracefully to prevent a potential crash in production.
.status().expect("Failed to find linkup CA").success()

local-server/src/certificates/mod.rs:317

  • The function firefox_profiles_cert_storages currently selects only the first existing profile directory, which might omit additional valid Firefox profiles; consider iterating over all directories and merging the results.
.iter().map(|dir| PathBuf::from(home.clone()).join(dir))

@RayProud RayProud requested a review from Copilot April 23, 2025 13:43
Copy link
@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces support for self‐signed certificates on Ubuntu by updating the certificate installation and removal process for Linux while preserving macOS functionality.

  • Introduces a new constant for the certificate PEM name and updates certificate path references
  • Implements Linux-specific functions to check, add, and remove the CA from the system trust store
  • Adjusts Firefox profile certificate storage discovery for both macOS and Linux
Comments suppressed due to low confidence (3)

local-server/src/certificates/mod.rs:197

  • [nitpick] The Linux implementation of ca_exists_in_keychain uses the 'find' command with a basic error message. Consider adding more context to the error message (e.g., noting potential issues like command availability or permission errors) to ease future debugging.
fn ca_exists_in_keychain() -> bool {

local-server/src/certificates/mod.rs:287

  • [nitpick] Consider including the file path or additional context in the error message when the removal of the CA certificate fails. This would help in diagnosing issues related to file permissions or incorrect paths.
return Err(UninstallError::DeleteCaCertificate("rm command returned unsuccessful exit status".to_string()));

local-server/src/certificates/mod.rs:337

  • [nitpick] The error handling in the Firefox profiles discovery simply prints to stderr, which might not be visible or tracked in production logs. Consider using a more robust logging mechanism or propagating the error to improve visibility.
Err(error) => { if !matches!(error.kind(), std::io::ErrorKind::NotFound) { eprintln!("Failed to load Firefox profiles: {}", error); } }

@RayProud RayProud force-pushed the romanprudnikov/ship-2075-implement-adding-self-signed-certificates-to-trust-store-on branch from e162add to b593161 Compare April 24, 2025 14:29
@RayProud RayProud requested a review from Copilot April 24, 2025 14:49
@RayProud RayProud marked this pull request as ready for review April 24, 2025 14:50
Copy link
@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for managing self-signed certificates on Ubuntu by introducing Linux-specific implementations for certificate installation and removal, while also cleaning up macOS‑only conditionals across various modules.

  • Updated certificate module with a new constant and Linux implementations for keychain operations.
  • Removed unnecessary macOS‑specific conditionals from services, commands, and configuration modules.

Reviewed Changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
local-server/src/certificates/mod.rs Added constant for cert naming and Linux-specific keychain functions.
linkup-cli/src/services/mod.rs Removed macOS‑specific cfg from module imports.
linkup-cli/src/main.rs Removed redundant macOS‑specific conditionals.
linkup-cli/src/local_config.rs Removed macOS‑specific configuration functions.
linkup-cli/src/commands/*.rs Removed macOS‑specific blocks to support Ubuntu usage.

Copy link
Collaborator
@augustoccesar augustoccesar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

RayProud and others added 4 commits April 25, 2025 09:35
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@RayProud RayProud force-pushed the romanprudnikov/ship-2075-implement-adding-self-signed-certificates-to-trust-store-on branch from 7797e78 to 2f59f5e Compare April 25, 2025 07:48
@RayProud RayProud requested a review from augustoccesar April 25, 2025 12:04
Comment on lines 3 to 7
use crate::commands::local_dns;
use crate::local_config::LocalState;
use crate::{
commands, linkup_dir_path, linkup_exe_path, local_config, prompt, InstallationMethod, Result,
};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit/suggestion:
Maybe we can merge these three use since they are all for crate::. Wdyt?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure!
Changed it

@RayProud RayProud requested a review from augustoccesar April 28, 2025 08:16
@RayProud RayProud merged commit ec6367e into next Apr 28, 2025
6 checks passed
@RayProud RayProud deleted the romanprudnikov/ship-2075-implement-adding-self-signed-certificates-to-trust-store-on branch April 28, 2025 08:28
augustoccesar added a commit that referenced this pull request May 5, 2025
This release gets the Linux version closer to the macOS. We are testing it with Ubuntu.

Main changes:
- Ensure that Linkup can bind to 80/443 on Linux
  -  #232 (fixes: 34f5282, 7e8cef5, b6fac77)
- Manage self-signed certificates on Linux
  -  #234 
- Fix `health` command output on Linux
  - #236   

Other changes:
- Fix install script link on docs (8e6009d)
- Use Ruff formatting on install script (e39de86)
- Don't propagate `baggage` header (#237 )

---------

Co-authored-by: Roman Prudnikov <stillerr@yandex.ru>
Co-authored-by: Oliver Stenbom <oliver@stenbom.eu>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0