Browse Source
use -S when passing command to env to ensure args passed correctly
pull/331/head
butlerx
4 years ago
No known key found for this signature in database
GPG Key ID: B37CA765BAA89170
2 changed files with
4 additions and
2 deletions
-
src/server.ts
-
src/server/spawn.ts
|
@ -61,7 +61,7 @@ export async function start( |
|
|
args[1] = `${username.trim()}@${args[1]}`; |
|
|
args[1] = `${username.trim()}@${args[1]}`; |
|
|
logger.debug('Spawning term', { |
|
|
logger.debug('Spawning term', { |
|
|
username: username.trim(), |
|
|
username: username.trim(), |
|
|
cmd: args.join(' ').trim(), |
|
|
cmd: args.join(' '), |
|
|
}); |
|
|
}); |
|
|
spawn(socket, args); |
|
|
spawn(socket, args); |
|
|
} catch (error) { |
|
|
} catch (error) { |
|
|
|
@ -5,7 +5,9 @@ import { logger } from '../shared/logger.js'; |
|
|
import { xterm } from './shared/xterm.js'; |
|
|
import { xterm } from './shared/xterm.js'; |
|
|
|
|
|
|
|
|
export function spawn(socket: SocketIO.Socket, args: string[]): void { |
|
|
export function spawn(socket: SocketIO.Socket, args: string[]): void { |
|
|
const term = pty.spawn('/usr/bin/env', args, xterm); |
|
|
const cmd = ['-S', ...args]; |
|
|
|
|
|
logger.debug('Spawning PTTY', { cmd }); |
|
|
|
|
|
const term = pty.spawn('/usr/bin/env', cmd, xterm); |
|
|
const { pid } = term; |
|
|
const { pid } = term; |
|
|
const address = args[0] === 'ssh' ? args[1] : 'localhost'; |
|
|
const address = args[0] === 'ssh' ? args[1] : 'localhost'; |
|
|
logger.info('Process Started on behalf of user', { |
|
|
logger.info('Process Started on behalf of user', { |
|
|