fix: set a root for the ssh verification.
This commit is contained in:
parent
82d7ca48bb
commit
8bec5e87b5
3 changed files with 9 additions and 2 deletions
|
@ -56,6 +56,7 @@
|
||||||
DATABASE = "database.db";
|
DATABASE = "database.db";
|
||||||
CSV = "wolves.csv";
|
CSV = "wolves.csv";
|
||||||
HOST_PORT = cfg.host_port;
|
HOST_PORT = cfg.host_port;
|
||||||
|
SSH_ROOT = "/skynet_old/home";
|
||||||
|
|
||||||
# Email stuff
|
# Email stuff
|
||||||
EMAIL_SMTP = cfg.mail.host;
|
EMAIL_SMTP = cfg.mail.host;
|
||||||
|
|
|
@ -188,6 +188,7 @@ pub struct Config {
|
||||||
pub mail_smtp: String,
|
pub mail_smtp: String,
|
||||||
pub mail_user: String,
|
pub mail_user: String,
|
||||||
pub mail_pass: String,
|
pub mail_pass: String,
|
||||||
|
pub ssh_root: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_config() -> Config {
|
pub fn get_config() -> Config {
|
||||||
|
@ -205,6 +206,7 @@ pub fn get_config() -> Config {
|
||||||
mail_smtp: "".to_string(),
|
mail_smtp: "".to_string(),
|
||||||
mail_user: "".to_string(),
|
mail_user: "".to_string(),
|
||||||
mail_pass: "".to_string(),
|
mail_pass: "".to_string(),
|
||||||
|
ssh_root: "/skynet_old/home".to_string(),
|
||||||
};
|
};
|
||||||
|
|
||||||
if let Ok(x) = env::var("LDAP_HOST") {
|
if let Ok(x) = env::var("LDAP_HOST") {
|
||||||
|
@ -237,6 +239,9 @@ pub fn get_config() -> Config {
|
||||||
if let Ok(x) = env::var("EMAIL_PASS") {
|
if let Ok(x) = env::var("EMAIL_PASS") {
|
||||||
config.mail_pass = x.trim().to_string();
|
config.mail_pass = x.trim().to_string();
|
||||||
}
|
}
|
||||||
|
if let Ok(x) = env::var("SSH_ROOT") {
|
||||||
|
config.ssh_root = x.trim().to_string();
|
||||||
|
}
|
||||||
|
|
||||||
config
|
config
|
||||||
}
|
}
|
||||||
|
|
|
@ -458,9 +458,10 @@ pub mod ssh {
|
||||||
return Ok(json!({"result": "error", "error": "Skynet email not permitted."}).into());
|
return Ok(json!({"result": "error", "error": "Skynet email not permitted."}).into());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let config = &req.state().config;
|
||||||
|
|
||||||
// check if <root>/<user>/.ssh/authorized_keys exists
|
// check if <root>/<user>/.ssh/authorized_keys exists
|
||||||
//let root = "/skynet_old";
|
let root = &config.ssh_root;
|
||||||
let root = ".";
|
|
||||||
let path = format!("{}/{}/.ssh/authorized_keys", root, user);
|
let path = format!("{}/{}/.ssh/authorized_keys", root, user);
|
||||||
let mut keys = vec![];
|
let mut keys = vec![];
|
||||||
if fs::read_to_string(&path).is_ok() {
|
if fs::read_to_string(&path).is_ok() {
|
||||||
|
|
Loading…
Reference in a new issue