oxidized icon indicating copy to clipboard operation
oxidized copied to clipboard

Cisco SF302-08P PromptUndetect (ciscosmb)

Open securactive-hlm opened this issue 10 years ago • 16 comments

Hi, first many thanks for this great project, it's very useful !

I have problem cith SF302-08P switches, I'm unable to match a prompt,

here's the debug output :

W, [2016-01-12T18:38:45.893138 #750] WARN -- : 192.168.100.50 raised Oxidized::PromptUndetect with msg "

sw-test-desk-1# not matching configured prompt (?-mix:^\r?([\w.@()-]+[#>]\s?)$)"

What is very strange is that in crash file there are some ^M character on empty lines before prompt:

^M ^M ^M

sw-test-desk-1#

(this file hasn't been modified, and only displayed by vi)

Before posting issue I've made some tries on prompt detection, and even with unsecure but very simple regex to match only last #, all fails.

Please note that on other switches coming from the same family (as far as I know) I'm able to detect prompt but config output has also some ^M at the top of file : (on SG300-10)

! show version ! ^MSW version 1.3.5.58 ( date 10-Oct-2013 time 17:15:41 ) ! Boot version 1.3.5.06 ( date 21-Jul-2013 time 15:12:10 ) ! HW version V02 show running-config ^Mconfig-file-header

Please also note that I've got the same prompt detection problem on others switches : SG500X

What can I do to help debugging this ? regards

securactive-hlm avatar Jan 12 '16 18:01 securactive-hlm

try input: debug: true

and then look at the telnet/ssh files in .config/oxidized/crash iirc.

Use some editor which shows control-characters. This might provide more data.

ytti avatar Jan 12 '16 18:01 ytti

Hi, sorry for delay, I'm on the field at the moment !

debug was already activated, see crash file output provided on previous post.

I've displayed logs with vi, which editor could you advise for this usage?

securactive-hlm avatar Jan 13 '16 11:01 securactive-hlm

Maybe try to attach the raw debug log instead of copying the content of the file. I currently got a range of Cisco 300 series switches that works perfectly fine:

mysql> SELECT distinct(hardware) FROM devices WHERE os='ciscosb' ORDER by hostname;
+-------------+
| hardware    |
+-------------+
| SF300-24    |
| SG300-28MP  |
| SG300-10    |
| SG300-28    |
| SF300-24P   |
| SF300-48    |
| SG300-10SFP |
| SF302-08    |
+-------------+
8 rows in set (0.01 sec)

SaaldjorMike avatar Jan 13 '16 11:01 SaaldjorMike

I don't mean main level debug (Which is just to say debugging syslog messages are shown)

I mean

input:
  debug: true

which means we're saving the whole telnet/ssh session. Contents of this file might be useful.

ytti avatar Jan 13 '16 12:01 ytti

Ok I'll be unable to provide output until Friday, but it's nice to hear that CiscoSMB works fine on your side ;)

securactive-hlm avatar Jan 13 '16 13:01 securactive-hlm

Hi,

I'm sorry, perhaps I've missed something, but enabling debug at input side hasn't produce any session debug file.

I've attached config oxidized.TXT general log file config.TXT and crash file crash-192.168.100.50-ssh.TXT

Could you help me going further in gathering debuging information ?

securactive-hlm avatar Jan 15 '16 10:01 securactive-hlm

The 'crash-192.168.100.50-ssh.TXT' is the file I was looking for, it's ill-named, as it's not really crash, it's full input log of the ssh session.

I can't figure out why it wouldn't accept that prompt. Is it possible for you to put one device with sanitised configuration online somewhere where it's reachable from Internet? Like fresh box with minimal config. So that I can debug against the box.

ytti avatar Jan 15 '16 11:01 ytti

Ok I'm trying to arrange a remote access from my home network, I'll keep you updated.

Can I have an email adress to give you connection details as soon as available ?

securactive-hlm avatar Jan 15 '16 14:01 securactive-hlm

[email protected] thanks a bunch!

ytti avatar Jan 15 '16 15:01 ytti

Hi, Have you guys already found a soulition for this issue?

BullfroG21 avatar Jan 24 '16 19:01 BullfroG21

sorry, i completely forgot this, I'll try your box tomorrow.

ytti avatar Jan 24 '16 19:01 ytti

This is fixed by c39e8ebb2

Alas we were lead astray by confusing error message, this had nothing to do with prompt.

ytti avatar Jan 25 '16 11:01 ytti

@ytti I just want to let you know that the Cisco SMB devices actually can do both. If you set up the device with the following enabled:

ip ssh password-auth

Then it uses the user/pass provided by ssh, but if you do not set this up, the device will prompt you for the credentials - even when using ssh.

SaaldjorMike avatar Jan 25 '16 11:01 SaaldjorMike

Oh, crap. Do some of them /NOT/ support 'ip ssh password-auth'? Do we want to support it?

If we do need that support, perhaps something like this:

cfg :ssh do
  if vars(:ciscosmb_cli_auth)
      username /^User Name:/
      password /^\r?Password:$/
  end
end

And then people who want to use it like this, would have to somehow provide that variable. For example:

source:
  cvs:
   vars_map:
      ciscosmb_cli_auth: 5

and 5th field should be not-empty.

ytti avatar Jan 25 '16 14:01 ytti

I've got a range of different firmware versions running at the moment, and looks like the oldest firmware I got that supports it is 1.2.9.44. This is the firmwares I've checked it on:

1.1.2.0:  no
1.2.5.70: no
1.2.7.76: no
1.2.9.44: yes
1.3.0.59: yes
1.3.0.62: yes
1.4.0.88: yes
1.4.1.3:  yes

SaaldjorMike avatar Jan 25 '16 14:01 SaaldjorMike

Well... crap.

So if we want to support 1.2.7 potentially 1.2.8 as well, we need to have some solution.

Does my proposed solution seems acceptable, or how should be community which box gets which treatment? Can you verify it works?

ytti avatar Jan 25 '16 14:01 ytti