Created
June 5, 2019 12:59
-
-
Save spacelatte/a9455b03f7b59c42396f838584fc1837 to your computer and use it in GitHub Desktop.
using this as ForceCommand or login shell to forward unix sockets as proxycommand
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <unistd.h> | |
int main(int argc, char **argv) { | |
// argv[0]: self | |
// argv[1]: -c, coming from ssh | |
// argv[2]: actual argument | |
// argv[N]: ... | |
char buf[80]; | |
if(argc > 2) { | |
snprintf(buf, sizeof(buf), "/tmp/%s.sock", argv[2]); | |
return execlp("/bin/nc", "nc", "-U", buf, NULL); | |
} | |
return printf("one argument required for socketname...\n"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment