项目作者: ps78674

项目描述 :
This code is based on nss_http by @gmjosack.
高级语言: C
项目地址: git://github.com/ps78674/libnss-http.git
创建时间: 2020-01-23T15:45:03Z
项目社区:https://github.com/ps78674/libnss-http

开源协议:

下载


NSS module for rest/http auth.

Configuration

/etc/nsswitch.conf:

  1. passwd: compat http
  2. group: compat http
  3. shadow: compat http

/etc/nss_http.conf:

  1. HTTPSERVER=https://<API_SERVER>/api/nss
  2. TIMEOUT=3
  3. #DEBUG=true

Endpoints

/passwd

  1. [
  2. {
  3. "pw_name": "iivanov",
  4. "pw_passwd": "x",
  5. "pw_uid": 1111,
  6. "pw_gid": 2222,
  7. "pw_gecos": "Ivan Ivanov",
  8. "pw_dir": "/home/iivanov",
  9. "pw_shell": "/bin/bash"
  10. }
  11. ]

The passwd endpoint should expect to receive 1 of 2 mutually exclusive query parameters. name, containing a username or uid containing a user id. If either of these query parameters are received, a single object should be returned for the requested username/uid.

/shadow

  1. [
  2. {
  3. "sp_namp": "iivanov",
  4. "sp_pwdp": "0000000000000000000000000000000000000000000000000000000",
  5. "sp_lstchg": 12345,
  6. "sp_min": 0,
  7. "sp_max": 99999,
  8. "sp_warn": 7,
  9. "sp_inact": null,
  10. "sp_expire": null,
  11. "sp_flag": null
  12. }
  13. ]

The shadow endpoint should expect to receive a query parameter of name, containing a username. If this query parameter is received, a single object should be returned for the requested username.

/group

  1. [
  2. {
  3. "gr_name": "admins",
  4. "gr_passwd": "x",
  5. "gr_gid": 3333,
  6. "gr_mem": [
  7. "iivanov"
  8. ]
  9. }
  10. ]

The group endpoint should expect to receive 1 of 2 mutually exclusive query parameters. name, containing a username or gid containing a group id. If either of these query parameters are received, a single object should be returned for the requested groupname/gid.

Sources

https://github.com/gmjosack/nss_http
https://github.com/json-c/json-c
https://curl.haxx.se/libcurl/c/