gitlab-grack 2.0.0.pre → 2.0.0.rc1

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.
@@ -0,0 +1,41 @@
1
+ # -*- mode: ruby -*-
2
+ # vi: set ft=ruby :
3
+
4
+ # Please see the Vagrant section in the readme for caveats and tips
5
+ # https://gitlab.com/gitlab-org/gitlab-development-kit/tree/master#vagrant
6
+
7
+ VAGRANTFILE_API_VERSION = "2"
8
+
9
+ $apt_reqs = <<EOT
10
+ apt-get update
11
+ apt-get -y install git g++ pkg-config
12
+ apt-get -y install postgresql libpq-dev phantomjs redis-server libicu-dev cmake
13
+ EOT
14
+
15
+ # CentOS 6 kernel doesn't suppose UID mapping (affects vagrant-lxc mostly).
16
+ $user_setup = <<EOT
17
+ if [ $(id -u vagrant) != $(stat -c %u /vagrant) ]; then
18
+ useradd -u $(stat -c %u /vagrant) -m build
19
+ echo "build ALL=(ALL) NOPASSWD:ALL" | tee /etc/sudoers.d/build
20
+ DEV_USER=build
21
+ else
22
+ DEV_USER=vagrant
23
+ fi
24
+ sudo -u $DEV_USER -i bash -c "gpg --keyserver hkp://keys.gnupg.net --recv-keys D39DC0E3"
25
+ sudo -u $DEV_USER -i bash -c "curl -sSL https://get.rvm.io | bash -s stable --ruby"
26
+ EOT
27
+
28
+ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
29
+ config.vm.box = "ubuntu/trusty64"
30
+ config.vm.provision "shell", inline: $apt_reqs
31
+ config.vm.provision "shell", inline: $user_setup
32
+
33
+ config.vm.network "forwarded_port", guest: 3000, host: 3000
34
+
35
+ config.vm.provider "lxc" do |v, override|
36
+ override.vm.box = "fgrehm/trusty64-lxc"
37
+ end
38
+ config.vm.provider "virtualbox" do |vb|
39
+ vb.customize ["modifyvm", :id, "--memory", "2048"]
40
+ end
41
+ end
@@ -0,0 +1,13 @@
1
+ development:
2
+ adapter: postgresql
3
+ encoding: unicode
4
+ database: gitlabhq_development
5
+ pool: 5
6
+ host: /home/git/postgresql
7
+
8
+ test: &test
9
+ adapter: postgresql
10
+ encoding: unicode
11
+ database: gitlabhq_test
12
+ pool: 5
13
+ host: /home/git/postgresql
@@ -0,0 +1 @@
1
+ slapd.d/
@@ -0,0 +1,40 @@
1
+ gitlab_openldap_root = $(shell pwd)
2
+
3
+ default: slapd.d/bootstrap contents alt_contents
4
+
5
+ contents: slapd.d/schema slapd.d/example-com
6
+ alt_contents: slapd.d/schema slapd.d/alt-example-com
7
+
8
+ slapd.d:
9
+ mkdir slapd.d
10
+ chmod 700 slapd.d
11
+
12
+ slapd.d/bootstrap: sbin/slapadd slapd.d
13
+ sbin/slapadd -n 0 -F slapd.d < bootstrap.ldif
14
+ touch $@
15
+
16
+ slapd.d/schema: sbin/slapadd
17
+ sbin/slapadd -b 'cn=config' -F slapd.d < etc/openldap/schema/core.ldif
18
+ sbin/slapadd -b 'cn=config' -F slapd.d < etc/openldap/schema/cosine.ldif
19
+ sbin/slapadd -b 'cn=config' -F slapd.d < etc/openldap/schema/inetorgperson.ldif
20
+ sbin/slapadd -b 'cn=config' -F slapd.d < etc/openldap/schema/nis.ldif
21
+ touch $@
22
+
23
+ slapd.d/example-com: sbin/slapadd
24
+ sbin/slapadd -b 'dc=example,dc=com' -F slapd.d < frontend.example.com.ldif
25
+ touch $@
26
+
27
+ slapd.d/alt-example-com: sbin/slapadd
28
+ sbin/slapadd -b 'dc=example-alt,dc=com' -F slapd.d < frontend.alt.example.com.ldif
29
+ touch $@
30
+
31
+ clean:
32
+ rm -rf slapd.d
33
+
34
+ openldap-2.4.40:
35
+ curl -O ftp://ftp.openldap.org/pub/OpenLDAP/openldap-release/openldap-2.4.40.tgz
36
+ tar zxf openldap-2.4.40.tgz
37
+
38
+ sbin/slapadd: openldap-2.4.40
39
+ cd openldap-2.4.40 && ./configure --prefix=${gitlab_openldap_root} --enable-bdb=no --enable-hdb=no
40
+ cd openldap-2.4.40 && make -j 2 install
@@ -0,0 +1,60 @@
1
+ # Set up an OpenLDAP server for GitLab development
2
+
3
+ This is an attempt to set up an OpenLDAP server for GitLab development.
4
+
5
+ ## Getting it running
6
+
7
+ ```bash
8
+ make # compile openldap and bootstrap an LDAP server to run out of slapd.d
9
+ ./run-slapd # stays attached in the current terminal
10
+ ```
11
+
12
+ ## Repopulate the database
13
+ ```
14
+ make clean default
15
+ ```
16
+
17
+ ## Configuring gitlab
18
+
19
+ in gitlab.yml do the following;
20
+
21
+ ```yaml
22
+ ldap:
23
+ enabled: true
24
+ servers:
25
+ main:
26
+ label: LDAP
27
+ host: 127.0.0.1
28
+ port: 3890
29
+ uid: 'uid'
30
+ method: 'plain' # "tls" or "ssl" or "plain"
31
+ base: 'dc=example,dc=com'
32
+ user_filter: ''
33
+ group_base: 'ou=groups,dc=example,dc=com'
34
+ admin_group: ''
35
+ ```
36
+
37
+ alternative database (just using a different base)
38
+
39
+ ```yaml
40
+ ldap:
41
+ enabled: true
42
+ servers:
43
+ alt:
44
+ label: LDAP-alt
45
+ host: 127.0.0.1
46
+ port: 3891
47
+ uid: 'uid'
48
+ method: 'plain' # "tls" or "ssl" or "plain"
49
+ base: 'dc=example-alt,dc=com'
50
+ user_filter: ''
51
+ group_base: 'ou=groups,dc=example-alt,dc=com'
52
+ admin_group: ''
53
+ ```
54
+
55
+ *Note:* We don't use a bind user for this setup, keeping it as simple as possible
56
+
57
+ # TODO
58
+
59
+ - integrate into the development kit
60
+ - figure out how to detect the location of `slapd`; on OS X there is `/usr/libexec/slapd`.
@@ -0,0 +1,36 @@
1
+ dn: cn=config
2
+ objectClass: olcGlobal
3
+ cn: config
4
+
5
+ dn: olcDatabase={0}config,cn=config
6
+ objectClass: olcDatabaseConfig
7
+ olcDatabase: {0}config
8
+ olcRootDN: cn=admin,cn=config
9
+ # hash for 'password'
10
+ olcRootPW: {SSHA}A5StgE99fCDUo7AlWas7Nvlyexo0vQfm
11
+
12
+ # based on https://help.ubuntu.com/10.04/serverguide/openldap-server.html
13
+ dn: olcDatabase=ldif,cn=config
14
+ objectClass: olcDatabaseConfig
15
+ objectClass: olcLdifConfig
16
+ olcDatabase: ldif
17
+ olcSuffix: dc=example,dc=com
18
+ olcDbDirectory: slapd.d
19
+ olcRootDN: cn=admin,dc=example,dc=com
20
+ olcRootPW: password
21
+ olcLastMod: TRUE
22
+ olcAccess: to dn.base="" by * read
23
+ olcAccess: to * by dn="cn=admin,dc=example,dc=com" write by * read
24
+
25
+ # based on https://help.ubuntu.com/10.04/serverguide/openldap-server.html
26
+ dn: olcDatabase=ldif,cn=config
27
+ objectClass: olcDatabaseConfig
28
+ objectClass: olcLdifConfig
29
+ olcDatabase: ldif
30
+ olcSuffix: dc=example-alt,dc=com
31
+ olcDbDirectory: slapd.d
32
+ olcRootDN: cn=admin,dc=example-alt,dc=com
33
+ olcRootPW: password
34
+ olcLastMod: TRUE
35
+ olcAccess: to dn.base="" by * read
36
+ olcAccess: to * by dn="cn=admin,dc=example,dc=com" write by * read
@@ -0,0 +1,109 @@
1
+ # source: https://help.ubuntu.com/10.04/serverguide/openldap-server.html
2
+
3
+ # Create top-level object in domain
4
+ dn: dc=example-alt,dc=com
5
+ objectClass: top
6
+ objectClass: dcObject
7
+ objectclass: organization
8
+ o: Example Organization
9
+ dc: Example-alt
10
+ description: LDAP Example
11
+
12
+ # Admin user.
13
+ dn: cn=admin,dc=example-alt,dc=com
14
+ objectClass: simpleSecurityObject
15
+ objectClass: organizationalRole
16
+ cn: admin
17
+ description: LDAP administrator
18
+ # hased value for 'password'
19
+ userPassword: {SSHA}ICMhr6Jxt5bk2awD7HL7GxRTM3BZ1pFI
20
+
21
+ dn: ou=people,dc=example-alt,dc=com
22
+ objectClass: organizationalUnit
23
+ ou: people
24
+
25
+ dn: ou=groups,dc=example-alt,dc=com
26
+ objectClass: organizationalUnit
27
+ ou: groups
28
+
29
+ dn: uid=bob,ou=people,dc=example-alt,dc=com
30
+ objectClass: inetOrgPerson
31
+ objectClass: posixAccount
32
+ objectClass: shadowAccount
33
+ uid: bob
34
+ sn: Doe
35
+ givenName: bob
36
+ cn: bob Doe
37
+ displayName: bob Doe
38
+ uidNumber: 1000
39
+ gidNumber: 10000
40
+ # hased value for 'password'
41
+ userPassword: {SSHA}qqLFjamdd1cru4RV815+FiSxh/54rfbd
42
+ gecos: bob Doe
43
+ loginShell: /bin/bash
44
+ homeDirectory: /home/bob
45
+ shadowExpire: -1
46
+ shadowFlag: 0
47
+ shadowWarning: 7
48
+ shadowMin: 8
49
+ shadowMax: 999999
50
+ shadowLastChange: 10877
51
+ mail: bob.doe@example.com
52
+ postalCode: 31000
53
+ l: Toulouse
54
+ o: Example
55
+ mobile: +33 (0)6 xx xx xx xx
56
+ homePhone: +33 (0)5 xx xx xx xx
57
+ title: System Administrator
58
+ postalAddress:
59
+ initials: JD
60
+
61
+ dn: uid=alice,ou=people,dc=example-alt,dc=com
62
+ objectClass: inetOrgPerson
63
+ objectClass: posixAccount
64
+ objectClass: shadowAccount
65
+ uid: alice
66
+ sn: Jane
67
+ givenName: alice Jane
68
+ cn: alice Jane
69
+ displayName: alice Jane
70
+ uidNumber: 1001
71
+ gidNumber: 10001
72
+ # hased value for 'password'
73
+ userPassword: {SSHA}qqLFjamdd1cru4RV815+FiSxh/54rfbd
74
+ mail: alice.jane@example.com
75
+ gecos: alice
76
+ loginShell: /bin/bash
77
+ homeDirectory: /home/alice
78
+ shadowExpire: -1
79
+ shadowFlag: 0
80
+ shadowWarning: 7
81
+ shadowMin: 8
82
+ shadowMax: 999999
83
+ shadowLastChange: 10877
84
+ postalCode: 31000
85
+ l: Toulouse
86
+ o: Example
87
+ mobile: +33 (0)6 xx xx xx xx
88
+ homePhone: +33 (0)5 xx xx xx xx
89
+ title: System Administrator
90
+ postalAddress:
91
+ initials: JD
92
+
93
+ dn: cn=example,ou=groups,dc=example-alt,dc=com
94
+ objectClass: posixGroup
95
+ cn: example
96
+ gidNumber: 10000
97
+
98
+ dn: cn=group-a,ou=groups,dc=example-alt,dc=com
99
+ objectClass: groupofnames
100
+ ou: groups
101
+ cn: group-a
102
+ member: uid=bob,ou=people,dc=example-alt,dc=com
103
+ member: uid=alice,ou=people,dc=example-alt,dc=com
104
+
105
+ dn: cn=group-b,ou=groups,dc=example-alt,dc=com
106
+ objectClass: groupofnames
107
+ ou: groups
108
+ cn: group-b
109
+ member: uid=bob,ou=people,dc=example-alt,dc=com
@@ -0,0 +1,109 @@
1
+ # source: https://help.ubuntu.com/10.04/serverguide/openldap-server.html
2
+
3
+ # Create top-level object in domain
4
+ dn: dc=example,dc=com
5
+ objectClass: top
6
+ objectClass: dcObject
7
+ objectclass: organization
8
+ o: Example Organization
9
+ dc: Example
10
+ description: LDAP Example
11
+
12
+ # Admin user.
13
+ dn: cn=admin,dc=example,dc=com
14
+ objectClass: simpleSecurityObject
15
+ objectClass: organizationalRole
16
+ cn: admin
17
+ description: LDAP administrator
18
+ # hased value for 'password'
19
+ userPassword: {SSHA}ICMhr6Jxt5bk2awD7HL7GxRTM3BZ1pFI
20
+
21
+ dn: ou=people,dc=example,dc=com
22
+ objectClass: organizationalUnit
23
+ ou: people
24
+
25
+ dn: ou=groups,dc=example,dc=com
26
+ objectClass: organizationalUnit
27
+ ou: groups
28
+
29
+ dn: uid=john,ou=people,dc=example,dc=com
30
+ objectClass: inetOrgPerson
31
+ objectClass: posixAccount
32
+ objectClass: shadowAccount
33
+ uid: john
34
+ sn: Doe
35
+ givenName: John
36
+ cn: John Doe
37
+ displayName: John Doe
38
+ uidNumber: 1000
39
+ gidNumber: 10000
40
+ # hased value for 'password'
41
+ userPassword: {SSHA}qqLFjamdd1cru4RV815+FiSxh/54rfbd
42
+ gecos: John Doe
43
+ loginShell: /bin/bash
44
+ homeDirectory: /home/john
45
+ shadowExpire: -1
46
+ shadowFlag: 0
47
+ shadowWarning: 7
48
+ shadowMin: 8
49
+ shadowMax: 999999
50
+ shadowLastChange: 10877
51
+ mail: john.doe@example.com
52
+ postalCode: 31000
53
+ l: Toulouse
54
+ o: Example
55
+ mobile: +33 (0)6 xx xx xx xx
56
+ homePhone: +33 (0)5 xx xx xx xx
57
+ title: System Administrator
58
+ postalAddress:
59
+ initials: JD
60
+
61
+ dn: uid=mary,ou=people,dc=example,dc=com
62
+ objectClass: inetOrgPerson
63
+ objectClass: posixAccount
64
+ objectClass: shadowAccount
65
+ uid: Mary
66
+ sn: Jane
67
+ givenName: Mary Jane
68
+ cn: Mary Jane
69
+ displayName: Mary Jane
70
+ uidNumber: 1001
71
+ gidNumber: 10001
72
+ # hased value for 'password'
73
+ userPassword: {SSHA}qqLFjamdd1cru4RV815+FiSxh/54rfbd
74
+ mail: mary.jane@example.com
75
+ gecos: Mary
76
+ loginShell: /bin/bash
77
+ homeDirectory: /home/mary
78
+ shadowExpire: -1
79
+ shadowFlag: 0
80
+ shadowWarning: 7
81
+ shadowMin: 8
82
+ shadowMax: 999999
83
+ shadowLastChange: 10877
84
+ postalCode: 31000
85
+ l: Toulouse
86
+ o: Example
87
+ mobile: +33 (0)6 xx xx xx xx
88
+ homePhone: +33 (0)5 xx xx xx xx
89
+ title: System Administrator
90
+ postalAddress:
91
+ initials: JD
92
+
93
+ dn: cn=example,ou=groups,dc=example,dc=com
94
+ objectClass: posixGroup
95
+ cn: example
96
+ gidNumber: 10000
97
+
98
+ dn: cn=group1,ou=groups,dc=example,dc=com
99
+ objectClass: groupofnames
100
+ ou: groups
101
+ cn: group1
102
+ member: uid=john,ou=people,dc=example,dc=com
103
+ member: uid=mary,ou=people,dc=example,dc=com
104
+
105
+ dn: cn=group2,ou=groups,dc=example,dc=com
106
+ objectClass: groupofnames
107
+ ou: groups
108
+ cn: group2
109
+ member: uid=john,ou=people,dc=example,dc=com
@@ -0,0 +1,3 @@
1
+ #!/bin/sh
2
+ umask 077
3
+ libexec/slapd -F slapd.d -d2 -h "ldapi://slapd.socket ldap://127.0.0.1:3890"
@@ -0,0 +1,3 @@
1
+ #!/bin/sh
2
+ umask 077
3
+ /usr/libexec/slapd -F slapd.d -d1 -h "ldapi://slapd.socket ldap://127.0.0.1:3891"
@@ -0,0 +1,2 @@
1
+ port 0
2
+ unixsocket /home/git/redis/redis.socket
@@ -0,0 +1,2 @@
1
+ development: unix:/home/git/redis/redis.socket
2
+ test: unix:/home/git/redis/redis.socket
@@ -0,0 +1,11 @@
1
+ #!/bin/sh
2
+ # This script will edit the file named as the first argument in-place.
3
+ ed -s "$1" <<EOF
4
+ /port:/c
5
+ port: 3000
6
+ .
7
+ / user:/c
8
+ user: $(whoami)
9
+ .
10
+ wq
11
+ EOF