trogalko / shellinabox

Automatically exported from code.google.com/p/shellinabox
Other
0 stars 0 forks source link

Does not build on MacOS X #47

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
logging/logging.c:183: error: only weak aliases are supported in this 
configuration

And indeed I see use of the __attribute__(("alias")) feature in logging.c

Unfortunately there is no comment explaining what this is for or why it's used. 
It appears to be a part of the lazy-loaded SSL support?

Can this be code be changed?

Original issue reported on code.google.com by mh.in.en...@gmail.com on 24 Jan 2010 at 4:25

GoogleCodeExporter commented 9 years ago
I got the same error on OSX 10.4.11 PPC with Xcode 2.5.

Meantime, I run shellinaboxd under Linux and from there I can ssh to my PPC 
box.  

To see if I could indeed build shellinaboxd successfully under OSX PPC, I first 
hacked the alias in logging.c to get past the error at line 183, but then make 
failed as it was unable to find the objcopy program.  This is a part of 
binutils and it is used within the shellinabox Makefile to create binary 
objects from 9 or so different resource files including beep.wav, .css, 
cgi_root.html, etc.  These files are also edited using sed to change default 
binary symbol names from "_binary etc." to things like rootStart and rootEnd 
referenced in shellinaboxd.c. About the last thing the Makefile does is to link 
all these objects together. 

I installed binutils and was able to hack the Makefile to get it to run objcopy 
and produce binaries for powerpc/Mach-O (Linux uses i386/ELF), but then the 
final link then fails because of ..

/usr/libexec/gcc/powerpc-apple-darwin8/4.0.1/ld: shellinabox/cgi_root.o 
undefined symbol 0 (NULL name) can't be a weak definition
/usr/libexec/gcc/powerpc-apple-darwin8/4.0.1/ld: shellinabox/root_page.o 
undefined symbol 0 (NULL name) can't be a weak definition
/usr/libexec/gcc/powerpc-apple-darwin8/4.0.1/ld: shellinabox/vt100.o undefined 
symbol 0 (NULL name) can't be a weak definition
/usr/libexec/gcc/powerpc-apple-darwin8/4.0.1/ld: shellinabox/shell_in_a_box.o 
undefined symbol 0 (NULL name) can't be a weak definition
/usr/libexec/gcc/powerpc-apple-darwin8/4.0.1/ld: shellinabox/styles.o undefined 
symbol 0 (NULL name) can't be a weak definition
/usr/libexec/gcc/powerpc-apple-darwin8/4.0.1/ld: shellinabox/print-styles.o 
undefined symbol 0 (NULL name) can't be a weak definition
/usr/libexec/gcc/powerpc-apple-darwin8/4.0.1/ld: shellinabox/enabled.o 
undefined symbol 0 (NULL name) can't be a weak definition
/usr/libexec/gcc/powerpc-apple-darwin8/4.0.1/ld: shellinabox/favicon.o 
undefined symbol 0 (NULL name) can't be a weak definition
/usr/libexec/gcc/powerpc-apple-darwin8/4.0.1/ld: shellinabox/beep.o undefined 
symbol 0 (NULL name) can't be a weak definition

I have tried to work around this, but Mach assumes any symbol with a zero value 
to be unresolved and so all the "Start" symbols are undefined.

I was able to build shellinaboxd by changing LDFLAGS in the Makefile to ignore 
the undefined symbols, but then execution fails ..

dyld: Symbol not found: _cgiRootStart
  Referenced from: /Users/mcook/Temp/shellinabox-2.10/shellinabox-2.10/./shellinaboxd
  Expected in: dynamic lookup

I'm still looking into how I might be able work around that, with a view to 
recommending changes to `configure` as invited in the INSTALL file.

The README file does not contain an e-mail address as stated in INSTALL.

I accumulated a lot of notes about what I did to get this far if anyone else is 
working on it.  The above is the short version, but you can let me know if you 
would like more details.  

Original comment by m06orama@gmail.com on 28 Sep 2010 at 11:53

GoogleCodeExporter commented 9 years ago
I just made two changes that should address the problems that you have been 
reporting. Let me know if this helps you make a little more progress trying to 
compile on MacOS X.

Original comment by zod...@gmail.com on 29 Sep 2010 at 2:20

GoogleCodeExporter commented 9 years ago
I grabbed this latest version, and things go well except for:

shellinabox/launcher.c:1404: error: ‘PAM_DATA_SILENT’ undeclared (first use 
in this function)

