Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ Here is the matrix of deployed services:
| | Filebrowser | 8002 (Localhost) | `http://localhost:8002` | Web File Manager |
| | Yourls | 8003 (Localhost) | `http://localhost:8003` | URL Shortener |
| | GLPI | 8088 (Localhost) | `http://localhost:8088` | IT Asset Management |
| | Gitea | 3000 (Localhost) | `http://localhost:3000` | Self-hosted Git |
| | Gitea | 3000 (Localhost), 2222 | `http://localhost:3000` | Self-hosted Git |
| | Roundcube | 8090 (Localhost) | `http://localhost:8090` | Webmail |
| | Mailserver | 25, 143, 587, 993 | - | Full Mail Server |
| | Syncthing | 8384 (Localhost), 22000 | `http://localhost:8384` | File Synchronization |
Expand Down Expand Up @@ -325,7 +325,7 @@ Voici la matrice des services déployés :
| | Filebrowser | 8002 (Localhost) | `http://localhost:8002` | Web File Manager |
| | Yourls | 8003 (Localhost) | `http://localhost:8003` | URL Shortener |
| | GLPI | 8088 (Localhost) | `http://localhost:8088` | IT Asset Management |
| | Gitea | 3000 (Localhost) | `http://localhost:3000` | Self-hosted Git |
| | Gitea | 3000 (Localhost), 2222 | `http://localhost:3000` | Self-hosted Git |
| | Roundcube | 8090 (Localhost) | `http://localhost:8090` | Webmail |
| | Mailserver | 25, 143, 587, 993 | - | Full Mail Server |
| | Syncthing | 8384 (Localhost), 22000 | `http://localhost:8384` | Synchronisation de Fichiers |
Expand Down
2 changes: 1 addition & 1 deletion server_manager/src/core/secrets.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use anyhow::{Context, Result};
use log::info;
use serde::{Deserialize, Serialize};
use rand::RngExt;
use serde::{Deserialize, Serialize};
use std::fs;
use std::path::Path;

Expand Down
15 changes: 8 additions & 7 deletions server_manager/src/core/users.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,9 @@ mod tests {
// Verify
let user = manager.verify("testuser", "password123");
assert!(user.is_some());
assert_eq!(user.unwrap().role, Role::Observer);
if let Some(u) = user {
assert_eq!(u.role, Role::Observer);
}

assert!(manager.verify("testuser", "wrongpass").is_none());

Expand All @@ -250,17 +252,16 @@ mod tests {
#[test]
fn test_admin_protection() {
let mut manager = UserManager::default();
manager
.add_user("admin", "admin", Role::Admin, None)
.unwrap();
let res1 = manager.add_user("admin", "admin", Role::Admin, None);
assert!(res1.is_ok());

// Should fail to delete last admin
assert!(manager.delete_user("admin").is_err());

// Add another admin
manager
.add_user("admin2", "admin", Role::Admin, None)
.unwrap();
let res2 = manager.add_user("admin2", "admin", Role::Admin, None);
assert!(res2.is_ok());

// Now can delete one
assert!(manager.delete_user("admin").is_ok());
}
Expand Down
98 changes: 82 additions & 16 deletions server_manager/src/interface/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,32 +252,98 @@ async fn run_install() -> Result<()> {

fn print_deployment_summary(secrets: &secrets::Secrets) {
let mut summary = String::new();
summary.push_str("\n=================================================================================\n");
summary.push_str(
"\n=================================================================================\n",
);
summary.push_str(" DEPLOYMENT SUMMARY 🚀\n");
summary.push_str("=================================================================================\n");
summary.push_str(&format!("{:<15} | {:<25} | {:<15} | Password / Info\n", "Service", "URL", "User"));
summary.push_str(&format!("{:<15} | {:<25} | {:<15} | ---------------\n", "-------", "---", "----"));
summary.push_str(
"=================================================================================\n",
);
let _ = std::fmt::Write::write_fmt(
&mut summary,
format_args!(
"{:<15} | {:<25} | {:<15} | Password / Info\n",
"Service", "URL", "User"
),
);
let _ = std::fmt::Write::write_fmt(
&mut summary,
format_args!(
"{:<15} | {:<25} | {:<15} | ---------------\n",
"-------", "---", "----"
),
);

let mut append_row = |service: &str, url: &str, user: &str, pass: &str| {
summary.push_str(&format!("{:<15} | {:<25} | {:<15} | {}\n", service, url, user, pass));
let _ = std::fmt::Write::write_fmt(
&mut summary,
format_args!("{:<15} | {:<25} | {:<15} | {}\n", service, url, user, pass),
);
};

// Helper to format Option<String>
let pass = |opt: &Option<String>| opt.clone().unwrap_or_else(|| "ERROR".to_string());

append_row("Nginx Proxy", "http://<IP>:81", "admin@example.com", "changeme");
append_row("Portainer", "http://<IP>:9000", "admin", "Set on first login");
append_row("Nextcloud", "https://<IP>:4443", "admin", &pass(&secrets.nextcloud_admin_password));
append_row("Vaultwarden", "http://<IP>:8001/admin", "(Token)", &pass(&secrets.vaultwarden_admin_token));
append_row(
"Nginx Proxy",
"http://<IP>:81",
"admin@example.com",
"changeme",
);
append_row(
"Portainer",
"http://<IP>:9000",
"admin",
"Set on first login",
);
append_row(
"Nextcloud",
"https://<IP>:4443",
"admin",
&pass(&secrets.nextcloud_admin_password),
);
append_row(
"Vaultwarden",
"http://<IP>:8001/admin",
"(Token)",
&pass(&secrets.vaultwarden_admin_token),
);
append_row("Gitea", "http://<IP>:3000", "Register", "DB pre-configured");
append_row("GLPI", "http://<IP>:8088", "glpi", "glpi (Change immediately!)");
append_row("Yourls", "http://<IP>:8003/admin", "admin", &pass(&secrets.yourls_admin_password));
append_row("Roundcube", "http://<IP>:8090", "-", "Login with Mail creds");
append_row("MailServer", "PORTS: 25, 143...", "CLI", "docker exec -ti mailserver setup ...");
append_row(
"GLPI",
"http://<IP>:8088",
"glpi",
"glpi (Change immediately!)",
);
append_row(
"Yourls",
"http://<IP>:8003/admin",
"admin",
&pass(&secrets.yourls_admin_password),
);
append_row(
"Roundcube",
"http://<IP>:8090",
"-",
"Login with Mail creds",
);
append_row(
"MailServer",
"PORTS: 25, 143...",
"CLI",
"docker exec -ti mailserver setup ...",
);
append_row("Plex", "http://<IP>:32400/web", "-", "Follow Web Setup");
append_row("ArrStack", "http://<IP>:8989 (Sonarr)", "-", "No auth by default");

summary.push_str("=================================================================================\n\n");
append_row(
"ArrStack",
"http://<IP>:8989 (Sonarr)",
"-",
"No auth by default",
);

summary.push_str(
"=================================================================================\n\n",
);
summary.push_str("NOTE: Replace <IP> with your server's IP address.");

println!("{}", summary);
Expand Down
Loading