-
Notifications
You must be signed in to change notification settings - Fork 0
/
apache2-git-subfolder.conf
197 lines (132 loc) · 5.21 KB
/
apache2-git-subfolder.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
LoadModule mpm_event_module modules/mod_mpm_event.so
<IfModule !proxy_module>
LoadModule proxy_module modules/mod_proxy.so
</IfModule>
<IfModule !proxy_connect_module >
LoadModule proxy_connect_module modules/mod_proxy_connect.so
</IfModule>
<IfModule !proxy_http_module >
LoadModule proxy_http_module modules/mod_proxy_http.so
</IfModule>
<IfModule !ssl_module>
LoadModule ssl_module modules/mod_ssl.so
</IfModule>
<IfModule !alias_module>
LoadModule alias_module modules/mod_alias.so
</IfModule>
<IfModule !rewrite_module>
LoadModule rewrite_module modules/mod_rewrite.so
</IfModule>
<IfModule !env_module>
LoadModule env_module modules/mod_env.so
</IfModule>
<IfModule !authnz_fcgi_module>
LoadModule authnz_fcgi_module modules/mod_authnz_fcgi.so
</IfModule>
LoadModule log_config_module modules/mod_log_config.so
LoadModule access_compat_module modules/mod_access_compat.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authn_core_module modules/mod_authn_core.so
LoadModule authz_core_module modules/mod_authz_core.so
LoadModule headers_module modules/mod_headers.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule unixd_module modules/mod_unixd.so
LoadModule userdir_module modules/mod_userdir.so
<IfModule !mpm_prefork_module>
LoadModule cgid_module modules/mod_cgid.so
</IfModule>
<IfModule mpm_prefork_module>
LoadModule cgi_module modules/mod_cgi.so
</IfModule>
<IfModule cgid_module>
#
# ScriptSock: On threaded servers, designate the path to the UNIX
# socket used to communicate with the CGI daemon of mod_cgid.
#
Scriptsock cgisock
</IfModule>
User www-data
Group www-data
#LogLevel debug
ErrorLog /dev/stderr
TransferLog /dev/stdout
Listen 443
<VirtualHost *:443>
RewriteEngine On
ServerAlias $GIT_SERVER_NAME
<Directory /usr/bin>
Options +ExecCGI
Allow From All
Require all granted
</Directory>
<Directory /git-hooks>
Options +ExecCGI
Allow From All
Require all granted
</Directory>
<Directory /git-repo>
Allow From All
Require all granted
</Directory>
SetEnv GIT_PROJECT_ROOT /git-repo/
SetEnv GIT_HTTP_EXPORT_ALL
SetEnv GIT_PATH /usr/libexec/git-core/git2
SetEnv GIT_FILTER_PATH ".gitfilterspec"
SetEnv GIT_HTTP_PATH /usr/libexec/git-core/git-http-backend
ScriptAliasMatch "(?x)^/(.*/(HEAD | \
info/refs | \
objects/(info/[^/]+ | \
[0-9a-f]{2}/[0-9a-f]{38} | \
pack/pack-[0-9a-f]{40}\.(pack|idx)) | \
git-(upload|receive)-pack))$" /git-hooks/git-http-hook.py/$1
SSLEngine on
SSLCertificateFile /usr/local/apache2/conf/apache-selfsigned.crt
SSLCertificateKeyFile /usr/local/apache2/conf/apache-selfsigned.key
SSLProxyEngine on
SSLProxyVerify none
SSLProxyCheckPeerCN off
SSLProxyCheckPeerName off
SSLProxyCheckPeerExpire off
ProxyRequests off
ProxyRemote "*" "http://mitm-proxy:8080"
<Location />
# Add referer hack (if the site uses referrer as security)
Header add referer "https://github.com"
RequestHeader set referer "https://github.com"
Header add Origin "https://github.com"
RequestHeader set Origin "https://github.com"
#ProxyVia Full
#ProxyPreserveHost On
ProxyPass https://github.com/ retry=0
ProxyPassReverse https://github.com/
ProxyPassReverseCookieDomain github.com $GIT_SERVER_NAME
</Location>
# <Location /401-error-git.txt>
# ProxyPass !
# ForceType "text/plain; charset=UTF-8"
# Header unset Origin
# Header unset referer
# Header unset Last-Modified
# Header unset Accept-Ranges
# Header unset ETag
# </Location>
RewriteEngine On
SetEnvIf Authorization .+ HTTP_AUTHORIZATION=$0
RewriteRule .* - [e=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# we want git CLI to go through git-http-backend
<LocationMatch "(.*)/(.*)info/refs(.*)">
ProxyPass !
#AuthType Basic
#AuthName "Github"
#AuthUserFile /Users/yaronshani/Downloads/github-reverse/.htpasswd
#AuthBasicProvider FooAuthn
#Require valid-user
#ErrorDocument 401 /401-error-git.txt
</LocationMatch>
<LocationMatch "(.*)/(.*)git-upload-pack(.*)">
ProxyPass !
</LocationMatch>
<LocationMatch "(.*)/(.*)git-receive-pack(.*)">
ProxyPass !
</LocationMatch>
</VirtualHost>