I removed its one usage just for the sake of attempting to move on. Next, I 
discovered that apparently OSX does not have the 
setresuid/getresuid/getresuid/getresguid functions:
...
shellinabox/launcher.c:535: warning: implicit declaration of function 
‘getresuid’
...

Lots of lines like this sprinkled about, and then linker errors at the end of 
course.
Again, just for the sake of moving on quickly I made wrapper functions (like 
int fakeGetresuid(...)) in privileges.c and used the standard 
getuid/geteuid/setuid/seteuid functions to implement them. After switching to 
these, shellinabox compiles and runs* on OSX.

*However, on the browser side I see random backslashes (\) inserted all over 
the place in the actual response text, and so Safari is mighty confused and 
shellinaboxd is not yet useful. I built with my changes in Linux and it still 
works fine there. 

So in summary, your changes do seem to have helped a lot -- we seem close. 
Thanks!

Original comment by tmcre...@gmail.com on 29 Sep 2010 at 5:46

GoogleCodeExporter commented 9 years ago
Try again and let me know if this is any better now.

Original comment by zod...@gmail.com on 29 Sep 2010 at 6:42

GoogleCodeExporter commented 9 years ago
Now it builds cleanly from a fresh checkout, but the problem with backslashes 
remains. I've attached what I get if I go to http://myhost:shellinaboxport/ and 
then right-click and view the page source. The browser renders:

\\ <\head> Shell In A B\ox <\script type="tex\t/javascript">\ \

(I'm starting the server with "./shellinaboxd -t -d".) I don't see any 
complaints on stderr/stdout.

Original comment by tmcre...@gmail.com on 29 Sep 2010 at 6:56

Attachments:

GoogleCodeExporter commented 9 years ago
That sounds a little bit as if your version of sed or make is incompatible with 
what the build scripts are trying to do. If you can, try to use the GNU version 
of these tools. I'll think about it some more and see if I can find a solution 
for you.

Original comment by zod...@gmail.com on 29 Sep 2010 at 7:01

GoogleCodeExporter commented 9 years ago
Ah, I should mention that as a new OSX user I have lots of GNU versions of 
things installed in /opt/local/bin, and  in retrospect the configure script was 
already using /opt/local/bin/gsed.  OSX uses GNU Make 3.8.1 by default.
Thanks for the help.

Original comment by tmcre...@gmail.com on 29 Sep 2010 at 7:28

GoogleCodeExporter commented 9 years ago
I  got the new version and then a clean configure and make but ..

.. http://127.0.0.1:400 .. gets ..

\ \ <\head>   Shell In A B\ox <\script type="tex\t/javascript">\  \ 

Checking my sed likewise .. I am also a Fink user .. I have no "gsed" .. but 
this is OSX 10.4.11 PPC and sed manual page is dated July 2004.

I looked into updating GNU tools sed and make ..

Reran configure .. get various warnings in make (see below) .. then unable to 
connect to shellinaboxd, all as follows:

.. After updating sed to 4.2.1-1 ..
.. After updating make to 3.81-2 from 3.79.1-3 ..
.. did a clean svn checkout, then ./configure then make ..
.. separate logs for each attached ..

make gave these errors ..

shellinabox/launcher.c: In function 'internalLogin':
shellinabox/launcher.c:1043: warning: pointer targets in passing argument 3 of 
'getgrouplist' differ in signedness
/usr/libexec/gcc/powerpc-apple-darwin8/4.0.1/ld: warning multiple definitions 
of symbol _parseUser
privileges.o definition of _parseUser in section (__TEXT,__text)
/usr/lib/gcc/powerpc-apple-darwin8/4.0.1/../../../libSystem.dylib(getpwent.o) 
definition of _parseUser

.. and ./shellinaboxd -t -t .. gets ..

Safari can??~@?~Yt open the page.
Safari can??~@?~Yt open the page ??~@?~\http://192.168.2.106:4200/??~@?~]. The 
error is: ??~@?~\bad server response??~@?~] (NSURLErrorDomain:-11
011) Please choose Safari > Report Bugs to Apple, note the error number, and 
describe what you did before you saw this message.

.. using http://127.0.0.1:4200, then using 192.168.2.106, then mona.local ..

Command line: ./shellinaboxd -t -d
Listening on port 4200
Accepted connection from localhost:58531
Handling "GET" "/"
Compressed response from 5302 to 2584
localhost - - [29/Sep/2010:04:16:47 -0500] "GET / HTTP/1.1" 200 2677
Closing connection to localhost:58531
Accepted connection from mona:58536
Handling "GET" "/"
Compressed response from 5302 to 2584
mona - - [29/Sep/2010:04:17:06 -0500] "GET / HTTP/1.1" 200 2677
Closing connection to mona:58536
Accepted connection from mona:58537Handling "GET" "/"
Compressed response from 5302 to 2584
mona - - [29/Sep/2010:04:17:25 -0500] "GET / HTTP/1.1" 200 2677
Closing connection to mona:58537

