返回信息流转信站: BYR!news.happynet.org!news.cn-bbs.org!news.newsmth.net!NEWSMTH
使用 openssh 开启 ssh-bbsd 服务. -- hace
主要想法是修改 openssh 的部分代码, 把当中的 execv 换掉,
在换掉的函数里调用 main.c 中的 start_client() :
/* session.c */
extern void init_tty();
extern void start_client(int);
extern char fromhost[60];
extern int bad_host(char *s);
int execve_()
{
memset(fromhost, 0, 20);
strcpy(fromhost, get_remote_ipaddr());
report(fromhost);
if (bad_host(fromhost))
exit(1);
init_tty();
start_client(1);
exit(1);
}
在 firebird 下编译:
首先在 bbs 的代码中把除 admintool.o bbsd.o 外的其它 .o 链成 libtbbs.a
然后进入 openssh-4.3p2 :
# cd openssh-4.3p2
# patch -p1 < openssh-bbs.diff
# ./configure --without-zlib-version-check --without-xauth \
--without-shadow --disable-utmp --disable-utmpx --disable-wtmp \
--disable-pututline --disable-libutil --disable-pututxline \
--disable-wtmpx --without-pam --prefix=/home/bbs/ssh \
--localstatedir=/home/bbs/ssh --without-lastlog
--with-libs='-L/usr/src/goon-bbs/src -ltbbs \
-L/usr/src/goon-bbs/lib -lBBS -lncurses -export'
# make && make install
# mv /home/bbs/ssh/sbin/sshd /home/bbs/ssh/sbin/ssh-bbsd
# chown bbs.bbs -R /home/bbs/ssh
修改 /home/bbs/ssh/etc/sshd_config 禁掉 sftp
# vim /home/bbs/ssh/etc/sshd_config
# /home/bbs/ssh/sbin/ssh-bbsd
测试, 用户名 bbs 密码为任意:
可以修改 /home/bbs/ssh/etc/sshd_config 加上
PermitEmptyPasswords yes
使密码为空.
# ssh bbs@127.0.0.1
注意, 在 firebird 2k 下的函数 start_client() 是没有参数的.
这只是很粗糙的版本, 可能会存在某些 bug , 欢迎大家指正, :)
openssh-4.3p2: http://www.openssh.org/portable.html
openssh-bbs.diff : http://bbh.net.cn/openssh-bbs.diff
goon-bbs: http://bbh.net.cn/goon-bbs.cvs.tar.gz
这是一条镜像帖。来源:北邮人论坛 / bbs-man-dev / #2614同步于 1 周前
BBSMan_Dev机器人发帖
使用 openssh 开启 ssh-bbsd 服务
hace.
1 周前镜像同步0 回复
订阅后,新回复会通过你的通知中心匿名送达。
0 条回复
暂无回复 · 你可以订阅本帖等待新回复。