mirror of
https://github.com/fire1ce/UDM-Persistent-SSH-Keys.git
synced 2023-10-10 13:36:54 +02:00
20230222.1257
This commit is contained in:
parent
14f32bd044
commit
05d9413601
@ -1,5 +1,9 @@
|
|||||||
# UDM Persistence SSH Keys
|
# UDM Persistence SSH Keys
|
||||||
|
|
||||||
|
## Changelog
|
||||||
|
|
||||||
|
- 2023-02-22 - Fixed support for UDM Pro Firmware 1.x and 2.x and 3.x - Must reinstall the script after upgrade from 1.x to 2.x
|
||||||
|
|
||||||
## Persistence on Reboot
|
## Persistence on Reboot
|
||||||
|
|
||||||
This script need to run every time the system is rebooted since the **/root/.ssh/authorized_keys** overwrites every boot.
|
This script need to run every time the system is rebooted since the **/root/.ssh/authorized_keys** overwrites every boot.
|
||||||
@ -10,7 +14,6 @@ This can be accomplished with a boot script. Flow this guide: [UDM / UDMPro Boot
|
|||||||
- Tested on [UDM PRO][amz-udm-pro-url]
|
- Tested on [UDM PRO][amz-udm-pro-url]
|
||||||
- UDM Pro doesn't support **ed25519** SSH Keys
|
- UDM Pro doesn't support **ed25519** SSH Keys
|
||||||
|
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
The script was tested on UDM PRO
|
The script was tested on UDM PRO
|
||||||
|
17
install.sh
17
install.sh
@ -3,23 +3,22 @@
|
|||||||
# Get DataDir location
|
# Get DataDir location
|
||||||
DATA_DIR="/mnt/data"
|
DATA_DIR="/mnt/data"
|
||||||
case "$(ubnt-device-info firmware || true)" in
|
case "$(ubnt-device-info firmware || true)" in
|
||||||
1*)
|
1*)
|
||||||
DATA_DIR="/mnt/data"
|
DATA_DIR="/mnt/data"
|
||||||
;;
|
;;
|
||||||
2*)
|
2*)
|
||||||
DATA_DIR="/data"
|
DATA_DIR="/data"
|
||||||
;;
|
;;
|
||||||
3*)
|
3*)
|
||||||
DATA_DIR="/data"
|
DATA_DIR="/data"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "ERROR: No persistent storage found." 1>&2
|
echo "ERROR: No persistent storage found." 1>&2
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
user_authorized_keys_file="$DATA_DIR/ssh/authorized_keys"
|
user_authorized_keys_file="$DATA_DIR/ssh/authorized_keys"
|
||||||
udm_authorized_keys_file="/root/.ssh/authorized_keys"
|
|
||||||
|
|
||||||
curl -sO https://raw.githubusercontent.com/fire1ce/UDM-Persistent-SSH-Keys/main/99-ssh-keys.sh
|
curl -sO https://raw.githubusercontent.com/fire1ce/UDM-Persistent-SSH-Keys/main/99-ssh-keys.sh
|
||||||
mv 99-ssh-keys.sh $DATA_DIR/on_boot.d/99-ssh-keys.sh
|
mv 99-ssh-keys.sh $DATA_DIR/on_boot.d/99-ssh-keys.sh
|
||||||
@ -30,10 +29,12 @@ if [ ! -f "$user_authorized_keys_file" ]; then
|
|||||||
echo "Creating $user_authorized_keys_file"
|
echo "Creating $user_authorized_keys_file"
|
||||||
mkdir -p $DATA_DIR/ssh
|
mkdir -p $DATA_DIR/ssh
|
||||||
mkdir -p /root/.ssh/
|
mkdir -p /root/.ssh/
|
||||||
touch "$user_authorized_keys_file $udm_authorized_keys_file"
|
touch "$user_authorized_keys_file"
|
||||||
chmod 0644 "$user_authorized_keys_file $udm_authorized_keys_file"
|
chmod 0644 "$user_authorized_keys_file"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "==> Add you public keys to $user_authorized_keys_file"
|
echo "==> Add you public keys to $user_authorized_keys_file"
|
||||||
|
echo "==> run $DATA_DIR/on_boot.d/99-ssh-keys.sh to import your keys to the UDM and test them."
|
||||||
|
echo "==> Reboot your UDM to apply the changes after you have added your keys."
|
||||||
echo "==> Done."
|
echo "==> Done."
|
||||||
exit 0
|
exit 0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user