No sign of any other errors in  console or system logs. 

Original comment by m06orama@gmail.com on 29 Sep 2010 at 9:38

Attachments:

GoogleCodeExporter commented 9 years ago
Well, after all that I found that Firefox and Chrome still connect locally or 
from another host but I still get the slashes as before .. 

\ \ <\head>   Shell In A B\ox <\script type="tex\t/javascript">\  \ 

It's only Safari Version 4.1.2 (4533.18.5) that gets it's connection closed.  

Original comment by m06orama@gmail.com on 29 Sep 2010 at 9:55

GoogleCodeExporter commented 9 years ago
Please take another look and let me know if you still see error (or even just 
warning) messages. Thanks.

Original comment by zod...@gmail.com on 29 Sep 2010 at 4:48

GoogleCodeExporter commented 9 years ago
I checked out rev 233.

Got a make warning about needing autoconf 1.11 .. installed it.

Redid checkout .. clean ./configure and make .. ./shellinaboxd -t -d .. on 
connection from Firefox 3.6.10 on OSX 10.4.11 PPC (build system)  says ..

Command line: ./shellinaboxd -t -d
Listening on port 4200
Accepted connection from localhost:59007
Handling "GET" "/"
Compressed response from 4967 to 2124
localhost - - [29/Sep/2010:13:32:12 -0500] "GET / HTTP/1.1" 200 2217
Accepted connection from localhost:59008
Handling "GET" "/styles.css"
Compressed response from 7315 to 1515
localhost - - [29/Sep/2010:13:32:13 -0500] "GET /styles.css HTTP/1.1" 200 1647
Handling "GET" "/ShellInABox.js"
Compressed response from 186894 to 42052
localhost - - [29/Sep/2010:13:32:13 -0500] "GET /ShellInABox.js HTTP/1.1" 200 
42167
Accepted connection from localhost:59009
Handling "GET" "/keyboard.png"
localhost - - [29/Sep/2010:13:32:13 -0500] "GET /keyboard.png HTTP/1.1" 200 873
Handling "GET" "/keyboard.html"
Compressed response from 3181 to 801
localhost - - [29/Sep/2010:13:32:13 -0500] "GET /keyboard.html HTTP/1.1" 200 893
Handling "GET" "/beep.wav"
localhost - - [29/Sep/2010:13:32:13 -0500] "GET /beep.wav HTTP/1.1" 200 911
Handling "POST" "/?"
Creating a new session: K//qS-it/kzS19ekKzdBIg
Check failed at shellinabox/launcher.c:473 in launchChild(): bytes == 
sizeof(pid)

On connection from Ubuntu 10.4.1 Firefox 3.6.10 it says ...

Command line: ./shellinaboxd -t -d
Listening on port 4200
Accepted connection from cara:33348
Handling "GET" "/"
Compressed response from 4967 to 2124
cara - - [29/Sep/2010:13:38:28 -0500] "GET / HTTP/1.1" 200 2217
Handling "GET" "/styles.css"
Compressed response from 7315 to 1515
cara - - [29/Sep/2010:13:38:28 -0500] "GET /styles.css HTTP/1.1" 200 1647
Handling "GET" "/ShellInABox.js"
Compressed response from 186894 to 42052
cara - - [29/Sep/2010:13:38:28 -0500] "GET /ShellInABox.js HTTP/1.1" 200 42167
Handling "GET" "/keyboard.png"
cara - - [29/Sep/2010:13:38:29 -0500] "GET /keyboard.png HTTP/1.1" 200 873
Handling "GET" "/keyboard.html"
Compressed response from 3181 to 801
cara - - [29/Sep/2010:13:38:29 -0500] "GET /keyboard.html HTTP/1.1" 200 893
Handling "GET" "/beep.wav"
cara - - [29/Sep/2010:13:38:29 -0500] "GET /beep.wav HTTP/1.1" 200 911
Handling "GET" "/beep.wav"
cara - - [29/Sep/2010:13:38:29 -0500] "GET /beep.wav HTTP/1.1" 200 911
Handling "POST" "/?"
Creating a new session: vao14f0wNzXF2hkdRhtbEw
Check failed at shellinabox/launcher.c:473 in launchChild(): bytes == 
sizeof(pid)

On connection from Ubuntu 10.4.1 and Chrome 6.0.472 (57914) .. it says ..

Command line: ./shellinaboxd -t -d
Listening on port 4200
Accepted connection from cara:56849
Handling "GET" "/"
Compressed response from 4967 to 2124
cara - - [29/Sep/2010:13:43:12 -0500] "GET / HTTP/1.1" 200 2217
Handling "GET" "/styles.css"
Compressed response from 7315 to 1515
cara - - [29/Sep/2010:13:43:12 -0500] "GET /styles.css HTTP/1.1" 200 1647
Accepted connection from cara:56850
Handling "GET" "/ShellInABox.js"
Compressed response from 186894 to 42052
cara - - [29/Sep/2010:13:43:12 -0500] "GET /ShellInABox.js HTTP/1.1" 200 42167
Handling "GET" "/favicon.ico"
Compressed response from 2307 to 1983
cara - - [29/Sep/2010:13:43:13 -0500] "GET /favicon.ico HTTP/1.1" 200 2079
Handling "GET" "/keyboard.png"
cara - - [29/Sep/2010:13:43:13 -0500] "GET /keyboard.png HTTP/1.1" 200 873
Handling "GET" "/keyboard.html"
Compressed response from 3181 to 801
cara - - [29/Sep/2010:13:43:13 -0500] "GET /keyboard.html HTTP/1.1" 200 893
Handling "POST" "/?"
Creating a new session: g/Mizr5NhDZTmemOuYw78Q
Check failed at shellinabox/launcher.c:473 in launchChild(): bytes == 
sizeof(pid). 

I also checked out the new rev 233 on Ubuntu 10.4.1 .. ./configure and make 
were clean (tho' also suggesting update to autoconf 1.11 plus autoconf and 
autoheader) .. but shellinaboxd runs OK and I can connect from both Ubuntu and 
OSX Safari successfully as expected.

I'm not sure that we really care that much if shellinabox will build on OSX PPC 
10.4.11 'cos it's so old ..  tmcreech is probably on an Intel Mac with more 
up-to-date OSX .. but I'm happy to keep working on this if you think it's 
worthwhile.  

Original comment by m06orama@gmail.com on 29 Sep 2010 at 7:12

GoogleCodeExporter commented 9 years ago
I have a few ideas of what might be going wrong, and if everything else fails, 
I'll add some extra debugging messages to the code.

But it might be easier to figure this out, if you could get me a trace of the 
system calls that shellinaboxd is making. Do you have access to "strace" or 
"truss"? If so, could you run it with arguments to follow child processes, and 
ideally, could you tell if to not truncate strings and other arguments more 
than necessary?

Let me know, if this isn't something you can easily do, and I'll figure out 
some other way to debug the problem.

As you rightly guessed, OSX PPC is not a particularly high priority. But 
anything that helps me remove platform incompatibilities is generally a good 
idea -- it tends to make the code more robust overall.

Original comment by zod...@gmail.com on 29 Sep 2010 at 7:32

GoogleCodeExporter commented 9 years ago
Looking into strace and truss .. OSX 10.4 has no strace or truss but it does 
have ktrace and kdump instead, whereas OSX 10.5 and 10.6 have s.t. newer/better 
called dtrace.

Looking into the privileges required for ktrace on my system since ..

ktrace -t cnisuw ./shellinaboxd -t -d ..  (run as root, all the trace options) 
says .. 

Command line: ./shellinaboxd -t -d
Check failed at shellinabox/privileges.c:155 in lowerPrivileges(): 
!setresuid(n, n, -1)
Listening on port 4200
Check failed at shellinabox/privileges.c:181 in dropPrivileges(): !setresuid(n, 
n, n)

This happened immediately.  I still got a ktrace.out, and I've formatted it for 
you as kdump.1.txt attached.

I'm still trying to find out more about ktrace options as there are several and 
maybe one would help bypass the exception.

Original comment by m06orama@gmail.com on 29 Sep 2010 at 9:51

Attachments:

GoogleCodeExporter commented 9 years ago
Sorry, the file I uploaded seems to be mostly junk when viewed from 
code.google.com .. I think I messed up .. backtracking. 

Original comment by m06orama@gmail.com on 29 Sep 2010 at 9:59

GoogleCodeExporter commented 9 years ago
Yepp, I am a little puzzled by the trace. It shows that the check in line 181 
failed, but I don't see any attempt at actually setting the user id. So, I 
don't quite know what is failing.

Maybe, your machine doesn't have a "nobody" user? Could you try to print out 
the value of "n" after calling 'getUserId("nobody")' ?

