FusionForge

Difference between revisions of "User accounts"

From FusionForge Wiki
Jump to: navigation, search
(tag)
(Precisions)
Line 9: Line 9:
 
FusionForge's security model is based directly on the Linux kernel, using POSIX user accounts (privilege separation).
 
FusionForge's security model is based directly on the Linux kernel, using POSIX user accounts (privilege separation).
  
This is done via libnss-pgsql, which automatically maps a shell account for each user in the PostgreSQL database, if they are part of a project.
+
This is done via <code>libnss-pgsql</code>, which automatically maps a shell account for each user in the PostgreSQL database, if they are part of a project.
  
 
User can then securely access their repository via SSH keys, and login to manage their webpages area. If full login is not desirable, it is also possible to install a restricted shell such as <code>rssh</code> to limit shell access to e.g. Git, SVN and SFTP only.
 
User can then securely access their repository via SSH keys, and login to manage their webpages area. If full login is not desirable, it is also possible to install a restricted shell such as <code>rssh</code> to limit shell access to e.g. Git, SVN and SFTP only.
Line 27: Line 27:
  
 
This means project members can install custom repository hooks and run them securely.
 
This means project members can install custom repository hooks and run them securely.
 +
 +
Apache doesn't use the database because modules aren't easily available in all distros. Instead, FusionForge automatically generates:
 +
* <code>/var/lib/fusionforge/scm-passwd</code>: users and hashed password using .htpasswd format
 +
* <code>/var/lib/fusionforge/scm-auth.inc</code>: declares valid users with repo access (e.g. Git)
 +
* <code>/var/lib/fusionforge/scmsvn-auth.inc</code>: additional declaration for SVN access due to mod_svn idiosyncrasies
 +
 +
FusionForge's daemon, fusionforge-systasksd, automatically regenerates the files and reloads Apache, when new users and groups are added or removed, so that repository access is immediately active.
  
 
= nscd =
 
= nscd =
  
NSCD is the Name Service Cache Daemon. It is used to cache database results for users and groups mapping, for performances reasons.  Also, for libnss-pgsql, it's necessary to install it, to fix an authentication loop when the database is installed on the same server as the shell server.
+
NSCD is the Name Service Cache Daemon. It is used to cache database results for users and groups mapping, for performances reasons.  In the case of <code>libnss-pgsql</code>, it's necessary to install <code>nscd</code>, to fix an authentication loop when the database is installed on the same server as the shell server.
 +
 
 +
NSCD is provided either by <code>nscd</code> (part of <code>glibc</code>), or <code>unscd</code>, which is lighter and protects against bugs in NSS modules.
  
 
FusionForge's daemon, <code>fusionforge-systasksd</code>, automatically clears <code>nscd</code>'s cache when new users and groups are added or removed, so that shell accounts are immediately active.
 
FusionForge's daemon, <code>fusionforge-systasksd</code>, automatically clears <code>nscd</code>'s cache when new users and groups are added or removed, so that shell accounts are immediately active.
 +
 +
= Database schema =
 +
 +
You shouldn't need to into the details, but in case you need to plug an additional component to the NSS database, here's some information.
 +
 +
Users and groups are mapped on the system as soon as they match the following criteria:
 +
* users: active, member of a project
 +
* groups: approved
 +
 +
When they do, they are added to the nss_* tables:
 +
* <code>nss_passwd</code> (view) : user accounts
 +
* <code>nss_shadow</code> (view) : generally unused, available if you have precise password-authentication needs
 +
* <code>nss_groups</code> (table) : groups for projects
 +
* <code>nss_usergroups</code> (table) : groups membership
 +
 +
See <code>/etc/nss-pgsql.conf</code> for the basic SQL queries.
  
 
[[Category:Admin documentation]]
 
[[Category:Admin documentation]]

Revision as of 10:10, 22 September 2015

On the web front-end

Users are usually registered using a traditional login + password + verified e-mail address combo.

Numerous Plugins also exist to provide external authentication, e.g. via LDAP or CAS.

Shell accounts

FusionForge's security model is based directly on the Linux kernel, using POSIX user accounts (privilege separation).

This is done via libnss-pgsql, which automatically maps a shell account for each user in the PostgreSQL database, if they are part of a project.

User can then securely access their repository via SSH keys, and login to manage their webpages area. If full login is not desirable, it is also possible to install a restricted shell such as rssh to limit shell access to e.g. Git, SVN and SFTP only.

Each project is similarly mapped to 3 POSIX groups:

  • projectname : access to group directory, including webpages
  • projectname_scmro : read-only access to source repositories
  • projectname_scmrw : read/write access to source repositories

User accounts have appropriate group memberships so they can only access projects depending on the RBAC permissions.

Important: users and groups are not created (i.e. no useradd) - they are directly mapped to the database through libnss-pgsql.

Web access to repositories

When accessing repositories though HTTPS, FusionForge uses mpm-itk, an Apache module, so that each Apache process is run using the matching shell account, with appropriate groups membership.

This means project members can install custom repository hooks and run them securely.

Apache doesn't use the database because modules aren't easily available in all distros. Instead, FusionForge automatically generates:

  • /var/lib/fusionforge/scm-passwd: users and hashed password using .htpasswd format
  • /var/lib/fusionforge/scm-auth.inc: declares valid users with repo access (e.g. Git)
  • /var/lib/fusionforge/scmsvn-auth.inc: additional declaration for SVN access due to mod_svn idiosyncrasies

FusionForge's daemon, fusionforge-systasksd, automatically regenerates the files and reloads Apache, when new users and groups are added or removed, so that repository access is immediately active.

nscd

NSCD is the Name Service Cache Daemon. It is used to cache database results for users and groups mapping, for performances reasons. In the case of libnss-pgsql, it's necessary to install nscd, to fix an authentication loop when the database is installed on the same server as the shell server.

NSCD is provided either by nscd (part of glibc), or unscd, which is lighter and protects against bugs in NSS modules.

FusionForge's daemon, fusionforge-systasksd, automatically clears nscd's cache when new users and groups are added or removed, so that shell accounts are immediately active.

Database schema

You shouldn't need to into the details, but in case you need to plug an additional component to the NSS database, here's some information.

Users and groups are mapped on the system as soon as they match the following criteria:

  • users: active, member of a project
  • groups: approved

When they do, they are added to the nss_* tables:

  • nss_passwd (view) : user accounts
  • nss_shadow (view) : generally unused, available if you have precise password-authentication needs
  • nss_groups (table) : groups for projects
  • nss_usergroups (table) : groups membership

See /etc/nss-pgsql.conf for the basic SQL queries.