summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Lindstrom <mouring@eviladmin.org>2002-06-06 21:46:08 +0000
committerBen Lindstrom <mouring@eviladmin.org>2002-06-06 21:46:08 +0000
commitb7788f3ebee920d6b14b37034f7f769788b6dff6 (patch)
treed58829d766cbf8e547d8c7400d80879a84284502
parent22fa01cdea7d8fa159113a9148d523a3b8a46278 (diff)
- markus@cvs.openbsd.org 2002/06/05 16:08:07
[ssh-agent.1 ssh-agent.c] '-a bind_address' binds the agent to user-specified unix-domain socket instead of /tmp/ssh-XXXXXXXX/agent.<pid>; ok djm@ (some time ago).
-rw-r--r--ChangeLog6
-rw-r--r--ssh-add.15
-rw-r--r--ssh-agent.19
-rw-r--r--ssh-agent.c31
4 files changed, 37 insertions, 14 deletions
diff --git a/ChangeLog b/ChangeLog
index 288783ac3..3f127b6ba 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -102,6 +102,10 @@
102 [ssh-agent.1 ssh-agent.c] 102 [ssh-agent.1 ssh-agent.c]
103 '-a bind_address' binds the agent to user-specified unix-domain 103 '-a bind_address' binds the agent to user-specified unix-domain
104 socket instead of /tmp/ssh-XXXXXXXX/agent.<pid>; ok djm@ (some time ago). 104 socket instead of /tmp/ssh-XXXXXXXX/agent.<pid>; ok djm@ (some time ago).
105 - markus@cvs.openbsd.org 2002/06/05 16:08:07
106 [ssh-agent.1 ssh-agent.c]
107 '-a bind_address' binds the agent to user-specified unix-domain
108 socket instead of /tmp/ssh-XXXXXXXX/agent.<pid>; ok djm@ (some time ago).
105 109
10620020604 11020020604
107 - (stevesk) [channels.c] bug #164 patch from YOSHIFUJI Hideaki (changed 111 - (stevesk) [channels.c] bug #164 patch from YOSHIFUJI Hideaki (changed
@@ -786,4 +790,4 @@
786 - (stevesk) entropy.c: typo in debug message 790 - (stevesk) entropy.c: typo in debug message
787 - (djm) ssh-keygen -i needs seeded RNG; report from markus@ 791 - (djm) ssh-keygen -i needs seeded RNG; report from markus@
788 792
789$Id: ChangeLog,v 1.2171 2002/06/06 21:46:07 mouring Exp $ 793$Id: ChangeLog,v 1.2172 2002/06/06 21:46:57 mouring Exp $
diff --git a/ssh-add.1 b/ssh-add.1
index 41d5def6f..163fc45ed 100644
--- a/ssh-add.1
+++ b/ssh-add.1
@@ -1,4 +1,4 @@
1.\" $OpenBSD: ssh-add.1,v 1.30 2002/02/04 20:41:16 stevesk Exp $ 1.\" $OpenBSD: ssh-add.1,v 1.31 2002/06/05 16:35:45 markus Exp $
2.\" 2.\"
3.\" -*- nroff -*- 3.\" -*- nroff -*-
4.\" 4.\"
@@ -129,6 +129,9 @@ or related script.
129may be necessary to redirect the input from 129may be necessary to redirect the input from
130.Pa /dev/null 130.Pa /dev/null
131to make this work.) 131to make this work.)
132.It Ev SSH_AUTH_SOCK
133Identifies the path of a unix-domain socket used to communicate with the
134agent.
132.El 135.El
133.Sh DIAGNOSTICS 136.Sh DIAGNOSTICS
134Exit status is 0 on success, 1 if the specified command fails, 137Exit status is 0 on success, 1 if the specified command fails,
diff --git a/ssh-agent.1 b/ssh-agent.1
index 9909ef590..5f498b7e3 100644
--- a/ssh-agent.1
+++ b/ssh-agent.1
@@ -1,4 +1,4 @@
1.\" $OpenBSD: ssh-agent.1,v 1.31 2002/02/04 20:41:16 stevesk Exp $ 1.\" $OpenBSD: ssh-agent.1,v 1.32 2002/06/05 16:08:07 markus Exp $
2.\" 2.\"
3.\" Author: Tatu Ylonen <ylo@cs.hut.fi> 3.\" Author: Tatu Ylonen <ylo@cs.hut.fi>
4.\" Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4.\" Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -42,6 +42,7 @@
42.Nd authentication agent 42.Nd authentication agent
43.Sh SYNOPSIS 43.Sh SYNOPSIS
44.Nm ssh-agent 44.Nm ssh-agent
45.Op Fl a Ar bind_address
45.Op Fl c Li | Fl s 46.Op Fl c Li | Fl s
46.Op Fl d 47.Op Fl d
47.Op Ar command Op Ar args ... 48.Op Ar command Op Ar args ...
@@ -64,6 +65,11 @@ machines using
64.Pp 65.Pp
65The options are as follows: 66The options are as follows:
66.Bl -tag -width Ds 67.Bl -tag -width Ds
68.It Fl a Ar bind_address
69Bind the agent to the unix-domain socket
70.Ar bind_address .
71The default is
72.Pa /tmp/ssh-XXXXXXXX/agent.<pid> .
67.It Fl c 73.It Fl c
68Generate C-shell commands on 74Generate C-shell commands on
69.Dv stdout . 75.Dv stdout .
@@ -135,7 +141,6 @@ by the agent, and the result will be returned to the requester.
135This way, private keys are not exposed to clients using the agent. 141This way, private keys are not exposed to clients using the agent.
136.Pp 142.Pp
137A unix-domain socket is created 143A unix-domain socket is created
138.Pq Pa /tmp/ssh-XXXXXXXX/agent.<pid> ,
139and the name of this socket is stored in the 144and the name of this socket is stored in the
140.Ev SSH_AUTH_SOCK 145.Ev SSH_AUTH_SOCK
141environment 146environment
diff --git a/ssh-agent.c b/ssh-agent.c
index 33596c47a..d3321478b 100644
--- a/ssh-agent.c
+++ b/ssh-agent.c
@@ -35,7 +35,7 @@
35 35
36#include "includes.h" 36#include "includes.h"
37#include "openbsd-compat/fake-queue.h" 37#include "openbsd-compat/fake-queue.h"
38RCSID("$OpenBSD: ssh-agent.c,v 1.85 2002/04/02 11:49:39 markus Exp $"); 38RCSID("$OpenBSD: ssh-agent.c,v 1.86 2002/06/05 16:08:07 markus Exp $");
39 39
40#include <openssl/evp.h> 40#include <openssl/evp.h>
41#include <openssl/md5.h> 41#include <openssl/md5.h>
@@ -803,6 +803,7 @@ usage(void)
803 fprintf(stderr, " -s Generate Bourne shell commands on stdout.\n"); 803 fprintf(stderr, " -s Generate Bourne shell commands on stdout.\n");
804 fprintf(stderr, " -k Kill the current agent.\n"); 804 fprintf(stderr, " -k Kill the current agent.\n");
805 fprintf(stderr, " -d Debug mode.\n"); 805 fprintf(stderr, " -d Debug mode.\n");
806 fprintf(stderr, " -a socket Bind agent socket to given name.\n");
806 exit(1); 807 exit(1);
807} 808}
808 809
@@ -819,6 +820,7 @@ main(int ac, char **av)
819#endif 820#endif
820 pid_t pid; 821 pid_t pid;
821 char *shell, *format, *pidstr, pidstrbuf[1 + 3 * sizeof pid]; 822 char *shell, *format, *pidstr, pidstrbuf[1 + 3 * sizeof pid];
823 char *agentsocket = NULL;
822 extern int optind; 824 extern int optind;
823 fd_set *readsetp = NULL, *writesetp = NULL; 825 fd_set *readsetp = NULL, *writesetp = NULL;
824 826
@@ -829,9 +831,9 @@ main(int ac, char **av)
829 seed_rng(); 831 seed_rng();
830 832
831#ifdef __GNU_LIBRARY__ 833#ifdef __GNU_LIBRARY__
832 while ((ch = getopt(ac, av, "+cdks")) != -1) { 834 while ((ch = getopt(ac, av, "+cdksa:")) != -1) {
833#else /* __GNU_LIBRARY__ */ 835#else /* __GNU_LIBRARY__ */
834 while ((ch = getopt(ac, av, "cdks")) != -1) { 836 while ((ch = getopt(ac, av, "cdksa:")) != -1) {
835#endif /* __GNU_LIBRARY__ */ 837#endif /* __GNU_LIBRARY__ */
836 switch (ch) { 838 switch (ch) {
837 case 'c': 839 case 'c':
@@ -852,6 +854,9 @@ main(int ac, char **av)
852 usage(); 854 usage();
853 d_flag++; 855 d_flag++;
854 break; 856 break;
857 case 'a':
858 agentsocket = optarg;
859 break;
855 default: 860 default:
856 usage(); 861 usage();
857 } 862 }
@@ -892,14 +897,20 @@ main(int ac, char **av)
892 } 897 }
893 parent_pid = getpid(); 898 parent_pid = getpid();
894 899
895 /* Create private directory for agent socket */ 900 if (agentsocket == NULL) {
896 strlcpy(socket_dir, "/tmp/ssh-XXXXXXXX", sizeof socket_dir); 901 /* Create private directory for agent socket */
897 if (mkdtemp(socket_dir) == NULL) { 902 strlcpy(socket_dir, "/tmp/ssh-XXXXXXXX", sizeof socket_dir);
898 perror("mkdtemp: private socket dir"); 903 if (mkdtemp(socket_dir) == NULL) {
899 exit(1); 904 perror("mkdtemp: private socket dir");
905 exit(1);
906 }
907 snprintf(socket_name, sizeof socket_name, "%s/agent.%d", socket_dir,
908 parent_pid);
909 } else {
910 /* Try to use specified agent socket */
911 socket_dir[0] = '\0';
912 strlcpy(socket_name, agentsocket, sizeof socket_name);
900 } 913 }
901 snprintf(socket_name, sizeof socket_name, "%s/agent.%d", socket_dir,
902 parent_pid);
903 914
904 /* 915 /*
905 * Create socket early so it will exist before command gets run from 916 * Create socket early so it will exist before command gets run from