This should be pretty benign code. We shouldn't fail in this place. But if we 
do, I'd like to know why MacOS X doesn't like what we are doing.

Original comment by zod...@gmail.com on 29 Sep 2010 at 10:03

GoogleCodeExporter commented 9 years ago
OK, this should be better .. see file kdump.3.out from this session .. no 
special permissions required and no program check.

Command line: ./shellinaboxd -t -d
Listening on port 4200
Accepted connection from localhost:59492
Handling "GET" "/"
Compressed response from 4967 to 2124
localhost - - [29/Sep/2010:17:15:24 -0500] "GET / HTTP/1.1" 200 2217
Handling "GET" "/styles.css"
Compressed response from 7315 to 1515
localhost - - [29/Sep/2010:17:15:24 -0500] "GET /styles.css HTTP/1.1" 200 1647
Accepted connection from localhost:59493
Handling "GET" "/ShellInABox.js"
Compressed response from 186894 to 42052
localhost - - [29/Sep/2010:17:15:24 -0500] "GET /ShellInABox.js HTTP/1.1" 200 
42167
Handling "GET" "/keyboard.html"
Compressed response from 3181 to 801
localhost - - [29/Sep/2010:17:15:24 -0500] "GET /keyboard.html HTTP/1.1" 200 893
Accepted connection from localhost:59494
Handling "GET" "/keyboard.png"
localhost - - [29/Sep/2010:17:15:25 -0500] "GET /keyboard.png HTTP/1.1" 200 873
Handling "GET" "/beep.wav"
localhost - - [29/Sep/2010:17:15:25 -0500] "GET /beep.wav HTTP/1.1" 200 911
Handling "POST" "/?"
Creating a new session: XRO1zwIVOijwyFmUJqgM4g
Check failed at shellinabox/launcher.c:473 in launchChild(): bytes == 
sizeof(pid)

Original comment by m06orama@gmail.com on 29 Sep 2010 at 10:27

Attachments:

GoogleCodeExporter commented 9 years ago
This trace file does not appear to traverse through child processes. I can now 
see that we receive an end-of-file condition on the file descriptor that we use 
for talking to the child process. But I can't tell whether that is because the 
child process died, or because of any other unexpected reason.

Original comment by zod...@gmail.com on 29 Sep 2010 at 10:43

GoogleCodeExporter commented 9 years ago
My bad .. I missed a flag. 

The previous trace was ktrace -t cnisuw ./shellinabox -t -d

Redid it with ktrace -d -i -t cnisuw -f ktrace.5.out ./shellinaboxd -t -d

The flags are:
     -d      Descendants; perform the operation for all current children of
             the designated processes.
     -i      Inherit; pass the trace flags to all future children of the des-
             ignated processes.
 -t trstr
             The string argument represents the kernel trace points, one per
             letter.  The following table equates the letters with the trace-
             points:
             c     trace system calls
             n     trace namei translations
             i     trace I/O
             s     trace signal processing
             u     userland traces
             w     context switches

Messages for this session are in  ktrace.5.session.txt attached, with the trace 
dump in kdump.5.txt.

It shows more stuff including .. "Check failed at shellinabox/launcher.c:500 in 
initUtmp(): !strncmp(ptyPath, "/dev/pts", 8)".

Over to you,

Original comment by m06orama@gmail.com on 30 Sep 2010 at 7:24

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks. That was quite helpful. I guess, you are the first person to try using 
a system that doesn't have Unix 98 pseudo terminals. But this was clearly a bug 
in my code. I relaxed the check a little bit and it should make more progress. 
Let me know, how it goes.

Original comment by zod...@gmail.com on 30 Sep 2010 at 3:54

GoogleCodeExporter commented 9 years ago
OK, I got Rev 264 and now I am getting ..

      utmp_update: Current user `ecloco' does not match `' in utmpx entry

Same thing with different users both from OSX and Ubuntu.  I tried running 
shellinanboxd AND trying to log in to SIAB with different users 'cos I have my 
regular ID's ssh set up to log in automagically (i.e. to not ask for password).

See ktrace.7.session.txt and kdump.7.txt attached.

Original comment by m06orama@gmail.com on 30 Sep 2010 at 6:37

Attachments:

GoogleCodeExporter commented 9 years ago
I meant your Rev 234 of course.

Reading up on "Unix 98 pseudo terminal" (rather than BSD), I also tried running 
SIAB from iTerm but I got the same results, so you must mean that the problem 
is with OSX's pseudo terminal support server side: OSX 10.4 PPC has /dev/tty's 
and /dev/pty's, whereas Ubuntu has /dev/pts/n's.

