WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: openssh extension start script mixup  (Read 2529 times)

Offline aw

  • Newbie
  • *
  • Posts: 45
openssh extension start script mixup
« on: September 16, 2015, 10:21:11 AM »
Hi,

I noticed a small error in the openssh.ini file of the x86/openssh extension - http://repo.tinycorelinux.net/6.x/x86/tcz/src/openssh/openssh.ini

The following lines:

Quote
[ -f /usr/local/etc/ssh/ssh_config ] || cp /usr/local/etc/ssh/sshd_config.example /usr/local/etc/ssh/sshd_config
[ -f /usr/local/etc/ssh/sshd_config ] || cp /usr/local/etc/ssh/ssh_config.example /usr/local/etc/ssh/ssh_config

.. should look like

Quote
[ -f /usr/local/etc/ssh/sshd_config ] || cp /usr/local/etc/ssh/sshd_config.example /usr/local/etc/ssh/sshd_config
[ -f /usr/local/etc/ssh/ssh_config ] || cp /usr/local/etc/ssh/ssh_config.example /usr/local/etc/ssh/ssh_config
github.com/aw

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7183
    • My Community Forum
Re: openssh extension start script mixup
« Reply #1 on: September 16, 2015, 10:24:09 AM »
Would be better to publish a diff file instead of asking readers to compare old and new script to find what is changed

:(
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline hiro

  • Hero Member
  • *****
  • Posts: 1229
Re: openssh extension start script mixup
« Reply #2 on: September 16, 2015, 10:47:02 AM »
both lines changed, diff wouldn't have added any easier to see information.

Offline hiro

  • Hero Member
  • *****
  • Posts: 1229
Re: openssh extension start script mixup
« Reply #3 on: September 16, 2015, 10:49:12 AM »
it's not an .ini file though, but /usr/local/etc/init.d/openssh

^ i take that back, i didn't see those source files before.
« Last Edit: September 16, 2015, 10:53:17 AM by hiro »

Offline aw

  • Newbie
  • *
  • Posts: 45
Re: openssh extension start script mixup
« Reply #4 on: September 16, 2015, 10:50:36 AM »
Sure!

Code: [Select]
--- openssh.ini.old 2015-09-16 14:46:22.000000000 +0000
+++ openssh.ini 2015-09-16 14:46:33.000000000 +0000
@@ -4,8 +4,8 @@
 
 start(){
    [ -f /usr/local/etc/ssh ] || mkdir -p /usr/local/etc/ssh
-   [ -f /usr/local/etc/ssh/ssh_config ] || cp /usr/local/etc/ssh/sshd_config.example /usr/local/etc/ssh/sshd_config
-   [ -f /usr/local/etc/ssh/sshd_config ] || cp /usr/local/etc/ssh/ssh_config.example /usr/local/etc/ssh/ssh_config
+   [ -f /usr/local/etc/ssh/sshd_config ] || cp /usr/local/etc/ssh/sshd_config.example /usr/local/etc/ssh/sshd_config
+   [ -f /usr/local/etc/ssh/ssh_config ] || cp /usr/local/etc/ssh/ssh_config.example /usr/local/etc/ssh/ssh_config
    [ -f /usr/local/etc/ssh/ssh_host_rsa_key ] || ssh-keygen -t rsa -N "" -f /usr/local/etc/ssh/ssh_host_rsa_key
    [ -f /usr/local/etc/ssh/ssh_host_dsa_key ] || ssh-keygen -t dsa -N "" -f /usr/local/etc/ssh/ssh_host_dsa_key
    [ -f /usr/local/etc/ssh/ssh_host_ecdsa_key ] || ssh-keygen -t ecdsa -N "" -f /usr/local/etc/ssh/ssh_host_ecdsa_key

Apply with
Code: [Select]
patch < openssh.patch
github.com/aw

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7183
    • My Community Forum
Re: openssh extension start script mixup
« Reply #5 on: September 16, 2015, 11:05:37 AM »
Well, I mean pointing to the difference and explaining the change not the diff command itself, not to push readers to find it himself. It is not the way to convince people about changes.
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11634
Re: openssh extension start script mixup
« Reply #6 on: September 16, 2015, 11:18:25 AM »
Hi bmarkus
Quote
[ -f /usr/local/etc/ssh/ssh_config ] || cp /usr/local/etc/ssh/sshd_config.example /usr/local/etc/ssh/sshd_config
[ -f /usr/local/etc/ssh/sshd_config ] || cp /usr/local/etc/ssh/ssh_config.example /usr/local/etc/ssh/ssh_config
It's testing for the wrong file to determine whether the copy operation should take place. The names in the test are
reversed.

Offline hiro

  • Hero Member
  • *****
  • Posts: 1229
Re: openssh extension start script mixup
« Reply #7 on: September 16, 2015, 11:19:48 AM »
you said "diff file"
anyways, the change fixes that sshd config gets overwritten by ssh config if ssh config doesn't exist but sshd does, vice-versa.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11634
Re: openssh extension start script mixup
« Reply #8 on: September 16, 2015, 11:23:56 AM »
Hi hiro
Quote
you said "diff file"
Regardless, two short sentences as I posted would have gone a long way to make it clear why the OP felt this change
was necessary.

Offline aw

  • Newbie
  • *
  • Posts: 45
Re: openssh extension start script mixup
« Reply #9 on: September 16, 2015, 11:30:35 AM »
Thanks, noted for future reference.
github.com/aw

Offline hiro

  • Hero Member
  • *****
  • Posts: 1229
Re: openssh extension start script mixup
« Reply #10 on: September 16, 2015, 11:56:53 AM »
anyways, good catch, aw.