Modify

Opened 2 years ago

Last modified 2 years ago

#20751 new defect

Dropbear crashes if banner file is set, but file does not exist.

Reported by: 3ndymion Owned by: developers
Priority: normal Milestone: Designated Driver (Trunk)
Component: packages Version: Trunk
Keywords: dropbear ssh Cc:

Description

If you set a path for a banner file in /etc/config/dropbear, & the banner file does not exist, dropbear will not allow you to login anymore. Any login attempt to the port is refused. I do not know if it completely crashes or what's going on because at that point, I'm completely locked out of the router & must go through the router's recovery failsafe mode to remove the banner option in the config file. Once it's removed, dropbear works & allows you to login again.

Dropbear should not crash if the set banner file does not exist. Instead, throw an error warning in the log or system log file, ignore the missing banner file & continue with login. I remember having this problem over a year ago as well, so I think the problem has always existed.

Attachments (0)

Change History (3)

comment:1 Changed 2 years ago by bittorf@…

dropbear itself has nothing to do with the banner file.
in /etc/profile (which is executed during login) there is this line:

#!/bin/sh
[ -f /etc/banner ] && cat /etc/banner

so if you delete this file, nothing happens. your
problem is another one. if i remove the /etc/banner file
on a router, i can login without any problems.

comment:2 Changed 2 years ago by anonymous

Then whats the point of "BannerFile" option in dropbear config file?

comment:3 Changed 2 years ago by anonymous

It doesn't crash. If BannerFile is set and it can't be opened, is too large or there is an error reading it then DropBear exits with an appropriate error message. The code is in svr-runopts.c :

if (svr_opts.bannerfile) {
                struct stat buf;
                if (stat(svr_opts.bannerfile, &buf) != 0) {
                        dropbear_exit("Error opening banner file '%s'",
                                        svr_opts.bannerfile);
                }
                
                if (buf.st_size > MAX_BANNER_SIZE) {
                        dropbear_exit("Banner file too large, max is %d bytes",
                                        MAX_BANNER_SIZE);
                }

                svr_opts.banner = buf_new(buf.st_size);
                if (buf_readfile(svr_opts.banner, svr_opts.bannerfile)!=DROPBEAR_SUCCESS) {
                        dropbear_exit("Error reading banner file '%s'",
                                        svr_opts.bannerfile);
                }
                buf_setpos(svr_opts.banner, 0);
        }

Add Comment

Modify Ticket

Action
as new .
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.