I don't know for sure that OSX Intel (10.5 or 10.6) is any different, but Mac 
OS X v10.5 "Leopard", released on October 26, 2007, is an Open Brand UNIX 03 
registered product when run on Intel processors, also an Open Brand UNIX 03 
Registered Product, conforming to the SUSv3 and POSIX 1003.1 specifications for 
the C API, Shell Utilities, and Threads.

Original comment by m06orama@gmail.com on 30 Sep 2010 at 8:44

GoogleCodeExporter commented 9 years ago
OK. Give it another try.

Original comment by zod...@gmail.com on 30 Sep 2010 at 9:53

GoogleCodeExporter commented 9 years ago
Got Rev 235

Upgraded to autoconf 2.65-2 via Fink, due to warning: "aclocal.m4:16: warning: 
this file was generated for autoconf 2.65."

Different results between OSX and Ubuntu clients this time:

0) OSX (localhost) Safari client dies as before.

1) OSX Firefox client goes straight to "Session closed" as before:-

Handling "POST" "/?"
Failed to find session: y/6VB-GJD7MwF2IV6aYyUw
localhost - - [30/Sep/2010:22:37:41 -0500] "POST /? HTTP/1.1" 400 458
Closing connection to localhost:62112

2) Ubuntu (host name "cara") Firefox client ..

SIAB seemed to hang right after this ..

Handling "POST" "/?"
Creating a new session: nltiT-PSJhS92rBln/-7BQ

I hit Ctrl-C but it ignored it ..

I attempted to reconnect from Ubuntu web client, see nothing in the browser,  
and then it says on the console ..

^CShutting down server
Closing connection to localhost:62110
Closing connection to localhost:62111
Closing connection to cara:43284
Creating a new session: qrvWzonX3EZcBPDGwJog2Q
Check failed at shellinabox/launcher.c:549 in launchChild(): bytes == 
sizeof(pid)

Files ktrace.session.A.txt (including annotations to the console log) and 
kdump.A.txt are attached.

Original comment by m06orama@gmail.com on 1 Oct 2010 at 5:06

Attachments:

GoogleCodeExporter commented 9 years ago
I am definitely getting a little frustrated with MacOS X. It seems that their 
support for standard UNIX-style APIs is somewhat buggy. I just checked in 
another attempt at fixing some of the problems.

Please also note that I found some suggestions that "/usr/bin/login" on MacOS X 
is not quite working correctly. You might have to remove the "pam_launchd.so" 
entry from your "/etc/pam.d/login" file, if you want to use LOGIN for your 
service definition.

This is probably not an ideal solution, but I am not sufficiently familiar with 
Macs to suggest an alternative.

Original comment by zod...@gmail.com on 2 Oct 2010 at 2:24

GoogleCodeExporter commented 9 years ago
OK, we seem to be getting closer with Rev 236 as I got prompted for a login the 
first time, before getting a total system hang.  See kdump.C.txt nevertheless.  
I lost the console messages from this run.  But there's more...

File ktrace.D2.session.txt includes the messages from my second run for which I 
got no prompt and no dump was produced even tho' the system didn't hang.  Here 
I  included the text of my /etc/pam.d/login on OSX: that line 
("pam_launchd.so") is not present. However, read on...  

Seized with a fit of enthusiasm, I retried once more without trace and got 
similar to the first time but this time no hang. This was session "E".

Lastly, I did a fourth run, and this time was able to log in to OSX but then 
the console froze at the command prompt. However, I went over to Ubuntu and was 
able to get a complete ssh session, run some commands, and then log out 
normally.  This was session "F". 

After a couple of retries I wasn't getting any further with that. We got a 
gigantic dump from this session - see kdump.F.txt and my ktrace.F.session.log 
with all the  console messages and various annotations.

So, it's working at last - congratulations!  

Let me know if you want to test some more of course.    

Original comment by m06orama@gmail.com on 2 Oct 2010 at 5:47

Attachments:

GoogleCodeExporter commented 9 years ago
I tried it again with Ubuntu/Chrome and this time was able to get 2 complete 
sessions, tho' Ubuntu/FF didn't want to connect at all and thereafter Chrome 
neither.

Didn't try it with OSX FF client (no Chrome for PPC).

Session and dump attached in case they will also be useful at this stage.  

Original comment by m06orama@gmail.com on 2 Oct 2010 at 6:08

Attachments:

GoogleCodeExporter commented 9 years ago
Just FYI: I'm on 10.6.4, and at least as of 236 many things are looking much 
better.

