@@ -371,62 +371,24 @@ pull_required_images() {
371371 fi
372372}
373373
374- # Function to setup SSH timeout configuration using custom-init
375- setup_ssh_timeout_config () {
376- echo " 📝 Setting up SSH timeout configuration..."
377- mkdir -p " openssh-server/config/custom-cont-init.d"
378- if [ ! -f " openssh-server/config/custom-cont-init.d/99-sshd-timeout-config" ]; then
379- cat > " openssh-server/config/custom-cont-init.d/99-sshd-timeout-config" << 'EOF '
380- #!/usr/bin/with-contenv bash
381-
382- # Configure SSH timeout settings for nexent terminal tool
383- echo "Configuring SSH timeout settings (60 minutes)..."
384-
385- # Fix SSH host key permissions (must be 600 for private keys)
386- echo "Fixing SSH host key permissions..."
387- find /config -name "*_key" -type f -exec chmod 600 {} \; 2>/dev/null || true
388- find /config/ssh_host_keys -name "*_key" -type f -exec chmod 600 {} \; 2>/dev/null || true
389- echo "SSH host key permissions fixed"
390-
391- # Append timeout configuration to sshd_config
392- cat >> /config/sshd/sshd_config << 'SSHD_EOF'
393-
394- # Nexent Terminal Tool - Session timeout configuration (60 minutes = 3600 seconds)
395- ClientAliveInterval 300
396- ClientAliveCountMax 12
397- SSHD_EOF
398-
399- echo "SSH timeout configuration applied successfully"
400- EOF
401- chmod +x " openssh-server/config/custom-cont-init.d/99-sshd-timeout-config"
402- echo " ✅ SSH timeout configuration script created"
403- else
404- echo " 🔄 SSH timeout configuration script already exists, updating..."
405- # Always recreate the script to ensure it has the latest configuration
406- cat > " openssh-server/config/custom-cont-init.d/99-sshd-timeout-config" << 'EOF '
407- #!/usr/bin/with-contenv bash
408-
409- # Configure SSH timeout settings for nexent terminal tool
410- echo "Configuring SSH timeout settings (60 minutes)..."
411-
412- # Fix SSH host key permissions (must be 600 for private keys)
413- echo "Fixing SSH host key permissions..."
414- find /config -name "*_key" -type f -exec chmod 600 {} \; 2>/dev/null || true
415- find /config/ssh_host_keys -name "*_key" -type f -exec chmod 600 {} \; 2>/dev/null || true
416- echo "SSH host key permissions fixed"
417-
418- # Append timeout configuration to sshd_config
419- cat >> /config/sshd/sshd_config << 'SSHD_EOF'
420-
421- # Nexent Terminal Tool - Session timeout configuration (60 minutes = 3600 seconds)
422- ClientAliveInterval 300
423- ClientAliveCountMax 12
424- SSHD_EOF
425-
426- echo "SSH timeout configuration applied successfully"
427- EOF
428- chmod +x " openssh-server/config/custom-cont-init.d/99-sshd-timeout-config"
429- echo " ✅ SSH timeout configuration script updated"
374+
375+
376+ # Function to setup package installation script
377+ setup_package_install_script () {
378+ if [ " $ENABLE_TERMINAL_TOOL " = " true" ]; then
379+ echo " 📝 Setting up package installation script..."
380+ mkdir -p " openssh-server/config/custom-cont-init.d"
381+
382+ # Copy the fixed installation script
383+ if [ -f " openssh-install-script.sh" ]; then
384+ cp " openssh-install-script.sh" " openssh-server/config/custom-cont-init.d/openssh-start-script"
385+ chmod +x " openssh-server/config/custom-cont-init.d/openssh-start-script"
386+ echo " ✅ Package installation script created/updated"
387+ else
388+ echo " ❌ ERROR openssh-install-script.sh not found"
389+ ERROR_OCCURRED=1
390+ return 1
391+ fi
430392 fi
431393}
432394
@@ -559,8 +521,8 @@ generate_ssh_keys() {
559521 cp " openssh-server/ssh-keys/openssh_server_key.pub" " openssh-server/config/authorized_keys"
560522 chmod 644 " openssh-server/config/authorized_keys"
561523
562- # Setup SSH timeout configuration
563- setup_ssh_timeout_config
524+ # Setup package installation script
525+ setup_package_install_script
564526
565527 # Set SSH key path in environment
566528 SSH_PRIVATE_KEY_PATH=" $( pwd) /openssh-server/ssh-keys/openssh_server_key"
@@ -630,8 +592,8 @@ generate_ssh_keys() {
630592 cp " openssh-server/ssh-keys/openssh_server_key.pub" " openssh-server/config/authorized_keys"
631593 chmod 644 " openssh-server/config/authorized_keys"
632594
633- # Setup SSH timeout configuration
634- setup_ssh_timeout_config
595+ # Setup package installation script
596+ setup_package_install_script
635597
636598 # Set SSH key path in environment
637599 SSH_PRIVATE_KEY_PATH=" $( pwd) /openssh-server/ssh-keys/openssh_server_key"
0 commit comments