pg-ldap-sync 0.5.1 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/.github/workflows/ci.yml +2 -2
- data/.standard.yml +1 -0
- data/CHANGELOG.md +8 -0
- data/README.md +24 -16
- data/Rakefile +1 -1
- data/config/sample-config.yaml +2 -2
- data/config/sample-config2.yaml +2 -2
- data/config/schema.yaml +73 -69
- data/exe/pg_ldap_sync +1 -1
- data/lib/pg_ldap_sync/application.rb +346 -340
- data/lib/pg_ldap_sync/compat.rb +7 -5
- data/lib/pg_ldap_sync/logger.rb +20 -20
- data/lib/pg_ldap_sync/version.rb +1 -1
- data/lib/pg_ldap_sync.rb +1 -1
- data/pg-ldap-sync.gemspec +12 -13
- data.tar.gz.sig +0 -0
- metadata +24 -37
- metadata.gz.sig +1 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0d2b110ac0eeff29e7a02739a4756afd30b38436b9c2387da186f0be4b0841d5
|
4
|
+
data.tar.gz: b371cb0096dfa5762d794f49ec955c30e55fee908e0b01861f9806e8c5d85e61
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f0643dba267c51ceef5c3c5efbd3db17c7a63622573b6ae33d39d6fec254b80b160fe80b6f8179f16c581f11d74f3784873aec55914f7d6a765c4269ccc604ec
|
7
|
+
data.tar.gz: 438e1178f11d9b7ff848ec582172f5a21b3a6269ea763370aa31a74b5d5c6ed097ea6ba975d466ab1df54907374ff5f7350ed94ac701b28eeae2db129b187634
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/.github/workflows/ci.yml
CHANGED
@@ -33,7 +33,7 @@ jobs:
|
|
33
33
|
ruby: "head"
|
34
34
|
PGVER: "17"
|
35
35
|
- os: ubuntu
|
36
|
-
os_ver: "
|
36
|
+
os_ver: "22.04"
|
37
37
|
ruby: "2.3"
|
38
38
|
PGVER: "9.3"
|
39
39
|
- os: macos
|
@@ -64,7 +64,7 @@ jobs:
|
|
64
64
|
|
65
65
|
$(new-object net.webclient).DownloadFile("http://get.enterprisedb.com/postgresql/postgresql-$env:PGVERSION-binaries.zip", "postgresql-binaries.zip")
|
66
66
|
Unzip "postgresql-binaries.zip" "."
|
67
|
-
echo "$pwd/pgsql/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
|
67
|
+
echo "$env:RI_DEVKIT$env:MINGW_PREFIX/bin;$env:RI_DEVKIT/usr/bin;$pwd/pgsql/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
|
68
68
|
echo "PGUSER=$env:USERNAME" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
|
69
69
|
echo "PGPASSWORD=" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
|
70
70
|
md temp
|
data/.standard.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby_version: 2.3
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
## 0.5.2 / 2025-09-01
|
2
|
+
|
3
|
+
* Replace `kwalify` by `json-schema` to remove hundreds of warnings about keyword arguments in modern Ruby. #51
|
4
|
+
* Allow ERb syntax in config file. #52
|
5
|
+
This can be used to insert password from environment variable like so: `password: <%= ENV["PASSWORD"] %>`
|
6
|
+
* Update documentation.
|
7
|
+
|
8
|
+
|
1
9
|
## 0.5.1 / 2025-03-22
|
2
10
|
|
3
11
|
* Add dependent gems for compat with ruby-3.5
|
data/README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
[](https://app.travis-ci.com/larskanis/pg-ldap-sync) [](https://ci.appveyor.com/project/larskanis/pg-ldap-sync/branch/master)
|
2
2
|
|
3
|
-
#
|
3
|
+
# Sync users and groups from LDAP to PostgreSQL
|
4
4
|
|
5
|
-
*
|
5
|
+
* https://github.com/larskanis/pg-ldap-sync
|
6
6
|
|
7
7
|
## DESCRIPTION:
|
8
8
|
|
@@ -27,7 +27,7 @@ It is meant to be started as a cron job.
|
|
27
27
|
* Set scope of considered users/groups on LDAP and PG side
|
28
28
|
* Test mode which doesn't do any changes to the DBMS
|
29
29
|
* Both LDAP and PG connections can be secured by SSL/TLS
|
30
|
-
* NTLM and Kerberos authentication to LDAP server
|
30
|
+
* Password, NTLM and Kerberos authentication to LDAP server
|
31
31
|
|
32
32
|
## REQUIREMENTS:
|
33
33
|
|
@@ -37,23 +37,31 @@ It is meant to be started as a cron job.
|
|
37
37
|
|
38
38
|
## INSTALL:
|
39
39
|
|
40
|
+
pg-ldap-sync is included in Ubuntu-22.04 and Debian-11 and newer.
|
41
|
+
It can be installed by
|
42
|
+
|
43
|
+
```sh
|
44
|
+
sudo apt install ruby-pg-ldap-sync
|
45
|
+
```
|
46
|
+
|
47
|
+
### Install from source
|
48
|
+
|
40
49
|
Install Ruby:
|
41
50
|
|
42
|
-
* on Windows:
|
43
|
-
* on Debian/Ubuntu: `apt-get install ruby
|
51
|
+
* on Windows: https://rubyinstaller.org
|
52
|
+
* on Debian/Ubuntu: `apt-get install ruby`
|
44
53
|
|
45
54
|
Install pg-ldap-sync and required dependencies:
|
46
55
|
```sh
|
47
|
-
|
56
|
+
gem install pg-ldap-sync
|
48
57
|
```
|
49
58
|
|
50
59
|
### Install from Git:
|
51
60
|
```sh
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
bundle exec rake install
|
61
|
+
git clone https://github.com/larskanis/pg-ldap-sync.git
|
62
|
+
cd pg-ldap-sync
|
63
|
+
bundle install
|
64
|
+
bundle exec rake install
|
57
65
|
```
|
58
66
|
|
59
67
|
## USAGE:
|
@@ -65,11 +73,11 @@ or even better
|
|
65
73
|
|
66
74
|
Run in test-mode:
|
67
75
|
```sh
|
68
|
-
|
76
|
+
pg_ldap_sync -c my_config.yaml -vv -t
|
69
77
|
```
|
70
78
|
Run in modify-mode:
|
71
79
|
```sh
|
72
|
-
|
80
|
+
pg_ldap_sync -c my_config.yaml -vv
|
73
81
|
```
|
74
82
|
|
75
83
|
It is recommended to avoid granting permissions to synchronized users on the PostgreSQL server, but to grant permissions to groups instead.
|
@@ -80,9 +88,9 @@ This is because `DROP USER` statements invoked when a user leaves otherwise fail
|
|
80
88
|
## TEST:
|
81
89
|
There is a small test suite in the `test` directory that runs against an internal LDAP server and a PostgreSQL server. Ensure `pg_ctl`, `initdb` and `psql` commands are in the `PATH` like so:
|
82
90
|
```sh
|
83
|
-
|
84
|
-
|
85
|
-
|
91
|
+
cd pg-ldap-sync
|
92
|
+
bundle install
|
93
|
+
PATH=$PATH:/usr/lib/postgresql/10/bin/ bundle exec rake test
|
86
94
|
```
|
87
95
|
|
88
96
|
## ISSUES:
|
data/Rakefile
CHANGED
data/config/sample-config.yaml
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
# is considered as LDAP-synchronized.
|
4
4
|
|
5
5
|
# Connection parameters to LDAP server
|
6
|
-
# see also:
|
6
|
+
# see also: https://www.rubydoc.info/gems/net-ldap/Net%2FLDAP:initialize
|
7
7
|
ldap_connection:
|
8
8
|
host: ldapserver
|
9
9
|
port: 389
|
@@ -44,7 +44,7 @@ ldap_groups:
|
|
44
44
|
member_attribute: member
|
45
45
|
|
46
46
|
# Connection parameters to PostgreSQL server
|
47
|
-
# see also:
|
47
|
+
# see also: https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-PARAMKEYWORDS
|
48
48
|
pg_connection:
|
49
49
|
host:
|
50
50
|
dbname: postgres
|
data/config/sample-config2.yaml
CHANGED
@@ -9,7 +9,7 @@
|
|
9
9
|
#
|
10
10
|
|
11
11
|
# Connection parameters to LDAP server
|
12
|
-
# see also:
|
12
|
+
# see also: https://www.rubydoc.info/gems/net-ldap/Net%2FLDAP:initialize
|
13
13
|
ldap_connection:
|
14
14
|
host: ldapserver
|
15
15
|
port: 636
|
@@ -45,7 +45,7 @@ ldap_groups:
|
|
45
45
|
member_attribute: member
|
46
46
|
|
47
47
|
# Connection parameters to PostgreSQL server
|
48
|
-
# see also:
|
48
|
+
# see also: https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-PARAMKEYWORDS
|
49
49
|
pg_connection:
|
50
50
|
host:
|
51
51
|
dbname: postgres
|
data/config/schema.yaml
CHANGED
@@ -1,74 +1,78 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
1
|
+
"$schema": "http://json-schema.org/draft-04/schema#"
|
2
|
+
"id": "https://github.com/larskanis/pg-ldap-sync/blob/-/config/schema.yaml"
|
3
|
+
title: pg-ldap-sync config file
|
4
|
+
type: object
|
5
|
+
required:
|
6
|
+
- ldap_connection
|
7
|
+
- ldap_users
|
8
|
+
- ldap_groups
|
9
|
+
- pg_connection
|
10
|
+
- pg_users
|
11
|
+
- pg_groups
|
12
|
+
properties:
|
13
|
+
ldap_connection:
|
14
|
+
type: object
|
6
15
|
|
7
|
-
|
8
|
-
type:
|
9
|
-
required:
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
type:
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
type:
|
22
|
-
|
23
|
-
|
24
|
-
type: bool
|
25
|
-
required: no
|
16
|
+
ldap_users:
|
17
|
+
type: object
|
18
|
+
required:
|
19
|
+
- base
|
20
|
+
- filter
|
21
|
+
- name_attribute
|
22
|
+
properties:
|
23
|
+
base:
|
24
|
+
type: string
|
25
|
+
filter:
|
26
|
+
type: string
|
27
|
+
name_attribute:
|
28
|
+
type: string
|
29
|
+
lowercase_name:
|
30
|
+
type: boolean
|
31
|
+
bothcase_name:
|
32
|
+
type: boolean
|
26
33
|
|
27
|
-
|
28
|
-
type:
|
29
|
-
required:
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
type:
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
type:
|
45
|
-
|
46
|
-
|
47
|
-
type: str
|
48
|
-
required: yes
|
34
|
+
ldap_groups:
|
35
|
+
type: object
|
36
|
+
required:
|
37
|
+
- base
|
38
|
+
- filter
|
39
|
+
- name_attribute
|
40
|
+
- member_attribute
|
41
|
+
properties:
|
42
|
+
base:
|
43
|
+
type: string
|
44
|
+
filter:
|
45
|
+
type: string
|
46
|
+
name_attribute:
|
47
|
+
type: string
|
48
|
+
lowercase_name:
|
49
|
+
type: boolean
|
50
|
+
bothcase_name:
|
51
|
+
type: boolean
|
52
|
+
member_attribute:
|
53
|
+
type: string
|
49
54
|
|
50
|
-
|
51
|
-
type:
|
52
|
-
required: yes
|
55
|
+
pg_connection:
|
56
|
+
type: object
|
53
57
|
|
54
|
-
|
55
|
-
type:
|
56
|
-
required:
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
type:
|
58
|
+
pg_users:
|
59
|
+
type: object
|
60
|
+
required:
|
61
|
+
- filter
|
62
|
+
properties:
|
63
|
+
filter:
|
64
|
+
type: string
|
65
|
+
create_options:
|
66
|
+
type: ["string", "null"]
|
63
67
|
|
64
|
-
|
65
|
-
type:
|
66
|
-
required:
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
type:
|
73
|
-
|
74
|
-
type:
|
68
|
+
pg_groups:
|
69
|
+
type: object
|
70
|
+
required:
|
71
|
+
- filter
|
72
|
+
properties:
|
73
|
+
filter:
|
74
|
+
type: string
|
75
|
+
create_options:
|
76
|
+
type: ["string", "null"]
|
77
|
+
grant_options:
|
78
|
+
type: ["string", "null"]
|