The default "login" service works fine, and "--service=ssh:SSH:$HOSTNAME" also 
works well for me. (This is without any modifications to OSX.)

However, something like 
"--service=ncmpcpp:tcreech:staff:HOME:/opt/local/bin/ncmpcpp" fails with

"""
Failed to load PAM support. Could not find "pam_acct_mgmt"
Loaded PAM suppport
"""

...and then the browser just says "session closed" immediately. 

But still, with both SSH and LOGIN services working, I'm very pleased. Thanks!

Original comment by tmcre...@gmail.com on 2 Oct 2010 at 6:45

GoogleCodeExporter commented 9 years ago
Trying to get a more consistent feel for how it's behaving, I ran several other 
tests with Rev 236.  I have some outputs but you might not need 'em at this 
stage. Just let me know if you do, tho'.  

 - Session H .. 2 consecutive successful logins from OSX FF (no Chrome), then no prompt right after "Window size changed to 100x45" which I've seen a few times.  Didn't try Ubuntu FF or Chrome clients in this session.

 - Session I .. Ubuntu FF .. one good session . then no prompt right after these messages ..

        Handling "POST" "/?"
        Creating a new session: xsXWbdAqaPasnv2X6RW-oQ
        Window size changed to 110x43.

 - Session J .. attempt to login twice concurrently from Ubuntu:

     - first session (FF) gets as far as my entering user name.
     - 2nd session (Chrome) just gives me a prompt and then will not respond.

     On return to OSX (other side of KVM) the system is hung (or at least the keyboard is locked) and I have to reboot, so the actual session log was lost.

 - Session K .. action reply identical with Session J. 

Original comment by m06orama@gmail.com on 2 Oct 2010 at 1:13

GoogleCodeExporter commented 9 years ago
I just fixed the "Failed to load ... / Loaded" message. That's certainly 
confusing, although it was really just cosmetic. It didn't affect actual 
functionality. PAM support was never loaded in this situation.

You might have better luck on MacOS X, if you ran the "configure" script with 
the "--disable-runtime-loading" option, as it appears that run-time loading of 
PAM isn't working for you anyway.

But none of that explains why you cannot run an arbitrary program as a service. 
That should always succeed. Can you double-check that all the parameters are 
correct? Maybe, try running something simpler first (e.g. "/bin/sh")?

Original comment by zod...@gmail.com on 2 Oct 2010 at 6:12

GoogleCodeExporter commented 9 years ago
Michael, I am still flabbergasted how ShellInABox (a pretty benign user-space 
application) could possibly make your entire machine crash. I am not sure I'll 
ever be able to figure that out without being able to reproduce it locally.

But your dump of all the call traces did at least help point towards a pretty 
bad bug that I introduced in the server mainloop a good while ago. It resulted 
in the server a) using a lot more CPU than it should, and b) users being unable 
to CTRL-C long-running applications. It might also explain some of the other 
bugs that people reported, such as Emacs sometimes getting really slow.

It was reasonably straight-forward to fix, once I had developed a good 
working-theory as to what was going on. Although initially, I just stared at 
your trace files in disbelieve :-)

Original comment by zod...@gmail.com on 2 Oct 2010 at 11:47

GoogleCodeExporter commented 9 years ago
I think most of my alleged "system hangs" were just the keyboard being locked 
due to my old KVM switch.  It does that sometimes, altho' with "session C" I'm 
pretty sure I couldn't do a regular ssh in from Ubuntu to OSX, so I assumed the 
app was looping.     

With Rev 239, I got the same results for sessions L and M as follows:

 - Session L from OSX FF .. I connect and get 1 good session only .. type exit .. get "Session closed" .. hit "Connect" button, then nothing.

 - Session M from Ubuntu Chrome .. same thing.

Console messages and trace dump for session L are attached.

I recompiled with "--disable-runtime-loading" and got the same results as in 
session L.

Original comment by m06orama@gmail.com on 3 Oct 2010 at 3:34

Attachments:

GoogleCodeExporter commented 9 years ago
Actually, with when I ./configure with --disable-runtime-loading, I get an 
warnings and errors in "make".
I've attached my run of "./configure --disable-runtime-loading" and "make" in 
case this is interesting.

On the other hand, if I copy verbatim the service description that was failing 
for me earlier and use that again, it seems to work. (The default service works 
well.) I randomly chose r234, and the same service description fails at least 
there.

So in summary, I think the most common functionality is working for me in 239 
on 10.6.4. I tested the default service on a vanilla 10.5.8 Intel iMac and it 
worked well there as well.

