fix: now deals with the correct path for the old ssh accounts

This commit is contained in:
silver 2023-08-24 18:54:22 +01:00
parent 32d693fa8c
commit ce471ad39a
6 changed files with 23 additions and 9 deletions

View file

@ -206,7 +206,7 @@ pub fn get_config() -> Config {
mail_smtp: "".to_string(),
mail_user: "".to_string(),
mail_pass: "".to_string(),
ssh_root: "/skynet_old/home".to_string(),
ssh_root: "skynet_old".to_string(),
};
if let Ok(x) = env::var("LDAP_HOST") {

View file

@ -455,8 +455,7 @@ pub mod ssh {
let config = &req.state().config;
// check if <root>/<user>/.ssh/authorized_keys exists
let root = &config.ssh_root;
let path = format!("{}/{}/.ssh/authorized_keys", root, user);
let path = format!("{}/{}/{}/.ssh/authorized_keys", &config.home, &config.ssh_root, user);
let mut keys = vec![];
if fs::read_to_string(&path).is_ok() {
if let Ok(x) = AuthorizedKeys::read_file(path) {
@ -545,8 +544,7 @@ pub mod ssh {
// check if <root>/<user>/.ssh/authorized_keys exists
//let root = "/skynet_old";
let root = ".";
let path = format!("{}/{}/.ssh/authorized_keys", root, user);
let path = format!("{}/{}/{}/.ssh/authorized_keys", &config.home, &config.ssh_root, user);
let sig = match SshSig::from_pem(auth_signed) {
Ok(x) => x,