diff options
author | Manoj Srivastava <srivasta@debian.org> | 2014-02-09 16:09:49 +0000 |
---|---|---|
committer | Colin Watson <cjwatson@debian.org> | 2017-10-04 13:54:48 +0100 |
commit | 4b276122c04aed0726803a92c8ca955e614a4d3a (patch) | |
tree | 5c5638fad9f6edf9ada6a4661f6c5cbb1bec2696 /auth2.c | |
parent | cdd9076a145a95c21538eedb3f728a897480c5de (diff) |
Handle SELinux authorisation roles
Rejected upstream due to discomfort with magic usernames; a better approach
will need an SSH protocol change. In the meantime, this came from Debian's
SELinux maintainer, so we'll keep it until we have something better.
Bug: https://bugzilla.mindrot.org/show_bug.cgi?id=1641
Bug-Debian: http://bugs.debian.org/394795
Last-Update: 2017-10-04
Patch-Name: selinux-role.patch
Diffstat (limited to 'auth2.c')
-rw-r--r-- | auth2.c | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -221,7 +221,7 @@ input_userauth_request(int type, u_int32_t seq, struct ssh *ssh) | |||
221 | { | 221 | { |
222 | Authctxt *authctxt = ssh->authctxt; | 222 | Authctxt *authctxt = ssh->authctxt; |
223 | Authmethod *m = NULL; | 223 | Authmethod *m = NULL; |
224 | char *user, *service, *method, *style = NULL; | 224 | char *user, *service, *method, *style = NULL, *role = NULL; |
225 | int authenticated = 0; | 225 | int authenticated = 0; |
226 | 226 | ||
227 | if (authctxt == NULL) | 227 | if (authctxt == NULL) |
@@ -233,8 +233,13 @@ input_userauth_request(int type, u_int32_t seq, struct ssh *ssh) | |||
233 | debug("userauth-request for user %s service %s method %s", user, service, method); | 233 | debug("userauth-request for user %s service %s method %s", user, service, method); |
234 | debug("attempt %d failures %d", authctxt->attempt, authctxt->failures); | 234 | debug("attempt %d failures %d", authctxt->attempt, authctxt->failures); |
235 | 235 | ||
236 | if ((role = strchr(user, '/')) != NULL) | ||
237 | *role++ = 0; | ||
238 | |||
236 | if ((style = strchr(user, ':')) != NULL) | 239 | if ((style = strchr(user, ':')) != NULL) |
237 | *style++ = 0; | 240 | *style++ = 0; |
241 | else if (role && (style = strchr(role, ':')) != NULL) | ||
242 | *style++ = '\0'; | ||
238 | 243 | ||
239 | if (authctxt->attempt++ == 0) { | 244 | if (authctxt->attempt++ == 0) { |
240 | /* setup auth context */ | 245 | /* setup auth context */ |
@@ -261,8 +266,9 @@ input_userauth_request(int type, u_int32_t seq, struct ssh *ssh) | |||
261 | use_privsep ? " [net]" : ""); | 266 | use_privsep ? " [net]" : ""); |
262 | authctxt->service = xstrdup(service); | 267 | authctxt->service = xstrdup(service); |
263 | authctxt->style = style ? xstrdup(style) : NULL; | 268 | authctxt->style = style ? xstrdup(style) : NULL; |
269 | authctxt->role = role ? xstrdup(role) : NULL; | ||
264 | if (use_privsep) | 270 | if (use_privsep) |
265 | mm_inform_authserv(service, style); | 271 | mm_inform_authserv(service, style, role); |
266 | userauth_banner(); | 272 | userauth_banner(); |
267 | if (auth2_setup_methods_lists(authctxt) != 0) | 273 | if (auth2_setup_methods_lists(authctxt) != 0) |
268 | packet_disconnect("no authentication methods enabled"); | 274 | packet_disconnect("no authentication methods enabled"); |