uClinux에 Dropbear를 올렸는데 외부에서 타켓에 접속하면 connection refuesed

bakdorazi의 이미지

<환경> 1. 호스트 : 페도라 11 2. 타겟 : uClinux-2.4.x 3. 컴파일러 : arm-elf-gcc 4. dropbear-0.52 5. zlib-1.2.3 6. Make 파일 아래와 같음

srcdir=.
 
prefix=/home/proj/tango/linux/dropbear
exec_prefix=${prefix}
bindir=${exec_prefix}/bin
sbindir=${exec_prefix}/sbin
 
CC=arm-elf-gcc -Wl, -elf2flt
AR=arm-elf-ar
RANLIB=arm-elf-ranlib
STRIP=arm-elf-strip
INSTALL=install
CPPFLAGS= -I./uclibc-include -I./zlib-h
CFLAGS=-I. -I$(srcdir) -I$(srcdir)/libtomcrypt/src/iheaders/ $(CPPFLAGS) -Os -W -Wall
#CFLAGS+= -D__PIC__ -fpic -msingle-pic-base
LIBS=$(LTC) $(LTM) -lutil -lz -lcrypt
LDFLAGS=-L/home/proj/tango/linux/zlib/lib -L./uclibc-lib

7. config.h 에서 아래 모두 삭제해 주고

#define HAVE_DAMON 1
#define HAVE_UTMPX_H 1
#define HAVE_UTMP_H 1

8. fork() --> vfork()로 바꿔주고 나서

9. ./configure
10. make
11. make install

하면 아래의 바이너리 파일들이 만들어집니다.

dbclient
dropbearkey
dropbearconvert
dropbear

아래 화면은 위의 바이너리들을 타겟에 올린후 key를 생성하고 dbclient와 dropbear를 실행했을때 화면입니다.

/var> ls -al
drwxr-xr-x 1 0 0 0 Jan 1 00:00 .
drwxr-xr-x 1 515 0 192 Jan 1 00:00 ..
-rwxrwxrwx 1 0 0 212456 Jan 1 00:07 dbclient
-rwxrwxrwx 1 0 0 237824 Jan 1 00:00 dropbear
-rwxrwxrwx 1 0 0 458 Jan 1 00:02 dropbear_dss_host_key
-rwxrwxrwx 1 0 0 426 Jan 1 00:01 dropbear_rsa_host_key
-rwxrwxrwx 1 0 0 92480 Jan 1 00:01 dropbearconvert
-rwxrwxrwx 1 0 0 95416 Jan 1 00:00 dropbearkey
drwxrwxrwx 1 0 0 0 Jan 1 00:00 etc
drwxrwxrwx 1 0 0 0 Jan 1 00:00 ifstat
drwxrwxrwx 1 0 0 0 Jan 1 00:00 lock
drwxrwxrwx 1 0 0 0 Jan 1 00:00 log
drwxrwxrwx 1 0 0 0 Jan 1 00:00 run
drwxrwxrwx 1 0 0 0 Jan 1 00:00 tmp
 
/var> ./dbclient &
./dbclient: exited: Unknown own user
 
/var> ./dropbear
 
/var> ps -ef
PID TTY Uid Size State Command
1 0 0 S init 
2 0 0 S [keventd]
3 0 0 S [ksoftirqd_CPU0]
4 0 0 S [kswapd]
5 0 0 S [bdflush]
6 0 0 S [kupdated]
49 0 0 S [sdfe-0]
51 0 0 S [sfpcheck]
58 0 0 S [efmoam]
66 0 0 S /bin/boa 
67 0 0 S /bin/snmpd 
68 0 0 S /bin/logd 
69 0 0 S /bin/inetd 
70 0 0 S /bin/nexoamd 
71 0 0 S /bin/ifgd 
208 ttyS0 0 0 S /bin/ncli 
209 0 0 S /bin/telnetd 
210 ttyp0 0 0 S /bin/sh 
214 ttyp0 0 0 R ps -ef 

<문제점> 1. dbclient를 실행시키면 사용방법이 나와야 합니다. 그런데 위에서는 알 수 없는 에러가 나옵니다. 에러가 무슨 말인지 모르겠습니다.

2. dropbearkey, dropbearconvert등은 실행시켜보니 정상동작합니다. 특히 dropbearkey를 이용해서
dropbear_rsa_host_key, dropbear_dss_host_key를 만들어 내었습니다.

3. dropbear를 실행시키면 아무 에러없이 실행되나 ps -ef로 실행프로시져들을 보면 나와있지 않습니다.
그리고 외부에서 SSH를 이용하여 위의 보드에 접속하면 아래와 같은 에러가 나옵니다.

 
[root@localhost dropbear-0.52]# ssh 172.16.0.33
ssh: connect to host 172.16.0.33 port 22: Connection refused
[root@localhost dropbear-0.52]# ssh 172.16.0.33
ssh: connect to host 172.16.0.33 port 22: Connection refused
[root@localhost dropbear-0.52]# ssh 172.16.0.33
ssh: connect to host 172.16.0.33 port 22: Connection refused
[root@localhost dropbear-0.52]# ssh 172.16.0.33
ssh: connect to host 172.16.0.33 port 22: Connection refused
[root@localhost dropbear-0.52]# ssh 172.16.0.33
ssh: connect to host 172.16.0.33 port 22: Connection refused
[root@localhost dropbear-0.52]# ssh 172.16.0.33
ssh: connect to host 172.16.0.33 port 22: Connection refused
[root@localhost dropbear-0.52]# ssh 172.16.0.33
ssh: connect to host 172.16.0.33 port 22: Connection refused

파일이 잘 못 만들어진건지...

일단 dbclient 에서 에러가 나는 걸로 보아 뭔가 잘 못 된 듯 한데

에러를 보고는 어떻게 해야 할 지 모르겠습니다.

dropbear를 사용해 보신 분들의 도움을 요청합니다.

bakdorazi의 이미지

<위의 문제 해결> 1. 타겟에 다운받은 파일들의 소유권을 root로 변경

chmod 777 *
chown 515 *

2. /etc에 dropbear 디렉토리를 만들고 거기에 key를 생성합니다.

mkdir /etc/dropbear
cp dropbearkey /etc/dropbear
cd /etc/dropbear
./dropbearkey -t rsa -f dropbear_rsa_host_key
cd /var
./dropbear &

이렇게 하면 dropbear가 실행되는데요...

HOST에서 접속하려고 하면 ROOT 암호를 쳐주는데도 denied 되네요..
이건 또 무슨 일인지..ㅠㅠ

[root@localhost dropbear-0.52]# ssh 172.16.0.33
root@172.16.0.33's password: 
Permission denied, please try again.
root@172.16.0.33's password: 
Permission denied, please try again.
root@172.16.0.33's password: 
Permission denied (publickey,password).

P.S dropbear가 root가 패스워드 없이 접속하는 것을 막았다고 하더라구요.
그렇지만 지금은 root 패스워드가 있는 상황이거든요..
uClinux라서 패스워드 바꾸려고 해도 passwd 하면 실행할 수 있는 포맷이 아니라고 나오고
vi 자체가 없네요...
패스워드 문제는 아닌 것 같은데
다른 설정해줘야 하거나 하는 게 있나요?

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.