fix: now deals with the correct path for the old ssh accounts
This commit is contained in:
parent
32d693fa8c
commit
ce471ad39a
6 changed files with 23 additions and 9 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -7,5 +7,6 @@
|
||||||
result
|
result
|
||||||
/result
|
/result
|
||||||
|
|
||||||
|
tmp/
|
||||||
tmp.*
|
tmp.*
|
||||||
*.csv
|
*.csv
|
|
@ -56,7 +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";
|
SSH_ROOT = "skynet_old";
|
||||||
|
|
||||||
# Email stuff
|
# Email stuff
|
||||||
EMAIL_SMTP = cfg.mail.host;
|
EMAIL_SMTP = cfg.mail.host;
|
||||||
|
|
18
scripts/grab_keys.sh
Normal file
18
scripts/grab_keys.sh
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
from="./skynet_old/home"
|
||||||
|
to="./home_tmp"
|
||||||
|
|
||||||
|
find $from -maxdepth 3 -name "authorized_keys" -type f > tmp2
|
||||||
|
while IFS= read -r path_old
|
||||||
|
do
|
||||||
|
echo "From: $path_old"
|
||||||
|
path_new="${path_old/"$from"/"$to"}"
|
||||||
|
echo "To: $path_new"
|
||||||
|
path_dir="${path_new/authorized_keys/}"
|
||||||
|
mkdir -p "$path_dir"
|
||||||
|
cp "$path_old" "$path_new"
|
||||||
|
done < tmp2
|
||||||
|
rm tmp2
|
||||||
|
|
||||||
|
chmod -R skynet_ldap_backend $to
|
|
@ -1,3 +0,0 @@
|
||||||
# --- BEGIN PVE ---
|
|
||||||
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBHbsOjxIcLasz+CHA8gUg1pvc8dPHwMKdWoIwNvPxLp Desktop_WSL
|
|
||||||
# --- END PVE ---
|
|
|
@ -206,7 +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(),
|
ssh_root: "skynet_old".to_string(),
|
||||||
};
|
};
|
||||||
|
|
||||||
if let Ok(x) = env::var("LDAP_HOST") {
|
if let Ok(x) = env::var("LDAP_HOST") {
|
||||||
|
|
|
@ -455,8 +455,7 @@ pub mod ssh {
|
||||||
let config = &req.state().config;
|
let config = &req.state().config;
|
||||||
|
|
||||||
// check if <root>/<user>/.ssh/authorized_keys exists
|
// check if <root>/<user>/.ssh/authorized_keys exists
|
||||||
let root = &config.ssh_root;
|
let path = format!("{}/{}/{}/.ssh/authorized_keys", &config.home, &config.ssh_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() {
|
||||||
if let Ok(x) = AuthorizedKeys::read_file(path) {
|
if let Ok(x) = AuthorizedKeys::read_file(path) {
|
||||||
|
@ -545,8 +544,7 @@ pub mod ssh {
|
||||||
|
|
||||||
// check if <root>/<user>/.ssh/authorized_keys exists
|
// check if <root>/<user>/.ssh/authorized_keys exists
|
||||||
//let root = "/skynet_old";
|
//let root = "/skynet_old";
|
||||||
let root = ".";
|
let path = format!("{}/{}/{}/.ssh/authorized_keys", &config.home, &config.ssh_root, user);
|
||||||
let path = format!("{}/{}/.ssh/authorized_keys", root, user);
|
|
||||||
|
|
||||||
let sig = match SshSig::from_pem(auth_signed) {
|
let sig = match SshSig::from_pem(auth_signed) {
|
||||||
Ok(x) => x,
|
Ok(x) => x,
|
||||||
|
|
Loading…
Reference in a new issue