Original comment by tmcre...@gmail.com on 4 Oct 2010 at 2:54

Attachments:

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Can't compile on Lion. Get the following error on make:

shellinabox/externalfile.c:63:1: warning: "strncat" redefined
In file included from /usr/include/string.h:190,
                 from shellinabox/externalfile.c:51:
/usr/include/secure/_string.h:146:1: warning: this is the location of the 
previous definition
mv -f .deps/externalfile.Tpo .deps/externalfile.Po
gcc -DHAVE_CONFIG_H -I.    -g -std=gnu99 -Wall -Os -MT launcher.o -MD -MP -MF 
.deps/launcher.Tpo -c -o launcher.o `test -f 'shellinabox/launcher.c' || echo 
'./'`shellinabox/launcher.c
shellinabox/launcher.c:114:1: warning: "strncat" redefined
In file included from /usr/include/string.h:190,
                 from shellinabox/launcher.c:61:
/usr/include/secure/_string.h:146:1: warning: this is the location of the 
previous definition
shellinabox/launcher.c: In function ‘launcherDaemon’:
shellinabox/launcher.c:1664: error: variable-sized object may not be initialized
shellinabox/launcher.c:1664: warning: excess elements in array initializer
shellinabox/launcher.c:1664: warning: (near initialization for ‘cmsg_buf’)
make[1]: *** [launcher.o] Error 1
make: *** [all] Error 2

Original comment by opti...@gmail.com on 9 Sep 2011 at 4:17

GoogleCodeExporter commented 9 years ago
Just looking at this error a little more, the fix is easy for lion.  Change 
line 1664 to:

      char cmsg_buf[CMSG_SPACE(sizeof(int))];

And you should be able to get it to compile.

Original comment by jhaya...@gmail.com on 15 Jan 2012 at 9:51

GoogleCodeExporter commented 9 years ago
While it seems there's little activity here, I am getting similar kinds of 
problems.  ./configure runs fine, but make gets upset.

The output of configure with an answer of no is:

checking for gawk... no
checking for mawk... no
checking for nawk... no
checking whether we are cross compiling... no
checking for gcc option to accept ISO C89... none needed
checking for a sed that does not truncate output... /opt/local/bin/gsed
checking if the linker (/usr/libexec/gcc/powerpc-apple-darwin9/4.0.1/ld) is GNU 
ld... no
checking for objdump... no
checking for otool64... no
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fno-common -DPIC
checking if gcc PIC flag -fno-common -DPIC works... yes
checking if gcc static flag -static works... no
checking whether gcc needs -traditional... no
checking libutil.h usability... no
checking libutil.h presence... no
checking for libutil.h... no
checking pty.h usability... no
checking pty.h presence... no
checking for pty.h... no
checking sys/prctl.h usability... no
checking sys/prctl.h presence... no
checking for sys/prctl.h... no

make  all-am
/bin/sh ./libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I.    -g 
-std=gnu99 -Wall -Os -MT logging.lo -MD -MP -MF .deps/logging.Tpo -c -o 
logging.lo `test -f 'logging/logging.c' || echo './'`logging/logging.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -g -std=gnu99 -Wall -Os -MT 
logging.lo -MD -MP -MF .deps/logging.Tpo -c logging/logging.c  -fno-common 
-DPIC -o .libs/logging.o
logging/logging.c:183: error: only weak aliases are supported in this 
configuration
make[1]: *** [logging.lo] Error 1
make: *** [all] Error 2

Original comment by squiduly...@gmail.com on 20 Jan 2012 at 11:53

GoogleCodeExporter commented 9 years ago
Hi!
I'm running OSX 10.8 Mountain Lion. I checked out the latest SVN build and 
applied jhaya's fix (comment 35). It works perfectly (with Chrome as a 
frontend)! Super cool!

Original comment by lukas.ha...@spaceship.io on 20 Mar 2012 at 4:00

GoogleCodeExporter commented 9 years ago
Applied compatible change from comment 35.  Patches welcome.

Original comment by beewoo...@gmail.com on 31 Mar 2012 at 7:34

GoogleCodeExporter commented 9 years ago
Just built on OSX 10.9 Mavericks, and it built and installed just fine, out of 
the box, no changes required.

Original comment by Simon.Br...@gmail.com on 4 Apr 2014 at 3:34

GoogleCodeExporter commented 9 years ago
This issue should be closed. It is easy to install now.

The easiest option is to use homebrew.

brew install shellinabox

Original comment by spkan...@gmail.com on 24 Jul 2014 at 11:52