A windows service for synchronizing Active Directory users and groups with Gogs.
Download the latest release. Then you can run GogsActiveDirectorySync.exe
directly as a console application, or install it as a windows service:
GogsActiveDirectorySync.exe install
The Topshelf library is used to make this run as a windows service. So see the Topshelf commandline documentation for more details.
The configuration for this thing is in GogsActiveDirectorySync.exe.config. There's also NLog configuration in the NLog.config.
Some AppSettings you'll probably want to change:
SyncIntervalHours
: How often the sync runsMinimumTimeOfDay
,MaximumTimeOfDay
: Can be used to make sure the sync only runs at night (or any interval you want)GogsApiUrl
: The URL to your Gogs installation's API (likehttps://try.gogs.io/api/v1/
)GogsUsername
: An Gogs user with enough permissions to create users and organizationsGogsPassword
: Set this if you want to use password authentication with the Gogs APIGogsAccessToken
: Set this if you want to use token authentication with the Gogs API
There's more of these, but I'm tired of writing about them in this readme that no one will read. There may be more comments about them in AppConfiguration.cs.
Outside of those AppSettings, there's also a custom groupNameMappings
section. This determines how things will be mapped from Active Directory to Gogs. Example:
<groupNameMappings>
<mapping activeDirectoryGroupName="Development" gogsOrgName="Dev" />
</groupNameMappings>
You need an entry in there for every Active Directory group you want to have synchronized with a Gogs organization.