Skip to content

Commit 5e5a37c

Browse files
committed
chore: updated deps and root passwords
1 parent e9d45c1 commit 5e5a37c

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

‎system/cuos/init.sh‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,12 @@ set_root_password() {
375375

376376
usermod -U root
377377

378+
# Add ssh keys:
379+
mkdir -p /root/.ssh
380+
chmod 700 /root/.ssh
381+
jq -r '.["os_root_authorized_keys"][]?' "/system.json" >/root/.ssh/authorized_keys
382+
chmod 600 /root/.ssh/authorized_keys
383+
378384
report_info "cuos:init:root_access" "Root access is enabled"
379385
}
380386

@@ -420,7 +426,11 @@ configure_ssh_server() {
420426

421427
if [[ "${ssh_enabled}" == "true" ]]; then
422428
report_info "cuos:init:ssh_server" "Start SSH server"
423-
systemctl start ssh
429+
systemctl enable ssh 2>/dev/null || true
430+
iptables -I INPUT -p tcp --dport 4222 -j ACCEPT 2>/dev/null || true
431+
else
432+
systemctl disable ssh 2>/dev/null || true
433+
iptables -D INPUT -p tcp --dport 4222 -j ACCEPT 2>/dev/null || true
424434
fi
425435
}
426436

0 commit comments

Comments
 (0)