summaryrefslogtreecommitdiff
path: root/monitor.c
diff options
context:
space:
mode:
Diffstat (limited to 'monitor.c')
-rw-r--r--monitor.c58
1 files changed, 58 insertions, 0 deletions
diff --git a/monitor.c b/monitor.c
index e6f648b0b..57d2c376c 100644
--- a/monitor.c
+++ b/monitor.c
@@ -141,6 +141,7 @@ int mm_answer_gss_setup_ctx(int, Buffer *);
141int mm_answer_gss_accept_ctx(int, Buffer *); 141int mm_answer_gss_accept_ctx(int, Buffer *);
142int mm_answer_gss_userok(int, Buffer *); 142int mm_answer_gss_userok(int, Buffer *);
143int mm_answer_gss_checkmic(int, Buffer *); 143int mm_answer_gss_checkmic(int, Buffer *);
144int mm_answer_gss_sign(int, Buffer *);
144#endif 145#endif
145 146
146#ifdef SSH_AUDIT_EVENTS 147#ifdef SSH_AUDIT_EVENTS
@@ -209,11 +210,17 @@ struct mon_table mon_dispatch_proto20[] = {
209 {MONITOR_REQ_GSSSTEP, MON_ISAUTH, mm_answer_gss_accept_ctx}, 210 {MONITOR_REQ_GSSSTEP, MON_ISAUTH, mm_answer_gss_accept_ctx},
210 {MONITOR_REQ_GSSUSEROK, MON_AUTH, mm_answer_gss_userok}, 211 {MONITOR_REQ_GSSUSEROK, MON_AUTH, mm_answer_gss_userok},
211 {MONITOR_REQ_GSSCHECKMIC, MON_ISAUTH, mm_answer_gss_checkmic}, 212 {MONITOR_REQ_GSSCHECKMIC, MON_ISAUTH, mm_answer_gss_checkmic},
213 {MONITOR_REQ_GSSSIGN, MON_ONCE, mm_answer_gss_sign},
212#endif 214#endif
213 {0, 0, NULL} 215 {0, 0, NULL}
214}; 216};
215 217
216struct mon_table mon_dispatch_postauth20[] = { 218struct mon_table mon_dispatch_postauth20[] = {
219#ifdef GSSAPI
220 {MONITOR_REQ_GSSSETUP, 0, mm_answer_gss_setup_ctx},
221 {MONITOR_REQ_GSSSTEP, 0, mm_answer_gss_accept_ctx},
222 {MONITOR_REQ_GSSSIGN, 0, mm_answer_gss_sign},
223#endif
217 {MONITOR_REQ_MODULI, 0, mm_answer_moduli}, 224 {MONITOR_REQ_MODULI, 0, mm_answer_moduli},
218 {MONITOR_REQ_SIGN, 0, mm_answer_sign}, 225 {MONITOR_REQ_SIGN, 0, mm_answer_sign},
219 {MONITOR_REQ_PTY, 0, mm_answer_pty}, 226 {MONITOR_REQ_PTY, 0, mm_answer_pty},
@@ -318,6 +325,10 @@ monitor_child_preauth(Authctxt *_authctxt, struct monitor *pmonitor)
318 /* Permit requests for moduli and signatures */ 325 /* Permit requests for moduli and signatures */
319 monitor_permit(mon_dispatch, MONITOR_REQ_MODULI, 1); 326 monitor_permit(mon_dispatch, MONITOR_REQ_MODULI, 1);
320 monitor_permit(mon_dispatch, MONITOR_REQ_SIGN, 1); 327 monitor_permit(mon_dispatch, MONITOR_REQ_SIGN, 1);
328#ifdef GSSAPI
329 /* and for the GSSAPI key exchange */
330 monitor_permit(mon_dispatch, MONITOR_REQ_GSSSETUP, 1);
331#endif
321 } else { 332 } else {
322 mon_dispatch = mon_dispatch_proto15; 333 mon_dispatch = mon_dispatch_proto15;
323 334
@@ -391,6 +402,10 @@ monitor_child_postauth(struct monitor *pmonitor)
391 monitor_permit(mon_dispatch, MONITOR_REQ_MODULI, 1); 402 monitor_permit(mon_dispatch, MONITOR_REQ_MODULI, 1);
392 monitor_permit(mon_dispatch, MONITOR_REQ_SIGN, 1); 403 monitor_permit(mon_dispatch, MONITOR_REQ_SIGN, 1);
393 monitor_permit(mon_dispatch, MONITOR_REQ_TERM, 1); 404 monitor_permit(mon_dispatch, MONITOR_REQ_TERM, 1);
405#ifdef GSSAPI
406 /* and for the GSSAPI key exchange */
407 monitor_permit(mon_dispatch, MONITOR_REQ_GSSSETUP, 1);
408#endif
394 } else { 409 } else {
395 mon_dispatch = mon_dispatch_postauth15; 410 mon_dispatch = mon_dispatch_postauth15;
396 monitor_permit(mon_dispatch, MONITOR_REQ_TERM, 1); 411 monitor_permit(mon_dispatch, MONITOR_REQ_TERM, 1);
@@ -1621,6 +1636,10 @@ mm_get_kex(Buffer *m)
1621 kex->kex[KEX_DH_GRP1_SHA1] = kexdh_server; 1636 kex->kex[KEX_DH_GRP1_SHA1] = kexdh_server;
1622 kex->kex[KEX_DH_GRP14_SHA1] = kexdh_server; 1637 kex->kex[KEX_DH_GRP14_SHA1] = kexdh_server;
1623 kex->kex[KEX_DH_GEX_SHA1] = kexgex_server; 1638 kex->kex[KEX_DH_GEX_SHA1] = kexgex_server;
1639#ifdef GSSAPI
1640 kex->kex[KEX_GSS_GRP1_SHA1] = kexgss_server;
1641 kex->kex[KEX_GSS_GEX_SHA1] = kexgss_server;
1642#endif
1624 kex->server = 1; 1643 kex->server = 1;
1625 kex->hostkey_type = buffer_get_int(m); 1644 kex->hostkey_type = buffer_get_int(m);
1626 kex->kex_type = buffer_get_int(m); 1645 kex->kex_type = buffer_get_int(m);
@@ -1863,6 +1882,7 @@ mm_answer_gss_accept_ctx(int sock, Buffer *m)
1863 monitor_permit(mon_dispatch, MONITOR_REQ_GSSSTEP, 0); 1882 monitor_permit(mon_dispatch, MONITOR_REQ_GSSSTEP, 0);
1864 monitor_permit(mon_dispatch, MONITOR_REQ_GSSUSEROK, 1); 1883 monitor_permit(mon_dispatch, MONITOR_REQ_GSSUSEROK, 1);
1865 monitor_permit(mon_dispatch, MONITOR_REQ_GSSCHECKMIC, 1); 1884 monitor_permit(mon_dispatch, MONITOR_REQ_GSSCHECKMIC, 1);
1885 monitor_permit(mon_dispatch, MONITOR_REQ_GSSSIGN, 1);
1866 } 1886 }
1867 return (0); 1887 return (0);
1868} 1888}
@@ -1913,4 +1933,42 @@ mm_answer_gss_userok(int sock, Buffer *m)
1913 /* Monitor loop will terminate if authenticated */ 1933 /* Monitor loop will terminate if authenticated */
1914 return (authenticated); 1934 return (authenticated);
1915} 1935}
1936
1937int
1938mm_answer_gss_sign(int socket, Buffer *m)
1939{
1940 gss_buffer_desc data;
1941 gss_buffer_desc hash = GSS_C_EMPTY_BUFFER;
1942 OM_uint32 major, minor;
1943 u_int len;
1944
1945 data.value = buffer_get_string(m, &len);
1946 data.length = len;
1947 if (data.length != 20)
1948 fatal("%s: data length incorrect: %d", __func__, data.length);
1949
1950 /* Save the session ID on the first time around */
1951 if (session_id2_len == 0) {
1952 session_id2_len = data.length;
1953 session_id2 = xmalloc(session_id2_len);
1954 memcpy(session_id2, data.value, session_id2_len);
1955 }
1956 major = ssh_gssapi_sign(gsscontext, &data, &hash);
1957
1958 xfree(data.value);
1959
1960 buffer_clear(m);
1961 buffer_put_int(m, major);
1962 buffer_put_string(m, hash.value, hash.length);
1963
1964 mm_request_send(socket, MONITOR_ANS_GSSSIGN, m);
1965
1966 gss_release_buffer(&minor, &hash);
1967
1968 /* Turn on getpwnam permissions */
1969 monitor_permit(mon_dispatch, MONITOR_REQ_PWNAM, 1);
1970
1971 return (0);
1972}
1973
1916#endif /* GSSAPI */ 1974#endif /* GSSAPI */