Skip to content

Latest commit

 

History

History
349 lines (231 loc) · 11.3 KB

v1.md

File metadata and controls

349 lines (231 loc) · 11.3 KB

title: Authentication service over TCP abbrev: I-D docname: credid date: 2017-09-25 category: info ipr: trust200902

author:

ins: A. Poulet
name: Arthur Poulet
organization: University of Kent
email: [email protected]

normative: RFC2119:

informative: rfc7159:

--- abstract

This standard aims to create a modern, secure and simple user authentication, management, and verification of her permissions on arbitrary resources in an organisation.

--- middle

Introduction

Terminology

In this document, the key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" are to be interpreted as described in BCP 14, RFC 2119 {{RFC2119}}.

  • Client: A TCP endpoint that MUST connect to the Credid service.
  • Server: A TCP endpoint that MUST receive connection from clients.
  • Secure client: A client connected using SSL.
  • Secure server: A server using SSL.
  • Query: Messages sent to the server by the client.
  • Reply: Messages returned after a query from the server to the client.
  • Option: optionnal parameter of a query on the format KEY=VALUE.
  • Resource: something manageable with the service (a path or a command for example).
  • Group: a role attributed to some users that have permissions over some resources.
  • Permission: level of confidence of a role that allow it to do something (write or read) on a resource.

Goals

Nowadays, it is very common to require an authentication system to develop a software. It allows the software to identify users, authorize them to do some actions, and log it. It is a critical security issue because any error in the authentication policy or implementation costs money, trust, and privacy. Furthermore, it is very interesting for some parties to have a centralized authentication system shared for several services.

The goal of the Credid protocol and services is to provide a clear, secure, and simple authentication interface and authorization manager. It is implemented with a TCP server that SHOULD provide a SSL connection, on which a user must be able to authenticate, and request access to a resource.

The Credid service does not intend to replace security check on the services that use it. It is an annular similar to the LDAP services, but using a much simpler query language and installation.

Services

The Credid service provides several features:

  • Authentication: An user can proove his identity to the server using a password.
  • Group based attributions: Users have groups.
  • Permissions management: The resources are attributed to the groups with a level (read or write).

Authentication

The users MUST BE identified using a couple username and password. The only operation that can be done by an unauthenticated client SHOULD be to authenticate himself to the server as a valid user. Other ways to by identified COULD be added (such as biometrics, etc.) based on the level of security required by the system. Several identification's ways COULD be combined togethers to improve the level of security.

Group based attributions

Users CAN be affected to one or several groups. An user SHOULD NOT be affected twice to the same group.

Permissions management

The groups MUST have a list of permissions. A permission MUST be a couple of resource (path or command for example) and right (write or read for example).

Protocol Overview

Message exchanges

A client MUST send a query to the server. The server MUST always respond with a reply. The server MUST NOT send messages to the client except to reply. The server CAN use another communication channel to send non-reply messages to the client.

Syntax of the queries

Queries MUST follow the grammar defined bellow:

WORD_ANY     = <any alphanumeric ASCII character> / "_" / "-"
WORD         = WORD_ANY WORD_ANY *
ANY          = <any unicode character>
ANY_STR      = ANY ANY *
SPACE        = <ASCII SP, space>

OPTION       = WORD "=" WORD
PARAMETERS   = ( WORD SPACE ) * ( ANY_STR ) ?
QUERY_WORDS  = ( OPTION ) * WORD SPACE ( WORD SPACE / OPTION ) *
QUERY        = QUERY_WORDS ( ":" PARAMETERS ) ?

JSON         = <Json object, defined in RFC7159> / "\"" ANY_STR "\""
SUCCESS      = "success"
FAILURE      = "failure"
SUCCESS_DATA = ( SPACE JSON ) ?
FAILURE_DATA = ( SPACE ANY * ) ?
REPLY        = ( SUCCESS SUCCESS_DATA / FAILURE FAILURE_DATA )

Special characters

