Skip to content

Commit

Permalink
Improve debugging output
Browse files Browse the repository at this point in the history
Being able to see in the logs when a request has been made to an
unimplemented handler is important.

Furthermore, being able to access the deep SSH debug messaging is
important when trying to diagnose subtle issues related to SFTP / SSH
protocol.
  • Loading branch information
slifty committed Feb 8, 2023
1 parent bea4424 commit 3ce8d68
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/classes/SftpSessionHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ export class SftpSessionHandler {
*/
// eslint-disable-next-line class-methods-use-this
public writeHandler = (): void => {
logger.verbose('Request: SFTP write file (SSH_FXP_WRITE)');
logger.error('UNIMPLEMENTED Request: SFTP write file (SSH_FXP_WRITE)');
};

/**
Expand Down Expand Up @@ -195,7 +195,7 @@ export class SftpSessionHandler {
*/
// eslint-disable-next-line class-methods-use-this
public fsetStatHandler = (): void => {
logger.verbose('Request: SFTP write open file statistics (SSH_FXP_FSETSTAT)');
logger.error('UNIMPLEMENTED Request: SFTP write open file statistics (SSH_FXP_FSETSTAT)');
};

/**
Expand Down Expand Up @@ -328,7 +328,7 @@ export class SftpSessionHandler {
*/
// eslint-disable-next-line class-methods-use-this
public removeHandler = (): void => {
logger.verbose('Request: SFTP remove file (SSH_FXP_REMOVE)');
logger.error('UNIMPLEMENTED Request: SFTP remove file (SSH_FXP_REMOVE)');
};

/**
Expand All @@ -339,7 +339,7 @@ export class SftpSessionHandler {
*/
// eslint-disable-next-line class-methods-use-this
public rmDirHandler = (): void => {
logger.verbose('Request: SFTP remove directory (SSH_FXP_RMDIR)');
logger.error('UNIMPLEMENTED Request: SFTP remove directory (SSH_FXP_RMDIR)');
};

/**
Expand Down Expand Up @@ -387,7 +387,7 @@ export class SftpSessionHandler {
*/
// eslint-disable-next-line class-methods-use-this
public readLinkHandler = (): void => {
logger.verbose('Request: SFTP read link (SSH_FXP_READLINK)');
logger.error('UNIMPLEMENTED Request: SFTP read link (SSH_FXP_READLINK)');
};

/**
Expand All @@ -398,7 +398,7 @@ export class SftpSessionHandler {
*/
// eslint-disable-next-line class-methods-use-this
public setStatHandler = (): void => {
logger.verbose('Request: SFTP set file attributes (SSH_FXP_SETSTAT)');
logger.error('UNIMPLEMENTED Request: SFTP set file attributes (SSH_FXP_SETSTAT)');
};

/**
Expand All @@ -409,7 +409,7 @@ export class SftpSessionHandler {
*/
// eslint-disable-next-line class-methods-use-this
public mkDirHandler = (): void => {
logger.verbose('Request: SFTP create directory (SSH_FXP_MKDIR)');
logger.error('UNIMPLEMENTED Request: SFTP create directory (SSH_FXP_MKDIR)');
};

/**
Expand All @@ -420,7 +420,7 @@ export class SftpSessionHandler {
*/
// eslint-disable-next-line class-methods-use-this
public renameHandler = (): void => {
logger.verbose('Request: SFTP file rename (SSH_FXP_RENAME)');
logger.error('UNIMPLEMENTED Request: SFTP file rename (SSH_FXP_RENAME)');
};

/**
Expand All @@ -431,7 +431,7 @@ export class SftpSessionHandler {
*/
// eslint-disable-next-line class-methods-use-this
public symLinkHandler = (): void => {
logger.verbose('Request: SFTP create symlink (SSH_FXP_SYMLINK)');
logger.error('UNIMPLEMENTED Request: SFTP create symlink (SSH_FXP_SYMLINK)');
};

private readonly genericStatHandler = (reqId: number, itemPath: Buffer): void => {
Expand Down
1 change: 1 addition & 0 deletions src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ if (typeof process.env.SSH_HOST_KEY_PATH === 'string') {

const serverConfig: ServerConfig = {
hostKeys,
debug: (message) => logger.silly(message),
};

const connectionListener = (client: Connection): void => {
Expand Down

0 comments on commit 3ce8d68

Please sign in to comment.