Spaces:
Paused
Paused
Update start.sh
Browse files
start.sh
CHANGED
|
@@ -13,17 +13,25 @@ print_host_details() {
|
|
| 13 |
}
|
| 14 |
# Function to generate SSH host keys if missing
|
| 15 |
generate_ssh_keys() {
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
}
|
| 28 |
# Function to start SSH service if not running
|
| 29 |
start_ssh_service() {
|
|
|
|
| 13 |
}
|
| 14 |
# Function to generate SSH host keys if missing
|
| 15 |
generate_ssh_keys() {
|
| 16 |
+
|
| 17 |
+
rm -f /etc/ssh/ssh_host_rsa_*
|
| 18 |
+
rm -f /etc/ssh/ssh_host_ecdsa_*
|
| 19 |
+
rm -f /etc/ssh/ssh_host_ed25519_*
|
| 20 |
+
rm -f /etc/ssh/ssh_known_*
|
| 21 |
+
|
| 22 |
+
echo "* Generating SSH host keys *"
|
| 23 |
+
yes y | ssh-keygen -t rsa -b 2048 -f /etc/ssh/ssh_host_rsa_key -N "" || { echo "Failed to generate RSA key"; exit 1; }
|
| 24 |
+
yes y | ssh-keygen -t ecdsa -b 256 -f /etc/ssh/ssh_host_ecdsa_key -N "" || { echo "Failed to generate ECDSA key"; exit 1; }
|
| 25 |
+
yes y | ssh-keygen -t ed25519 -f /etc/ssh/ssh_host_ed25519_key -N "" || { echo "Failed to generate ED25519 key"; exit 1; }
|
| 26 |
+
ssh-keyscan -p 2222 127.0.0.1 >> /etc/ssh/known_hosts
|
| 27 |
+
cp /etc/ssh/known_hosts /etc/ssh/ssh_known_host
|
| 28 |
+
#ssh-keygen -t rsa -b 2048 -f /etc/ssh/ssh_host_rsa_key -N ""
|
| 29 |
+
#ssh-keygen -t ecdsa -b 256 -f /etc/ssh/ssh_host_ecdsa_key -N ""
|
| 30 |
+
#ssh-keygen -t ed25519 -f /etc/ssh/ssh_host_ed25519_key -N ""
|
| 31 |
+
echo " Public Key $(cat /etc/ssh/ssh_host_rsa_key.pub)"
|
| 32 |
+
echo " Private Key $(cat /etc/ssh/ssh_host_rsa_key)"
|
| 33 |
+
echo " Host Files $(cat /etc/ssh/ssh_known_host)"
|
| 34 |
+
|
| 35 |
}
|
| 36 |
# Function to start SSH service if not running
|
| 37 |
start_ssh_service() {
|