There are some special characters that MUST have a special behaviour in the server:

  • *: it MUST match with "any string". It is for the query USER HAS ACCESS TO and USER GET PERM. Example: if a path /public* is defined, USER HAS ACCESS TO : user /public/any must matches.
  • $: it MUST match with "any word", with the same behaviour than *
  • ~: it MUST be replaced with the username of the current authenticated user when matching queries. Example: /public/~/* for the user "root" is equal to /public/root/*.
  • \a: it SHOULD be replaced with the username of the current authenticated user when writing the query.

Options

Some queries can be parametrized via OPTIONS. Options are defined by a couple KEY=VALUE. The key defines which option is concerned, and the value which value it must take.

COUNT

The option COUNT defines an amount of data to retreive. The value of this option is a unsigned 64 bits number.

  • Minimum: 0
  • Maximum: 18446744073709551615
  • Default: 100

Example: USER LIST COUNT=1 to retreive one user maximum.

PAGE

The option PAGE defines an offset of data. It is multiplicated with the option COUNT to find the first data to retreive. The value of this operation is a unsigned 64 bits number.

  • Minimum: 0
  • Maximum: 18446744073709551615
  • Default: 0

Example: USER LIST PAGE=2 COUNT=10 to retreive maximum 10 users, beginning from the 21th.

Queries

Type of queries

There are 3 types of query defined in this standard: AUTH, USER, GROUP. They begin with the associated word. Other queries MAY be added to extend the language but they MUST NOT begin with AUTH, USER, or GROUP (they are reserved).

Replies

The replies contain the word "success" or "failure", and MAY be followed by a json data.

There are 3 types replies possible:

  1. Boolean: either "success" or "failure". A failure MAY not be an error of syntax or connection.
  2. None: "success" or "failure". A failure MUST be an error of syntax or connection.
  3. Specified: other replies MAY be a failure (like None) but the "success" reply is followed by more data.

Failure

If the query fails, a string that describes the problem MAY also be added. There are 3 reasons of failures:

  1. The client is not connected (no previous AUTH or AUTH TOKEN query has been successful or the user has been disconnected for some reasons).
  2. The query contains an error (missing : for example).
  3. The client does not have the right permissions to execute the query.

Success

If the query returns a success, it is sometimes followed by a Json object, for the read operations (such as USER LIST, etc.).

Queries descriptions

Parameters CAN be optional or mandatory. Optional parameters are written <param>. Mandatory parameters are written [param].

AUTH

Query: AUTH

Parameters: <username> <password>

Replies: Boolean

Example: AUTH : root toor

Description: Authenticate the user based on his username and his secret (password).

AUTH TOKEN

Query: AUTH TOKEN

Parameters: <username> <token>

Replies: Boolean

Example: AUTH TOKEN : root 0123456789abcdef

Description: Authenticate the user based on his username and a temporary secret generated by the server.

GEN TOKEN

Query: GEN TOKEN

Parameters: None

Replies: String

Example: GEN TOKEN

Description: Generate a temporary secret that can be used by the user to authenticate. It erase any older token (that are no longer usable). It doesn't disconnect the connected users. It is useful to avoid to use a high cost hashing function to protect the password. We RECOMMAND to make it valid for 10 minutes, but it depends on the security level required.

USER HAS ACCESS TO

Query: USER HAS ACCESS TO

Parameters: <username> <perm> <resource>

Replies: Boolean

Example: USER HAS ACCESS TO : root write https://url/some/path

GROUP ADD

Query: GROUP ADD

Parameters: <group> [perm] [resource]

Replies: None

Description: Create a group, and/or add the resource to an existing group.

Example: GROUP ADD : guest

Example: GROUP ADD : guest read /public*

GROUP REMOVE

Query: GROUP REMOVE

Parameters: <group> [resource]

Replies: None

Description: It MUST delete all permissions of a group on a given resource or the one specified. A group with no permissions SHOULD NOT exist (nor any relation with such group).

Example: GROUP REMOVE : guest

Example: GROUP REMOVE : guest *

GROUP LIST

Query: GROUP LIST

Replies: an array of groups, quoted success ["root", "admin"]

Example: `GROUP LIST

GROUP LIST PERMS

Query: GROUP LIST PERMS

Parameters: <group>

Replies: an associated array of resources and rights success {"/private" => "write", "/public" => "read"}

Example: GROUP LIST PERMS : guest

GROUP GET PERM

Query: GROUP GET PERM

Parameters: <group> <resource>

Reply: a right (permission value) quoted success "write"

Example: GROUP GET PERM : guest /public/some

Example: GROUP GET PERM : guest /private/some

USER LIST

Query: USER LIST

Replies: an array of users, quoted success ["root", "guest"]

Example: USER LIST

USER ADD

Query: USER ADD

Parameters: <username> <password>

Replies: None

Example: USER ADD : guestuser guestpassword

USER REMOVE

Query: USER REMOVE

Parameters: <username>

Replies: None

Description: Removes permanently an user from the server. It MUST disconnect the client using the deleted user for security reason.

Example: USER REMOVE guestuser

USER ADD GROUP

Query: USER ADD GROUP

Parameters: <username> <group>

Replies: None

Example: USER ADD GROUP : guestuser guest

USER REMOVE GROUP

Query: USER REMOVE GROUP

Parameters: <username> <group>

Replies: None

Example: USER REMOVE GROUP : guestuser guest

USER LIST GROUPS

Query: USER LIST GROUPS

Parameters: <username>

Replies: an array of groups, quoted success ["root", "admin"]

Example: USER LIST GROUPS : guestuser

USER CHANGE PASSWORD

Query: USER CHANGE PASSWORD

Parameters: <username> <newpassword>

Replies: None

Description: Change the password of a user. It SHOULD disconnect the client using the updated user for security reason.

Example: USER CHANGE PASSWORD : guest newguestpassword

Permissions

Any connected user can send queries to the server, which MUST respond with "success" or "failure". It might be a "failure" because the user might not have the correct rights on the server.

When the server receive a query from a connected user, it MUST verify if the user has access to this query.

We RECOMMEND to manage the permissions by verifying that the user has access to the resource equal to the query with "write". Thus the server whould execute a operation very similar to "USER AS ACCESS TO : connected_user_name QUERY".

Logs

For security reasons, any query/reply status SHOULD BE logged by the server. The format of the logs is not defined in this RFC. A text version of the logs SHOULD BE provided. A binary version of the logs COULD be provided.