{"action":"created","issue":{"url":"https://api.github.com/repos/lxc/lxc/issues/825","repository_url":"https://api.github.com/repos/lxc/lxc","labels_url":"https://api.github.com/repos/lxc/lxc/issues/825/labels{/name}","comments_url":"https://api.github.com/repos/lxc/lxc/issues/825/comments","events_url":"https://api.github.com/repos/lxc/lxc/issues/825/events","html_url":"https://github.com/lxc/lxc/pull/825","id":134691736,"number":825,"title":"make lxc-attach use a pty","user":{"login":"brauner","id":7353573,"avatar_url":"https://avatars.githubusercontent.com/u/7353573?v=3","gravatar_id":"","url":"https://api.github.com/users/brauner","html_url":"https://github.com/brauner","followers_url":"https://api.github.com/users/brauner/followers","following_url":"https://api.github.com/users/brauner/following{/other_user}","gists_url":"https://api.github.com/users/brauner/gists{/gist_id}","starred_url":"https://api.github.com/users/brauner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brauner/subscriptions","organizations_url":"https://api.github.com/users/brauner/orgs","repos_url":"https://api.github.com/users/brauner/repos","events_url":"https://api.github.com/users/brauner/events{/privacy}","received_events_url":"https://api.github.com/users/brauner/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":23,"created_at":"2016-02-18T20:46:24Z","updated_at":"2016-02-20T05:53:27Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/lxc/lxc/pulls/825","html_url":"https://github.com/lxc/lxc/pull/825","diff_url":"https://github.com/lxc/lxc/pull/825.diff","patch_url":"https://github.com/lxc/lxc/pull/825.patch"},"body":"~~Work in progress.~~ Have lxc-attach use a pty. As has been discussed the default approach is to create a pty in the container. If that fails we try to create a pty on the host. ~~What needs to be decided among other things is how to handle the case where we have no tty as fd 0.~~"},"comment":{"url":"https://api.github.com/repos/lxc/lxc/issues/comments/186518081","html_url":"https://github.com/lxc/lxc/pull/825#issuecomment-186518081","issue_url":"https://api.github.com/repos/lxc/lxc/issues/825","id":186518081,"user":{"login":"brauner","id":7353573,"avatar_url":"https://avatars.githubusercontent.com/u/7353573?v=3","gravatar_id":"","url":"https://api.github.com/users/brauner","html_url":"https://github.com/brauner","followers_url":"https://api.github.com/users/brauner/followers","following_url":"https://api.github.com/users/brauner/following{/other_user}","gists_url":"https://api.github.com/users/brauner/gists{/gist_id}","starred_url":"https://api.github.com/users/brauner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brauner/subscriptions","organizations_url":"https://api.github.com/users/brauner/orgs","repos_url":"https://api.github.com/users/brauner/repos","events_url":"https://api.github.com/users/brauner/events{/privacy}","received_events_url":"https://api.github.com/users/brauner/received_events","type":"User","site_admin":false},"created_at":"2016-02-20T05:53:27Z","updated_at":"2016-02-20T05:53:27Z","body":"On Sat, Feb 20, 2016 at 06:14:50AM +0100, Christian Brauner wrote:\n> On Fri, Feb 19, 2016 at 09:05:01PM -0800, Serge Hallyn wrote:\n> > On Fri, Feb 19, 2016 at 08:14:56PM -0800, Christian Brauner wrote:\n> > > \n> > > \n> > > On February 20, 2016 12:16:42 AM GMT+01:00, Serge Hallyn <notifications@github.com> wrote:\n> > > >Thanks, looks nice.  I assume you still want us to wait until\n> > > >\"lxc-attach < /dev/zero\" is fixed?\n> > > I wonder if it suffices to allow cases where any of the stdfds does not refer to a terminal iff the user does not specify any additional arguments.\n> > \n> > I'm not sure what you mean, but in case you mean what I think you mean,\n> > \n> > lxc-attach -n x1 2>/dev/null\n> > ttyexploit.pl\n> > \n> > would suffice, and for that matter remember one could just\n> > put the exploit into .bashrc and then do\n> > \n> > lxc-attach -n x1 > /dev/null\n> I mean:\n> \n> \tif (!isatty(STDIN_FILENO) && !isatty(STDOUT_FILENO) && !isatty(STDERR_FILENO)) {\n>                 // simply attach\n> \t} else if (!my_args.argc && (!isatty(STDIN_FILENO) || !isatty(STDOUT_FILENO) || !isatty(STDERR_FILENO))) {\n>                 // simply attach\n> \t} else {\n>                 // use pty\n>         }\nWith this putting ttyexploit.pl in .bashrc, as well as lxc-attach -n x1 2>\n/dev/null ttyexploit.pl shouldn't work.\n\n> > \n> > \n> > ---\n> > Reply to this email directly or view it on GitHub:\n> > https://github.com/lxc/lxc/pull/825#issuecomment-186511494\n"}}