##// END OF EJS Templates
encryption: added new backend using cryptography + Fernet encryption....
marcink -
r3522:3910c057 default
parent child Browse files
Show More

The requested changes are too big and content was truncated. Show full diff

@@ -0,0 +1,69 b''
1 import os
2 import base64
3 from cryptography.fernet import Fernet, InvalidToken
4 from cryptography.hazmat.backends import default_backend
5 from cryptography.hazmat.primitives import hashes
6 from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC
7
8
9 class Encryptor(object):
10 key_format = 'enc2$salt:{}$data:{}'
11 pref_len = 5 # salt:, data:
12
13 def __init__(self, enc_key):
14 self.enc_key = enc_key
15
16 def b64_encode(self, data):
17 return base64.urlsafe_b64encode(data)
18
19 def b64_decode(self, data):
20 return base64.urlsafe_b64decode(data)
21
22 def get_encryptor(self, salt):
23 """
24 Uses Fernet as encryptor with HMAC signature
25 :param salt: random salt used for encrypting the data
26 """
27 kdf = PBKDF2HMAC(
28 algorithm=hashes.SHA512(),
29 length=32,
30 salt=salt,
31 iterations=100000,
32 backend=default_backend()
33 )
34 key = self.b64_encode(kdf.derive(self.enc_key))
35 return Fernet(key)
36
37 def _get_parts(self, enc_data):
38 parts = enc_data.split('$', 3)
39 if len(parts) != 3:
40 raise ValueError('Encrypted Data has invalid format, expected {}'.format(self.key_format))
41 prefix, salt, enc_data = parts
42
43 try:
44 salt = self.b64_decode(salt[self.pref_len:])
45 except TypeError:
46 # bad base64
47 raise ValueError('Encrypted Data salt invalid format, expected base64 format')
48
49 enc_data = enc_data[self.pref_len:]
50 return prefix, salt, enc_data
51
52 def encrypt(self, data):
53 salt = os.urandom(64)
54 encryptor = self.get_encryptor(salt)
55 enc_data = encryptor.encrypt(data)
56 return self.key_format.format(self.b64_encode(salt), enc_data)
57
58 def decrypt(self, data, safe=True):
59 parts = self._get_parts(data)
60 salt = parts[1]
61 enc_data = parts[2]
62 encryptor = self.get_encryptor(salt)
63 try:
64 return encryptor.decrypt(enc_data)
65 except (InvalidToken,):
66 if safe:
67 return ''
68 else:
69 raise
@@ -1,732 +1,737 b''
1
1
2
2
3 ################################################################################
3 ################################################################################
4 ## RHODECODE COMMUNITY EDITION CONFIGURATION ##
4 ## RHODECODE COMMUNITY EDITION CONFIGURATION ##
5 ################################################################################
5 ################################################################################
6
6
7 [DEFAULT]
7 [DEFAULT]
8 ## Debug flag sets all loggers to debug, and enables request tracking
8 ## Debug flag sets all loggers to debug, and enables request tracking
9 debug = true
9 debug = true
10
10
11 ################################################################################
11 ################################################################################
12 ## EMAIL CONFIGURATION ##
12 ## EMAIL CONFIGURATION ##
13 ## Uncomment and replace with the email address which should receive ##
13 ## Uncomment and replace with the email address which should receive ##
14 ## any error reports after an application crash ##
14 ## any error reports after an application crash ##
15 ## Additionally these settings will be used by the RhodeCode mailing system ##
15 ## Additionally these settings will be used by the RhodeCode mailing system ##
16 ################################################################################
16 ################################################################################
17
17
18 ## prefix all emails subjects with given prefix, helps filtering out emails
18 ## prefix all emails subjects with given prefix, helps filtering out emails
19 #email_prefix = [RhodeCode]
19 #email_prefix = [RhodeCode]
20
20
21 ## email FROM address all mails will be sent
21 ## email FROM address all mails will be sent
22 #app_email_from = rhodecode-noreply@localhost
22 #app_email_from = rhodecode-noreply@localhost
23
23
24 #smtp_server = mail.server.com
24 #smtp_server = mail.server.com
25 #smtp_username =
25 #smtp_username =
26 #smtp_password =
26 #smtp_password =
27 #smtp_port =
27 #smtp_port =
28 #smtp_use_tls = false
28 #smtp_use_tls = false
29 #smtp_use_ssl = true
29 #smtp_use_ssl = true
30
30
31 [server:main]
31 [server:main]
32 ## COMMON ##
32 ## COMMON ##
33 host = 127.0.0.1
33 host = 127.0.0.1
34 port = 5000
34 port = 5000
35
35
36 ###########################################################
36 ###########################################################
37 ## WAITRESS WSGI SERVER - Recommended for Development ####
37 ## WAITRESS WSGI SERVER - Recommended for Development ####
38 ###########################################################
38 ###########################################################
39
39
40 use = egg:waitress#main
40 use = egg:waitress#main
41 ## number of worker threads
41 ## number of worker threads
42 threads = 5
42 threads = 5
43 ## MAX BODY SIZE 100GB
43 ## MAX BODY SIZE 100GB
44 max_request_body_size = 107374182400
44 max_request_body_size = 107374182400
45 ## Use poll instead of select, fixes file descriptors limits problems.
45 ## Use poll instead of select, fixes file descriptors limits problems.
46 ## May not work on old windows systems.
46 ## May not work on old windows systems.
47 asyncore_use_poll = true
47 asyncore_use_poll = true
48
48
49
49
50 ##########################
50 ##########################
51 ## GUNICORN WSGI SERVER ##
51 ## GUNICORN WSGI SERVER ##
52 ##########################
52 ##########################
53 ## run with gunicorn --log-config rhodecode.ini --paste rhodecode.ini
53 ## run with gunicorn --log-config rhodecode.ini --paste rhodecode.ini
54
54
55 #use = egg:gunicorn#main
55 #use = egg:gunicorn#main
56 ## Sets the number of process workers. More workers means more concurrent connections
56 ## Sets the number of process workers. More workers means more concurrent connections
57 ## RhodeCode can handle at the same time. Each additional worker also it increases
57 ## RhodeCode can handle at the same time. Each additional worker also it increases
58 ## memory usage as each has it's own set of caches.
58 ## memory usage as each has it's own set of caches.
59 ## Recommended value is (2 * NUMBER_OF_CPUS + 1), eg 2CPU = 5 workers, but no more
59 ## Recommended value is (2 * NUMBER_OF_CPUS + 1), eg 2CPU = 5 workers, but no more
60 ## than 8-10 unless for really big deployments .e.g 700-1000 users.
60 ## than 8-10 unless for really big deployments .e.g 700-1000 users.
61 ## `instance_id = *` must be set in the [app:main] section below (which is the default)
61 ## `instance_id = *` must be set in the [app:main] section below (which is the default)
62 ## when using more than 1 worker.
62 ## when using more than 1 worker.
63 #workers = 2
63 #workers = 2
64 ## process name visible in process list
64 ## process name visible in process list
65 #proc_name = rhodecode
65 #proc_name = rhodecode
66 ## type of worker class, one of sync, gevent
66 ## type of worker class, one of sync, gevent
67 ## recommended for bigger setup is using of of other than sync one
67 ## recommended for bigger setup is using of of other than sync one
68 #worker_class = gevent
68 #worker_class = gevent
69 ## The maximum number of simultaneous clients. Valid only for Gevent
69 ## The maximum number of simultaneous clients. Valid only for Gevent
70 #worker_connections = 10
70 #worker_connections = 10
71 ## max number of requests that worker will handle before being gracefully
71 ## max number of requests that worker will handle before being gracefully
72 ## restarted, could prevent memory leaks
72 ## restarted, could prevent memory leaks
73 #max_requests = 1000
73 #max_requests = 1000
74 #max_requests_jitter = 30
74 #max_requests_jitter = 30
75 ## amount of time a worker can spend with handling a request before it
75 ## amount of time a worker can spend with handling a request before it
76 ## gets killed and restarted. Set to 6hrs
76 ## gets killed and restarted. Set to 6hrs
77 #timeout = 21600
77 #timeout = 21600
78
78
79
79
80 ## prefix middleware for RhodeCode.
80 ## prefix middleware for RhodeCode.
81 ## recommended when using proxy setup.
81 ## recommended when using proxy setup.
82 ## allows to set RhodeCode under a prefix in server.
82 ## allows to set RhodeCode under a prefix in server.
83 ## eg https://server.com/custom_prefix. Enable `filter-with =` option below as well.
83 ## eg https://server.com/custom_prefix. Enable `filter-with =` option below as well.
84 ## And set your prefix like: `prefix = /custom_prefix`
84 ## And set your prefix like: `prefix = /custom_prefix`
85 ## be sure to also set beaker.session.cookie_path = /custom_prefix if you need
85 ## be sure to also set beaker.session.cookie_path = /custom_prefix if you need
86 ## to make your cookies only work on prefix url
86 ## to make your cookies only work on prefix url
87 [filter:proxy-prefix]
87 [filter:proxy-prefix]
88 use = egg:PasteDeploy#prefix
88 use = egg:PasteDeploy#prefix
89 prefix = /
89 prefix = /
90
90
91 [app:main]
91 [app:main]
92 ## The %(here)s variable will be replaced with the absolute path of parent directory
92 ## The %(here)s variable will be replaced with the absolute path of parent directory
93 ## of this file
93 ## of this file
94 ## In addition ENVIRONMENT variables usage is possible, e.g
94 ## In addition ENVIRONMENT variables usage is possible, e.g
95 ## sqlalchemy.db1.url = {ENV_RC_DB_URL}
95 ## sqlalchemy.db1.url = {ENV_RC_DB_URL}
96
96
97 use = egg:rhodecode-enterprise-ce
97 use = egg:rhodecode-enterprise-ce
98
98
99 ## enable proxy prefix middleware, defined above
99 ## enable proxy prefix middleware, defined above
100 #filter-with = proxy-prefix
100 #filter-with = proxy-prefix
101
101
102 # During development the we want to have the debug toolbar enabled
102 # During development the we want to have the debug toolbar enabled
103 pyramid.includes =
103 pyramid.includes =
104 pyramid_debugtoolbar
104 pyramid_debugtoolbar
105 rhodecode.lib.middleware.request_wrapper
105 rhodecode.lib.middleware.request_wrapper
106
106
107 pyramid.reload_templates = true
107 pyramid.reload_templates = true
108
108
109 debugtoolbar.hosts = 0.0.0.0/0
109 debugtoolbar.hosts = 0.0.0.0/0
110 debugtoolbar.exclude_prefixes =
110 debugtoolbar.exclude_prefixes =
111 /css
111 /css
112 /fonts
112 /fonts
113 /images
113 /images
114 /js
114 /js
115
115
116 ## RHODECODE PLUGINS ##
116 ## RHODECODE PLUGINS ##
117 rhodecode.includes =
117 rhodecode.includes =
118 rhodecode.api
118 rhodecode.api
119
119
120
120
121 # api prefix url
121 # api prefix url
122 rhodecode.api.url = /_admin/api
122 rhodecode.api.url = /_admin/api
123
123
124
124
125 ## END RHODECODE PLUGINS ##
125 ## END RHODECODE PLUGINS ##
126
126
127 ## encryption key used to encrypt social plugin tokens,
127 ## encryption key used to encrypt social plugin tokens,
128 ## remote_urls with credentials etc, if not set it defaults to
128 ## remote_urls with credentials etc, if not set it defaults to
129 ## `beaker.session.secret`
129 ## `beaker.session.secret`
130 #rhodecode.encrypted_values.secret =
130 #rhodecode.encrypted_values.secret =
131
131
132 ## decryption strict mode (enabled by default). It controls if decryption raises
132 ## decryption strict mode (enabled by default). It controls if decryption raises
133 ## `SignatureVerificationError` in case of wrong key, or damaged encryption data.
133 ## `SignatureVerificationError` in case of wrong key, or damaged encryption data.
134 #rhodecode.encrypted_values.strict = false
134 #rhodecode.encrypted_values.strict = false
135
135
136 ## Pick algorithm for encryption. Either fernet (more secure) or aes (default)
137 ## fernet is safer, and we strongly recommend switching to it.
138 ## Due to backward compatibility aes is used as default.
139 #rhodecode.encrypted_values.algorithm = fernet
140
136 ## return gzipped responses from RhodeCode (static files/application)
141 ## return gzipped responses from RhodeCode (static files/application)
137 gzip_responses = false
142 gzip_responses = false
138
143
139 ## auto-generate javascript routes file on startup
144 ## auto-generate javascript routes file on startup
140 generate_js_files = false
145 generate_js_files = false
141
146
142 ## System global default language.
147 ## System global default language.
143 ## All available languages: en(default), be, de, es, fr, it, ja, pl, pt, ru, zh
148 ## All available languages: en(default), be, de, es, fr, it, ja, pl, pt, ru, zh
144 lang = en
149 lang = en
145
150
146 ## Perform a full repository scan and import on each server start.
151 ## Perform a full repository scan and import on each server start.
147 ## Settings this to true could lead to very long startup time.
152 ## Settings this to true could lead to very long startup time.
148 startup.import_repos = false
153 startup.import_repos = false
149
154
150 ## Uncomment and set this path to use archive download cache.
155 ## Uncomment and set this path to use archive download cache.
151 ## Once enabled, generated archives will be cached at this location
156 ## Once enabled, generated archives will be cached at this location
152 ## and served from the cache during subsequent requests for the same archive of
157 ## and served from the cache during subsequent requests for the same archive of
153 ## the repository.
158 ## the repository.
154 #archive_cache_dir = /tmp/tarballcache
159 #archive_cache_dir = /tmp/tarballcache
155
160
156 ## URL at which the application is running. This is used for Bootstrapping
161 ## URL at which the application is running. This is used for Bootstrapping
157 ## requests in context when no web request is available. Used in ishell, or
162 ## requests in context when no web request is available. Used in ishell, or
158 ## SSH calls. Set this for events to receive proper url for SSH calls.
163 ## SSH calls. Set this for events to receive proper url for SSH calls.
159 app.base_url = http://rhodecode.local
164 app.base_url = http://rhodecode.local
160
165
161 ## Unique application ID. Should be a random unique string for security.
166 ## Unique application ID. Should be a random unique string for security.
162 app_instance_uuid = rc-production
167 app_instance_uuid = rc-production
163
168
164 ## Cut off limit for large diffs (size in bytes). If overall diff size on
169 ## Cut off limit for large diffs (size in bytes). If overall diff size on
165 ## commit, or pull request exceeds this limit this diff will be displayed
170 ## commit, or pull request exceeds this limit this diff will be displayed
166 ## partially. E.g 512000 == 512Kb
171 ## partially. E.g 512000 == 512Kb
167 cut_off_limit_diff = 512000
172 cut_off_limit_diff = 512000
168
173
169 ## Cut off limit for large files inside diffs (size in bytes). Each individual
174 ## Cut off limit for large files inside diffs (size in bytes). Each individual
170 ## file inside diff which exceeds this limit will be displayed partially.
175 ## file inside diff which exceeds this limit will be displayed partially.
171 ## E.g 128000 == 128Kb
176 ## E.g 128000 == 128Kb
172 cut_off_limit_file = 128000
177 cut_off_limit_file = 128000
173
178
174 ## use cached version of vcs repositories everywhere. Recommended to be `true`
179 ## use cached version of vcs repositories everywhere. Recommended to be `true`
175 vcs_full_cache = true
180 vcs_full_cache = true
176
181
177 ## Force https in RhodeCode, fixes https redirects, assumes it's always https.
182 ## Force https in RhodeCode, fixes https redirects, assumes it's always https.
178 ## Normally this is controlled by proper http flags sent from http server
183 ## Normally this is controlled by proper http flags sent from http server
179 force_https = false
184 force_https = false
180
185
181 ## use Strict-Transport-Security headers
186 ## use Strict-Transport-Security headers
182 use_htsts = false
187 use_htsts = false
183
188
184 ## git rev filter option, --all is the default filter, if you need to
189 ## git rev filter option, --all is the default filter, if you need to
185 ## hide all refs in changelog switch this to --branches --tags
190 ## hide all refs in changelog switch this to --branches --tags
186 git_rev_filter = --branches --tags
191 git_rev_filter = --branches --tags
187
192
188 # Set to true if your repos are exposed using the dumb protocol
193 # Set to true if your repos are exposed using the dumb protocol
189 git_update_server_info = false
194 git_update_server_info = false
190
195
191 ## RSS/ATOM feed options
196 ## RSS/ATOM feed options
192 rss_cut_off_limit = 256000
197 rss_cut_off_limit = 256000
193 rss_items_per_page = 10
198 rss_items_per_page = 10
194 rss_include_diff = false
199 rss_include_diff = false
195
200
196 ## gist URL alias, used to create nicer urls for gist. This should be an
201 ## gist URL alias, used to create nicer urls for gist. This should be an
197 ## url that does rewrites to _admin/gists/{gistid}.
202 ## url that does rewrites to _admin/gists/{gistid}.
198 ## example: http://gist.rhodecode.org/{gistid}. Empty means use the internal
203 ## example: http://gist.rhodecode.org/{gistid}. Empty means use the internal
199 ## RhodeCode url, ie. http[s]://rhodecode.server/_admin/gists/{gistid}
204 ## RhodeCode url, ie. http[s]://rhodecode.server/_admin/gists/{gistid}
200 gist_alias_url =
205 gist_alias_url =
201
206
202 ## List of views (using glob pattern syntax) that AUTH TOKENS could be
207 ## List of views (using glob pattern syntax) that AUTH TOKENS could be
203 ## used for access.
208 ## used for access.
204 ## Adding ?auth_token=TOKEN_HASH to the url authenticates this request as if it
209 ## Adding ?auth_token=TOKEN_HASH to the url authenticates this request as if it
205 ## came from the the logged in user who own this authentication token.
210 ## came from the the logged in user who own this authentication token.
206 ## Additionally @TOKEN syntax can be used to bound the view to specific
211 ## Additionally @TOKEN syntax can be used to bound the view to specific
207 ## authentication token. Such view would be only accessible when used together
212 ## authentication token. Such view would be only accessible when used together
208 ## with this authentication token
213 ## with this authentication token
209 ##
214 ##
210 ## list of all views can be found under `/_admin/permissions/auth_token_access`
215 ## list of all views can be found under `/_admin/permissions/auth_token_access`
211 ## The list should be "," separated and on a single line.
216 ## The list should be "," separated and on a single line.
212 ##
217 ##
213 ## Most common views to enable:
218 ## Most common views to enable:
214 # RepoCommitsView:repo_commit_download
219 # RepoCommitsView:repo_commit_download
215 # RepoCommitsView:repo_commit_patch
220 # RepoCommitsView:repo_commit_patch
216 # RepoCommitsView:repo_commit_raw
221 # RepoCommitsView:repo_commit_raw
217 # RepoCommitsView:repo_commit_raw@TOKEN
222 # RepoCommitsView:repo_commit_raw@TOKEN
218 # RepoFilesView:repo_files_diff
223 # RepoFilesView:repo_files_diff
219 # RepoFilesView:repo_archivefile
224 # RepoFilesView:repo_archivefile
220 # RepoFilesView:repo_file_raw
225 # RepoFilesView:repo_file_raw
221 # GistView:*
226 # GistView:*
222 api_access_controllers_whitelist =
227 api_access_controllers_whitelist =
223
228
224 ## Default encoding used to convert from and to unicode
229 ## Default encoding used to convert from and to unicode
225 ## can be also a comma separated list of encoding in case of mixed encodings
230 ## can be also a comma separated list of encoding in case of mixed encodings
226 default_encoding = UTF-8
231 default_encoding = UTF-8
227
232
228 ## instance-id prefix
233 ## instance-id prefix
229 ## a prefix key for this instance used for cache invalidation when running
234 ## a prefix key for this instance used for cache invalidation when running
230 ## multiple instances of RhodeCode, make sure it's globally unique for
235 ## multiple instances of RhodeCode, make sure it's globally unique for
231 ## all running RhodeCode instances. Leave empty if you don't use it
236 ## all running RhodeCode instances. Leave empty if you don't use it
232 instance_id =
237 instance_id =
233
238
234 ## Fallback authentication plugin. Set this to a plugin ID to force the usage
239 ## Fallback authentication plugin. Set this to a plugin ID to force the usage
235 ## of an authentication plugin also if it is disabled by it's settings.
240 ## of an authentication plugin also if it is disabled by it's settings.
236 ## This could be useful if you are unable to log in to the system due to broken
241 ## This could be useful if you are unable to log in to the system due to broken
237 ## authentication settings. Then you can enable e.g. the internal RhodeCode auth
242 ## authentication settings. Then you can enable e.g. the internal RhodeCode auth
238 ## module to log in again and fix the settings.
243 ## module to log in again and fix the settings.
239 ##
244 ##
240 ## Available builtin plugin IDs (hash is part of the ID):
245 ## Available builtin plugin IDs (hash is part of the ID):
241 ## egg:rhodecode-enterprise-ce#rhodecode
246 ## egg:rhodecode-enterprise-ce#rhodecode
242 ## egg:rhodecode-enterprise-ce#pam
247 ## egg:rhodecode-enterprise-ce#pam
243 ## egg:rhodecode-enterprise-ce#ldap
248 ## egg:rhodecode-enterprise-ce#ldap
244 ## egg:rhodecode-enterprise-ce#jasig_cas
249 ## egg:rhodecode-enterprise-ce#jasig_cas
245 ## egg:rhodecode-enterprise-ce#headers
250 ## egg:rhodecode-enterprise-ce#headers
246 ## egg:rhodecode-enterprise-ce#crowd
251 ## egg:rhodecode-enterprise-ce#crowd
247 #rhodecode.auth_plugin_fallback = egg:rhodecode-enterprise-ce#rhodecode
252 #rhodecode.auth_plugin_fallback = egg:rhodecode-enterprise-ce#rhodecode
248
253
249 ## alternative return HTTP header for failed authentication. Default HTTP
254 ## alternative return HTTP header for failed authentication. Default HTTP
250 ## response is 401 HTTPUnauthorized. Currently HG clients have troubles with
255 ## response is 401 HTTPUnauthorized. Currently HG clients have troubles with
251 ## handling that causing a series of failed authentication calls.
256 ## handling that causing a series of failed authentication calls.
252 ## Set this variable to 403 to return HTTPForbidden, or any other HTTP code
257 ## Set this variable to 403 to return HTTPForbidden, or any other HTTP code
253 ## This will be served instead of default 401 on bad authentication
258 ## This will be served instead of default 401 on bad authentication
254 auth_ret_code =
259 auth_ret_code =
255
260
256 ## use special detection method when serving auth_ret_code, instead of serving
261 ## use special detection method when serving auth_ret_code, instead of serving
257 ## ret_code directly, use 401 initially (Which triggers credentials prompt)
262 ## ret_code directly, use 401 initially (Which triggers credentials prompt)
258 ## and then serve auth_ret_code to clients
263 ## and then serve auth_ret_code to clients
259 auth_ret_code_detection = false
264 auth_ret_code_detection = false
260
265
261 ## locking return code. When repository is locked return this HTTP code. 2XX
266 ## locking return code. When repository is locked return this HTTP code. 2XX
262 ## codes don't break the transactions while 4XX codes do
267 ## codes don't break the transactions while 4XX codes do
263 lock_ret_code = 423
268 lock_ret_code = 423
264
269
265 ## allows to change the repository location in settings page
270 ## allows to change the repository location in settings page
266 allow_repo_location_change = true
271 allow_repo_location_change = true
267
272
268 ## allows to setup custom hooks in settings page
273 ## allows to setup custom hooks in settings page
269 allow_custom_hooks_settings = true
274 allow_custom_hooks_settings = true
270
275
271 ## Generated license token required for EE edition license.
276 ## Generated license token required for EE edition license.
272 ## New generated token value can be found in Admin > settings > license page.
277 ## New generated token value can be found in Admin > settings > license page.
273 license_token =
278 license_token =
274
279
275 ## supervisor connection uri, for managing supervisor and logs.
280 ## supervisor connection uri, for managing supervisor and logs.
276 supervisor.uri =
281 supervisor.uri =
277 ## supervisord group name/id we only want this RC instance to handle
282 ## supervisord group name/id we only want this RC instance to handle
278 supervisor.group_id = dev
283 supervisor.group_id = dev
279
284
280 ## Display extended labs settings
285 ## Display extended labs settings
281 labs_settings_active = true
286 labs_settings_active = true
282
287
283 ## Custom exception store path, defaults to TMPDIR
288 ## Custom exception store path, defaults to TMPDIR
284 ## This is used to store exception from RhodeCode in shared directory
289 ## This is used to store exception from RhodeCode in shared directory
285 #exception_tracker.store_path =
290 #exception_tracker.store_path =
286
291
287 ## File store configuration. This is used to store and serve uploaded files
292 ## File store configuration. This is used to store and serve uploaded files
288 file_store.enabled = true
293 file_store.enabled = true
289 ## Storage backend, available options are: local
294 ## Storage backend, available options are: local
290 file_store.backend = local
295 file_store.backend = local
291 ## path to store the uploaded binaries
296 ## path to store the uploaded binaries
292 file_store.storage_path = %(here)s/data/file_store
297 file_store.storage_path = %(here)s/data/file_store
293
298
294
299
295 ####################################
300 ####################################
296 ### CELERY CONFIG ####
301 ### CELERY CONFIG ####
297 ####################################
302 ####################################
298 ## run: /path/to/celery worker \
303 ## run: /path/to/celery worker \
299 ## -E --beat --app rhodecode.lib.celerylib.loader \
304 ## -E --beat --app rhodecode.lib.celerylib.loader \
300 ## --scheduler rhodecode.lib.celerylib.scheduler.RcScheduler \
305 ## --scheduler rhodecode.lib.celerylib.scheduler.RcScheduler \
301 ## --loglevel DEBUG --ini /path/to/rhodecode.ini
306 ## --loglevel DEBUG --ini /path/to/rhodecode.ini
302
307
303 use_celery = false
308 use_celery = false
304
309
305 ## connection url to the message broker (default rabbitmq)
310 ## connection url to the message broker (default rabbitmq)
306 celery.broker_url = amqp://rabbitmq:qweqwe@localhost:5672/rabbitmqhost
311 celery.broker_url = amqp://rabbitmq:qweqwe@localhost:5672/rabbitmqhost
307
312
308 ## maximum tasks to execute before worker restart
313 ## maximum tasks to execute before worker restart
309 celery.max_tasks_per_child = 100
314 celery.max_tasks_per_child = 100
310
315
311 ## tasks will never be sent to the queue, but executed locally instead.
316 ## tasks will never be sent to the queue, but executed locally instead.
312 celery.task_always_eager = false
317 celery.task_always_eager = false
313
318
314 #####################################
319 #####################################
315 ### DOGPILE CACHE ####
320 ### DOGPILE CACHE ####
316 #####################################
321 #####################################
317 ## Default cache dir for caches. Putting this into a ramdisk
322 ## Default cache dir for caches. Putting this into a ramdisk
318 ## can boost performance, eg. /tmpfs/data_ramdisk, however this directory might require
323 ## can boost performance, eg. /tmpfs/data_ramdisk, however this directory might require
319 ## large amount of space
324 ## large amount of space
320 cache_dir = %(here)s/data
325 cache_dir = %(here)s/data
321
326
322 ## `cache_perms` cache settings for permission tree, auth TTL.
327 ## `cache_perms` cache settings for permission tree, auth TTL.
323 rc_cache.cache_perms.backend = dogpile.cache.rc.file_namespace
328 rc_cache.cache_perms.backend = dogpile.cache.rc.file_namespace
324 rc_cache.cache_perms.expiration_time = 300
329 rc_cache.cache_perms.expiration_time = 300
325
330
326 ## alternative `cache_perms` redis backend with distributed lock
331 ## alternative `cache_perms` redis backend with distributed lock
327 #rc_cache.cache_perms.backend = dogpile.cache.rc.redis
332 #rc_cache.cache_perms.backend = dogpile.cache.rc.redis
328 #rc_cache.cache_perms.expiration_time = 300
333 #rc_cache.cache_perms.expiration_time = 300
329 ## redis_expiration_time needs to be greater then expiration_time
334 ## redis_expiration_time needs to be greater then expiration_time
330 #rc_cache.cache_perms.arguments.redis_expiration_time = 7200
335 #rc_cache.cache_perms.arguments.redis_expiration_time = 7200
331 #rc_cache.cache_perms.arguments.socket_timeout = 30
336 #rc_cache.cache_perms.arguments.socket_timeout = 30
332 #rc_cache.cache_perms.arguments.host = localhost
337 #rc_cache.cache_perms.arguments.host = localhost
333 #rc_cache.cache_perms.arguments.port = 6379
338 #rc_cache.cache_perms.arguments.port = 6379
334 #rc_cache.cache_perms.arguments.db = 0
339 #rc_cache.cache_perms.arguments.db = 0
335 ## more Redis options: https://dogpilecache.sqlalchemy.org/en/latest/api.html#redis-backends
340 ## more Redis options: https://dogpilecache.sqlalchemy.org/en/latest/api.html#redis-backends
336 #rc_cache.cache_perms.arguments.distributed_lock = true
341 #rc_cache.cache_perms.arguments.distributed_lock = true
337
342
338 ## `cache_repo` cache settings for FileTree, Readme, RSS FEEDS
343 ## `cache_repo` cache settings for FileTree, Readme, RSS FEEDS
339 rc_cache.cache_repo.backend = dogpile.cache.rc.file_namespace
344 rc_cache.cache_repo.backend = dogpile.cache.rc.file_namespace
340 rc_cache.cache_repo.expiration_time = 2592000
345 rc_cache.cache_repo.expiration_time = 2592000
341
346
342 ## alternative `cache_repo` redis backend with distributed lock
347 ## alternative `cache_repo` redis backend with distributed lock
343 #rc_cache.cache_repo.backend = dogpile.cache.rc.redis
348 #rc_cache.cache_repo.backend = dogpile.cache.rc.redis
344 #rc_cache.cache_repo.expiration_time = 2592000
349 #rc_cache.cache_repo.expiration_time = 2592000
345 ## redis_expiration_time needs to be greater then expiration_time
350 ## redis_expiration_time needs to be greater then expiration_time
346 #rc_cache.cache_repo.arguments.redis_expiration_time = 2678400
351 #rc_cache.cache_repo.arguments.redis_expiration_time = 2678400
347 #rc_cache.cache_repo.arguments.socket_timeout = 30
352 #rc_cache.cache_repo.arguments.socket_timeout = 30
348 #rc_cache.cache_repo.arguments.host = localhost
353 #rc_cache.cache_repo.arguments.host = localhost
349 #rc_cache.cache_repo.arguments.port = 6379
354 #rc_cache.cache_repo.arguments.port = 6379
350 #rc_cache.cache_repo.arguments.db = 1
355 #rc_cache.cache_repo.arguments.db = 1
351 ## more Redis options: https://dogpilecache.sqlalchemy.org/en/latest/api.html#redis-backends
356 ## more Redis options: https://dogpilecache.sqlalchemy.org/en/latest/api.html#redis-backends
352 #rc_cache.cache_repo.arguments.distributed_lock = true
357 #rc_cache.cache_repo.arguments.distributed_lock = true
353
358
354 ## cache settings for SQL queries, this needs to use memory type backend
359 ## cache settings for SQL queries, this needs to use memory type backend
355 rc_cache.sql_cache_short.backend = dogpile.cache.rc.memory_lru
360 rc_cache.sql_cache_short.backend = dogpile.cache.rc.memory_lru
356 rc_cache.sql_cache_short.expiration_time = 30
361 rc_cache.sql_cache_short.expiration_time = 30
357
362
358 ## `cache_repo_longterm` cache for repo object instances, this needs to use memory
363 ## `cache_repo_longterm` cache for repo object instances, this needs to use memory
359 ## type backend as the objects kept are not pickle serializable
364 ## type backend as the objects kept are not pickle serializable
360 rc_cache.cache_repo_longterm.backend = dogpile.cache.rc.memory_lru
365 rc_cache.cache_repo_longterm.backend = dogpile.cache.rc.memory_lru
361 ## by default we use 96H, this is using invalidation on push anyway
366 ## by default we use 96H, this is using invalidation on push anyway
362 rc_cache.cache_repo_longterm.expiration_time = 345600
367 rc_cache.cache_repo_longterm.expiration_time = 345600
363 ## max items in LRU cache, reduce this number to save memory, and expire last used
368 ## max items in LRU cache, reduce this number to save memory, and expire last used
364 ## cached objects
369 ## cached objects
365 rc_cache.cache_repo_longterm.max_size = 10000
370 rc_cache.cache_repo_longterm.max_size = 10000
366
371
367
372
368 ####################################
373 ####################################
369 ### BEAKER SESSION ####
374 ### BEAKER SESSION ####
370 ####################################
375 ####################################
371
376
372 ## .session.type is type of storage options for the session, current allowed
377 ## .session.type is type of storage options for the session, current allowed
373 ## types are file, ext:memcached, ext:redis, ext:database, and memory (default).
378 ## types are file, ext:memcached, ext:redis, ext:database, and memory (default).
374 beaker.session.type = file
379 beaker.session.type = file
375 beaker.session.data_dir = %(here)s/data/sessions
380 beaker.session.data_dir = %(here)s/data/sessions
376
381
377 ## db based session, fast, and allows easy management over logged in users
382 ## db based session, fast, and allows easy management over logged in users
378 #beaker.session.type = ext:database
383 #beaker.session.type = ext:database
379 #beaker.session.table_name = db_session
384 #beaker.session.table_name = db_session
380 #beaker.session.sa.url = postgresql://postgres:secret@localhost/rhodecode
385 #beaker.session.sa.url = postgresql://postgres:secret@localhost/rhodecode
381 #beaker.session.sa.url = mysql://root:secret@127.0.0.1/rhodecode
386 #beaker.session.sa.url = mysql://root:secret@127.0.0.1/rhodecode
382 #beaker.session.sa.pool_recycle = 3600
387 #beaker.session.sa.pool_recycle = 3600
383 #beaker.session.sa.echo = false
388 #beaker.session.sa.echo = false
384
389
385 beaker.session.key = rhodecode
390 beaker.session.key = rhodecode
386 beaker.session.secret = develop-rc-uytcxaz
391 beaker.session.secret = develop-rc-uytcxaz
387 beaker.session.lock_dir = %(here)s/data/sessions/lock
392 beaker.session.lock_dir = %(here)s/data/sessions/lock
388
393
389 ## Secure encrypted cookie. Requires AES and AES python libraries
394 ## Secure encrypted cookie. Requires AES and AES python libraries
390 ## you must disable beaker.session.secret to use this
395 ## you must disable beaker.session.secret to use this
391 #beaker.session.encrypt_key = key_for_encryption
396 #beaker.session.encrypt_key = key_for_encryption
392 #beaker.session.validate_key = validation_key
397 #beaker.session.validate_key = validation_key
393
398
394 ## sets session as invalid(also logging out user) if it haven not been
399 ## sets session as invalid(also logging out user) if it haven not been
395 ## accessed for given amount of time in seconds
400 ## accessed for given amount of time in seconds
396 beaker.session.timeout = 2592000
401 beaker.session.timeout = 2592000
397 beaker.session.httponly = true
402 beaker.session.httponly = true
398 ## Path to use for the cookie. Set to prefix if you use prefix middleware
403 ## Path to use for the cookie. Set to prefix if you use prefix middleware
399 #beaker.session.cookie_path = /custom_prefix
404 #beaker.session.cookie_path = /custom_prefix
400
405
401 ## uncomment for https secure cookie
406 ## uncomment for https secure cookie
402 beaker.session.secure = false
407 beaker.session.secure = false
403
408
404 ## auto save the session to not to use .save()
409 ## auto save the session to not to use .save()
405 beaker.session.auto = false
410 beaker.session.auto = false
406
411
407 ## default cookie expiration time in seconds, set to `true` to set expire
412 ## default cookie expiration time in seconds, set to `true` to set expire
408 ## at browser close
413 ## at browser close
409 #beaker.session.cookie_expires = 3600
414 #beaker.session.cookie_expires = 3600
410
415
411 ###################################
416 ###################################
412 ## SEARCH INDEXING CONFIGURATION ##
417 ## SEARCH INDEXING CONFIGURATION ##
413 ###################################
418 ###################################
414 ## Full text search indexer is available in rhodecode-tools under
419 ## Full text search indexer is available in rhodecode-tools under
415 ## `rhodecode-tools index` command
420 ## `rhodecode-tools index` command
416
421
417 ## WHOOSH Backend, doesn't require additional services to run
422 ## WHOOSH Backend, doesn't require additional services to run
418 ## it works good with few dozen repos
423 ## it works good with few dozen repos
419 search.module = rhodecode.lib.index.whoosh
424 search.module = rhodecode.lib.index.whoosh
420 search.location = %(here)s/data/index
425 search.location = %(here)s/data/index
421
426
422 ########################################
427 ########################################
423 ### CHANNELSTREAM CONFIG ####
428 ### CHANNELSTREAM CONFIG ####
424 ########################################
429 ########################################
425 ## channelstream enables persistent connections and live notification
430 ## channelstream enables persistent connections and live notification
426 ## in the system. It's also used by the chat system
431 ## in the system. It's also used by the chat system
427
432
428 channelstream.enabled = false
433 channelstream.enabled = false
429
434
430 ## server address for channelstream server on the backend
435 ## server address for channelstream server on the backend
431 channelstream.server = 127.0.0.1:9800
436 channelstream.server = 127.0.0.1:9800
432
437
433 ## location of the channelstream server from outside world
438 ## location of the channelstream server from outside world
434 ## use ws:// for http or wss:// for https. This address needs to be handled
439 ## use ws:// for http or wss:// for https. This address needs to be handled
435 ## by external HTTP server such as Nginx or Apache
440 ## by external HTTP server such as Nginx or Apache
436 ## see Nginx/Apache configuration examples in our docs
441 ## see Nginx/Apache configuration examples in our docs
437 channelstream.ws_url = ws://rhodecode.yourserver.com/_channelstream
442 channelstream.ws_url = ws://rhodecode.yourserver.com/_channelstream
438 channelstream.secret = secret
443 channelstream.secret = secret
439 channelstream.history.location = %(here)s/channelstream_history
444 channelstream.history.location = %(here)s/channelstream_history
440
445
441 ## Internal application path that Javascript uses to connect into.
446 ## Internal application path that Javascript uses to connect into.
442 ## If you use proxy-prefix the prefix should be added before /_channelstream
447 ## If you use proxy-prefix the prefix should be added before /_channelstream
443 channelstream.proxy_path = /_channelstream
448 channelstream.proxy_path = /_channelstream
444
449
445
450
446 ###################################
451 ###################################
447 ## APPENLIGHT CONFIG ##
452 ## APPENLIGHT CONFIG ##
448 ###################################
453 ###################################
449
454
450 ## Appenlight is tailored to work with RhodeCode, see
455 ## Appenlight is tailored to work with RhodeCode, see
451 ## http://appenlight.com for details how to obtain an account
456 ## http://appenlight.com for details how to obtain an account
452
457
453 ## Appenlight integration enabled
458 ## Appenlight integration enabled
454 appenlight = false
459 appenlight = false
455
460
456 appenlight.server_url = https://api.appenlight.com
461 appenlight.server_url = https://api.appenlight.com
457 appenlight.api_key = YOUR_API_KEY
462 appenlight.api_key = YOUR_API_KEY
458 #appenlight.transport_config = https://api.appenlight.com?threaded=1&timeout=5
463 #appenlight.transport_config = https://api.appenlight.com?threaded=1&timeout=5
459
464
460 ## used for JS client
465 ## used for JS client
461 appenlight.api_public_key = YOUR_API_PUBLIC_KEY
466 appenlight.api_public_key = YOUR_API_PUBLIC_KEY
462
467
463 ## TWEAK AMOUNT OF INFO SENT HERE
468 ## TWEAK AMOUNT OF INFO SENT HERE
464
469
465 ## enables 404 error logging (default False)
470 ## enables 404 error logging (default False)
466 appenlight.report_404 = false
471 appenlight.report_404 = false
467
472
468 ## time in seconds after request is considered being slow (default 1)
473 ## time in seconds after request is considered being slow (default 1)
469 appenlight.slow_request_time = 1
474 appenlight.slow_request_time = 1
470
475
471 ## record slow requests in application
476 ## record slow requests in application
472 ## (needs to be enabled for slow datastore recording and time tracking)
477 ## (needs to be enabled for slow datastore recording and time tracking)
473 appenlight.slow_requests = true
478 appenlight.slow_requests = true
474
479
475 ## enable hooking to application loggers
480 ## enable hooking to application loggers
476 appenlight.logging = true
481 appenlight.logging = true
477
482
478 ## minimum log level for log capture
483 ## minimum log level for log capture
479 appenlight.logging.level = WARNING
484 appenlight.logging.level = WARNING
480
485
481 ## send logs only from erroneous/slow requests
486 ## send logs only from erroneous/slow requests
482 ## (saves API quota for intensive logging)
487 ## (saves API quota for intensive logging)
483 appenlight.logging_on_error = false
488 appenlight.logging_on_error = false
484
489
485 ## list of additional keywords that should be grabbed from environ object
490 ## list of additional keywords that should be grabbed from environ object
486 ## can be string with comma separated list of words in lowercase
491 ## can be string with comma separated list of words in lowercase
487 ## (by default client will always send following info:
492 ## (by default client will always send following info:
488 ## 'REMOTE_USER', 'REMOTE_ADDR', 'SERVER_NAME', 'CONTENT_TYPE' + all keys that
493 ## 'REMOTE_USER', 'REMOTE_ADDR', 'SERVER_NAME', 'CONTENT_TYPE' + all keys that
489 ## start with HTTP* this list be extended with additional keywords here
494 ## start with HTTP* this list be extended with additional keywords here
490 appenlight.environ_keys_whitelist =
495 appenlight.environ_keys_whitelist =
491
496
492 ## list of keywords that should be blanked from request object
497 ## list of keywords that should be blanked from request object
493 ## can be string with comma separated list of words in lowercase
498 ## can be string with comma separated list of words in lowercase
494 ## (by default client will always blank keys that contain following words
499 ## (by default client will always blank keys that contain following words
495 ## 'password', 'passwd', 'pwd', 'auth_tkt', 'secret', 'csrf'
500 ## 'password', 'passwd', 'pwd', 'auth_tkt', 'secret', 'csrf'
496 ## this list be extended with additional keywords set here
501 ## this list be extended with additional keywords set here
497 appenlight.request_keys_blacklist =
502 appenlight.request_keys_blacklist =
498
503
499 ## list of namespaces that should be ignores when gathering log entries
504 ## list of namespaces that should be ignores when gathering log entries
500 ## can be string with comma separated list of namespaces
505 ## can be string with comma separated list of namespaces
501 ## (by default the client ignores own entries: appenlight_client.client)
506 ## (by default the client ignores own entries: appenlight_client.client)
502 appenlight.log_namespace_blacklist =
507 appenlight.log_namespace_blacklist =
503
508
504 # enable debug style page
509 # enable debug style page
505 debug_style = true
510 debug_style = true
506
511
507 ###########################################
512 ###########################################
508 ### MAIN RHODECODE DATABASE CONFIG ###
513 ### MAIN RHODECODE DATABASE CONFIG ###
509 ###########################################
514 ###########################################
510 #sqlalchemy.db1.url = sqlite:///%(here)s/rhodecode.db?timeout=30
515 #sqlalchemy.db1.url = sqlite:///%(here)s/rhodecode.db?timeout=30
511 #sqlalchemy.db1.url = postgresql://postgres:qweqwe@localhost/rhodecode
516 #sqlalchemy.db1.url = postgresql://postgres:qweqwe@localhost/rhodecode
512 #sqlalchemy.db1.url = mysql://root:qweqwe@localhost/rhodecode?charset=utf8
517 #sqlalchemy.db1.url = mysql://root:qweqwe@localhost/rhodecode?charset=utf8
513 # pymysql is an alternative driver for MySQL, use in case of problems with default one
518 # pymysql is an alternative driver for MySQL, use in case of problems with default one
514 #sqlalchemy.db1.url = mysql+pymysql://root:qweqwe@localhost/rhodecode
519 #sqlalchemy.db1.url = mysql+pymysql://root:qweqwe@localhost/rhodecode
515
520
516 sqlalchemy.db1.url = sqlite:///%(here)s/rhodecode.db?timeout=30
521 sqlalchemy.db1.url = sqlite:///%(here)s/rhodecode.db?timeout=30
517
522
518 # see sqlalchemy docs for other advanced settings
523 # see sqlalchemy docs for other advanced settings
519
524
520 ## print the sql statements to output
525 ## print the sql statements to output
521 sqlalchemy.db1.echo = false
526 sqlalchemy.db1.echo = false
522 ## recycle the connections after this amount of seconds
527 ## recycle the connections after this amount of seconds
523 sqlalchemy.db1.pool_recycle = 3600
528 sqlalchemy.db1.pool_recycle = 3600
524 sqlalchemy.db1.convert_unicode = true
529 sqlalchemy.db1.convert_unicode = true
525
530
526 ## the number of connections to keep open inside the connection pool.
531 ## the number of connections to keep open inside the connection pool.
527 ## 0 indicates no limit
532 ## 0 indicates no limit
528 #sqlalchemy.db1.pool_size = 5
533 #sqlalchemy.db1.pool_size = 5
529
534
530 ## the number of connections to allow in connection pool "overflow", that is
535 ## the number of connections to allow in connection pool "overflow", that is
531 ## connections that can be opened above and beyond the pool_size setting,
536 ## connections that can be opened above and beyond the pool_size setting,
532 ## which defaults to five.
537 ## which defaults to five.
533 #sqlalchemy.db1.max_overflow = 10
538 #sqlalchemy.db1.max_overflow = 10
534
539
535 ## Connection check ping, used to detect broken database connections
540 ## Connection check ping, used to detect broken database connections
536 ## could be enabled to better handle cases if MySQL has gone away errors
541 ## could be enabled to better handle cases if MySQL has gone away errors
537 #sqlalchemy.db1.ping_connection = true
542 #sqlalchemy.db1.ping_connection = true
538
543
539 ##################
544 ##################
540 ### VCS CONFIG ###
545 ### VCS CONFIG ###
541 ##################
546 ##################
542 vcs.server.enable = true
547 vcs.server.enable = true
543 vcs.server = localhost:9900
548 vcs.server = localhost:9900
544
549
545 ## Web server connectivity protocol, responsible for web based VCS operations
550 ## Web server connectivity protocol, responsible for web based VCS operations
546 ## Available protocols are:
551 ## Available protocols are:
547 ## `http` - use http-rpc backend (default)
552 ## `http` - use http-rpc backend (default)
548 vcs.server.protocol = http
553 vcs.server.protocol = http
549
554
550 ## Push/Pull operations protocol, available options are:
555 ## Push/Pull operations protocol, available options are:
551 ## `http` - use http-rpc backend (default)
556 ## `http` - use http-rpc backend (default)
552 vcs.scm_app_implementation = http
557 vcs.scm_app_implementation = http
553
558
554 ## Push/Pull operations hooks protocol, available options are:
559 ## Push/Pull operations hooks protocol, available options are:
555 ## `http` - use http-rpc backend (default)
560 ## `http` - use http-rpc backend (default)
556 vcs.hooks.protocol = http
561 vcs.hooks.protocol = http
557
562
558 ## Host on which this instance is listening for hooks. If vcsserver is in other location
563 ## Host on which this instance is listening for hooks. If vcsserver is in other location
559 ## this should be adjusted.
564 ## this should be adjusted.
560 vcs.hooks.host = 127.0.0.1
565 vcs.hooks.host = 127.0.0.1
561
566
562 vcs.server.log_level = debug
567 vcs.server.log_level = debug
563 ## Start VCSServer with this instance as a subprocess, useful for development
568 ## Start VCSServer with this instance as a subprocess, useful for development
564 vcs.start_server = false
569 vcs.start_server = false
565
570
566 ## List of enabled VCS backends, available options are:
571 ## List of enabled VCS backends, available options are:
567 ## `hg` - mercurial
572 ## `hg` - mercurial
568 ## `git` - git
573 ## `git` - git
569 ## `svn` - subversion
574 ## `svn` - subversion
570 vcs.backends = hg, git, svn
575 vcs.backends = hg, git, svn
571
576
572 vcs.connection_timeout = 3600
577 vcs.connection_timeout = 3600
573 ## Compatibility version when creating SVN repositories. Defaults to newest version when commented out.
578 ## Compatibility version when creating SVN repositories. Defaults to newest version when commented out.
574 ## Available options are: pre-1.4-compatible, pre-1.5-compatible, pre-1.6-compatible, pre-1.8-compatible, pre-1.9-compatible
579 ## Available options are: pre-1.4-compatible, pre-1.5-compatible, pre-1.6-compatible, pre-1.8-compatible, pre-1.9-compatible
575 #vcs.svn.compatible_version = pre-1.8-compatible
580 #vcs.svn.compatible_version = pre-1.8-compatible
576
581
577
582
578 ############################################################
583 ############################################################
579 ### Subversion proxy support (mod_dav_svn) ###
584 ### Subversion proxy support (mod_dav_svn) ###
580 ### Maps RhodeCode repo groups into SVN paths for Apache ###
585 ### Maps RhodeCode repo groups into SVN paths for Apache ###
581 ############################################################
586 ############################################################
582 ## Enable or disable the config file generation.
587 ## Enable or disable the config file generation.
583 svn.proxy.generate_config = false
588 svn.proxy.generate_config = false
584 ## Generate config file with `SVNListParentPath` set to `On`.
589 ## Generate config file with `SVNListParentPath` set to `On`.
585 svn.proxy.list_parent_path = true
590 svn.proxy.list_parent_path = true
586 ## Set location and file name of generated config file.
591 ## Set location and file name of generated config file.
587 svn.proxy.config_file_path = %(here)s/mod_dav_svn.conf
592 svn.proxy.config_file_path = %(here)s/mod_dav_svn.conf
588 ## alternative mod_dav config template. This needs to be a mako template
593 ## alternative mod_dav config template. This needs to be a mako template
589 #svn.proxy.config_template = ~/.rccontrol/enterprise-1/custom_svn_conf.mako
594 #svn.proxy.config_template = ~/.rccontrol/enterprise-1/custom_svn_conf.mako
590 ## Used as a prefix to the `Location` block in the generated config file.
595 ## Used as a prefix to the `Location` block in the generated config file.
591 ## In most cases it should be set to `/`.
596 ## In most cases it should be set to `/`.
592 svn.proxy.location_root = /
597 svn.proxy.location_root = /
593 ## Command to reload the mod dav svn configuration on change.
598 ## Command to reload the mod dav svn configuration on change.
594 ## Example: `/etc/init.d/apache2 reload` or /home/USER/apache_reload.sh
599 ## Example: `/etc/init.d/apache2 reload` or /home/USER/apache_reload.sh
595 ## Make sure user who runs RhodeCode process is allowed to reload Apache
600 ## Make sure user who runs RhodeCode process is allowed to reload Apache
596 #svn.proxy.reload_cmd = /etc/init.d/apache2 reload
601 #svn.proxy.reload_cmd = /etc/init.d/apache2 reload
597 ## If the timeout expires before the reload command finishes, the command will
602 ## If the timeout expires before the reload command finishes, the command will
598 ## be killed. Setting it to zero means no timeout. Defaults to 10 seconds.
603 ## be killed. Setting it to zero means no timeout. Defaults to 10 seconds.
599 #svn.proxy.reload_timeout = 10
604 #svn.proxy.reload_timeout = 10
600
605
601 ############################################################
606 ############################################################
602 ### SSH Support Settings ###
607 ### SSH Support Settings ###
603 ############################################################
608 ############################################################
604
609
605 ## Defines if a custom authorized_keys file should be created and written on
610 ## Defines if a custom authorized_keys file should be created and written on
606 ## any change user ssh keys. Setting this to false also disables possibility
611 ## any change user ssh keys. Setting this to false also disables possibility
607 ## of adding SSH keys by users from web interface. Super admins can still
612 ## of adding SSH keys by users from web interface. Super admins can still
608 ## manage SSH Keys.
613 ## manage SSH Keys.
609 ssh.generate_authorized_keyfile = false
614 ssh.generate_authorized_keyfile = false
610
615
611 ## Options for ssh, default is `no-pty,no-port-forwarding,no-X11-forwarding,no-agent-forwarding`
616 ## Options for ssh, default is `no-pty,no-port-forwarding,no-X11-forwarding,no-agent-forwarding`
612 # ssh.authorized_keys_ssh_opts =
617 # ssh.authorized_keys_ssh_opts =
613
618
614 ## Path to the authorized_keys file where the generate entries are placed.
619 ## Path to the authorized_keys file where the generate entries are placed.
615 ## It is possible to have multiple key files specified in `sshd_config` e.g.
620 ## It is possible to have multiple key files specified in `sshd_config` e.g.
616 ## AuthorizedKeysFile %h/.ssh/authorized_keys %h/.ssh/authorized_keys_rhodecode
621 ## AuthorizedKeysFile %h/.ssh/authorized_keys %h/.ssh/authorized_keys_rhodecode
617 ssh.authorized_keys_file_path = ~/.ssh/authorized_keys_rhodecode
622 ssh.authorized_keys_file_path = ~/.ssh/authorized_keys_rhodecode
618
623
619 ## Command to execute the SSH wrapper. The binary is available in the
624 ## Command to execute the SSH wrapper. The binary is available in the
620 ## RhodeCode installation directory.
625 ## RhodeCode installation directory.
621 ## e.g ~/.rccontrol/community-1/profile/bin/rc-ssh-wrapper
626 ## e.g ~/.rccontrol/community-1/profile/bin/rc-ssh-wrapper
622 ssh.wrapper_cmd = ~/.rccontrol/community-1/rc-ssh-wrapper
627 ssh.wrapper_cmd = ~/.rccontrol/community-1/rc-ssh-wrapper
623
628
624 ## Allow shell when executing the ssh-wrapper command
629 ## Allow shell when executing the ssh-wrapper command
625 ssh.wrapper_cmd_allow_shell = false
630 ssh.wrapper_cmd_allow_shell = false
626
631
627 ## Enables logging, and detailed output send back to the client during SSH
632 ## Enables logging, and detailed output send back to the client during SSH
628 ## operations. Useful for debugging, shouldn't be used in production.
633 ## operations. Useful for debugging, shouldn't be used in production.
629 ssh.enable_debug_logging = true
634 ssh.enable_debug_logging = true
630
635
631 ## Paths to binary executable, by default they are the names, but we can
636 ## Paths to binary executable, by default they are the names, but we can
632 ## override them if we want to use a custom one
637 ## override them if we want to use a custom one
633 ssh.executable.hg = ~/.rccontrol/vcsserver-1/profile/bin/hg
638 ssh.executable.hg = ~/.rccontrol/vcsserver-1/profile/bin/hg
634 ssh.executable.git = ~/.rccontrol/vcsserver-1/profile/bin/git
639 ssh.executable.git = ~/.rccontrol/vcsserver-1/profile/bin/git
635 ssh.executable.svn = ~/.rccontrol/vcsserver-1/profile/bin/svnserve
640 ssh.executable.svn = ~/.rccontrol/vcsserver-1/profile/bin/svnserve
636
641
637 ## Enables SSH key generator web interface. Disabling this still allows users
642 ## Enables SSH key generator web interface. Disabling this still allows users
638 ## to add their own keys.
643 ## to add their own keys.
639 ssh.enable_ui_key_generator = true
644 ssh.enable_ui_key_generator = true
640
645
641
646
642 ## Dummy marker to add new entries after.
647 ## Dummy marker to add new entries after.
643 ## Add any custom entries below. Please don't remove.
648 ## Add any custom entries below. Please don't remove.
644 custom.conf = 1
649 custom.conf = 1
645
650
646
651
647 ################################
652 ################################
648 ### LOGGING CONFIGURATION ####
653 ### LOGGING CONFIGURATION ####
649 ################################
654 ################################
650 [loggers]
655 [loggers]
651 keys = root, sqlalchemy, beaker, celery, rhodecode, ssh_wrapper
656 keys = root, sqlalchemy, beaker, celery, rhodecode, ssh_wrapper
652
657
653 [handlers]
658 [handlers]
654 keys = console, console_sql
659 keys = console, console_sql
655
660
656 [formatters]
661 [formatters]
657 keys = generic, color_formatter, color_formatter_sql
662 keys = generic, color_formatter, color_formatter_sql
658
663
659 #############
664 #############
660 ## LOGGERS ##
665 ## LOGGERS ##
661 #############
666 #############
662 [logger_root]
667 [logger_root]
663 level = NOTSET
668 level = NOTSET
664 handlers = console
669 handlers = console
665
670
666 [logger_sqlalchemy]
671 [logger_sqlalchemy]
667 level = INFO
672 level = INFO
668 handlers = console_sql
673 handlers = console_sql
669 qualname = sqlalchemy.engine
674 qualname = sqlalchemy.engine
670 propagate = 0
675 propagate = 0
671
676
672 [logger_beaker]
677 [logger_beaker]
673 level = DEBUG
678 level = DEBUG
674 handlers =
679 handlers =
675 qualname = beaker.container
680 qualname = beaker.container
676 propagate = 1
681 propagate = 1
677
682
678 [logger_rhodecode]
683 [logger_rhodecode]
679 level = DEBUG
684 level = DEBUG
680 handlers =
685 handlers =
681 qualname = rhodecode
686 qualname = rhodecode
682 propagate = 1
687 propagate = 1
683
688
684 [logger_ssh_wrapper]
689 [logger_ssh_wrapper]
685 level = DEBUG
690 level = DEBUG
686 handlers =
691 handlers =
687 qualname = ssh_wrapper
692 qualname = ssh_wrapper
688 propagate = 1
693 propagate = 1
689
694
690 [logger_celery]
695 [logger_celery]
691 level = DEBUG
696 level = DEBUG
692 handlers =
697 handlers =
693 qualname = celery
698 qualname = celery
694
699
695
700
696 ##############
701 ##############
697 ## HANDLERS ##
702 ## HANDLERS ##
698 ##############
703 ##############
699
704
700 [handler_console]
705 [handler_console]
701 class = StreamHandler
706 class = StreamHandler
702 args = (sys.stderr, )
707 args = (sys.stderr, )
703 level = DEBUG
708 level = DEBUG
704 formatter = color_formatter
709 formatter = color_formatter
705
710
706 [handler_console_sql]
711 [handler_console_sql]
707 # "level = DEBUG" logs SQL queries and results.
712 # "level = DEBUG" logs SQL queries and results.
708 # "level = INFO" logs SQL queries.
713 # "level = INFO" logs SQL queries.
709 # "level = WARN" logs neither. (Recommended for production systems.)
714 # "level = WARN" logs neither. (Recommended for production systems.)
710 class = StreamHandler
715 class = StreamHandler
711 args = (sys.stderr, )
716 args = (sys.stderr, )
712 level = WARN
717 level = WARN
713 formatter = color_formatter_sql
718 formatter = color_formatter_sql
714
719
715 ################
720 ################
716 ## FORMATTERS ##
721 ## FORMATTERS ##
717 ################
722 ################
718
723
719 [formatter_generic]
724 [formatter_generic]
720 class = rhodecode.lib.logging_formatter.ExceptionAwareFormatter
725 class = rhodecode.lib.logging_formatter.ExceptionAwareFormatter
721 format = %(asctime)s.%(msecs)03d [%(process)d] %(levelname)-5.5s [%(name)s] %(message)s
726 format = %(asctime)s.%(msecs)03d [%(process)d] %(levelname)-5.5s [%(name)s] %(message)s
722 datefmt = %Y-%m-%d %H:%M:%S
727 datefmt = %Y-%m-%d %H:%M:%S
723
728
724 [formatter_color_formatter]
729 [formatter_color_formatter]
725 class = rhodecode.lib.logging_formatter.ColorFormatter
730 class = rhodecode.lib.logging_formatter.ColorFormatter
726 format = %(asctime)s.%(msecs)03d [%(process)d] %(levelname)-5.5s [%(name)s] %(message)s
731 format = %(asctime)s.%(msecs)03d [%(process)d] %(levelname)-5.5s [%(name)s] %(message)s
727 datefmt = %Y-%m-%d %H:%M:%S
732 datefmt = %Y-%m-%d %H:%M:%S
728
733
729 [formatter_color_formatter_sql]
734 [formatter_color_formatter_sql]
730 class = rhodecode.lib.logging_formatter.ColorFormatterSql
735 class = rhodecode.lib.logging_formatter.ColorFormatterSql
731 format = %(asctime)s.%(msecs)03d [%(process)d] %(levelname)-5.5s [%(name)s] %(message)s
736 format = %(asctime)s.%(msecs)03d [%(process)d] %(levelname)-5.5s [%(name)s] %(message)s
732 datefmt = %Y-%m-%d %H:%M:%S
737 datefmt = %Y-%m-%d %H:%M:%S
@@ -1,705 +1,710 b''
1
1
2
2
3 ################################################################################
3 ################################################################################
4 ## RHODECODE COMMUNITY EDITION CONFIGURATION ##
4 ## RHODECODE COMMUNITY EDITION CONFIGURATION ##
5 ################################################################################
5 ################################################################################
6
6
7 [DEFAULT]
7 [DEFAULT]
8 ## Debug flag sets all loggers to debug, and enables request tracking
8 ## Debug flag sets all loggers to debug, and enables request tracking
9 debug = false
9 debug = false
10
10
11 ################################################################################
11 ################################################################################
12 ## EMAIL CONFIGURATION ##
12 ## EMAIL CONFIGURATION ##
13 ## Uncomment and replace with the email address which should receive ##
13 ## Uncomment and replace with the email address which should receive ##
14 ## any error reports after an application crash ##
14 ## any error reports after an application crash ##
15 ## Additionally these settings will be used by the RhodeCode mailing system ##
15 ## Additionally these settings will be used by the RhodeCode mailing system ##
16 ################################################################################
16 ################################################################################
17
17
18 ## prefix all emails subjects with given prefix, helps filtering out emails
18 ## prefix all emails subjects with given prefix, helps filtering out emails
19 #email_prefix = [RhodeCode]
19 #email_prefix = [RhodeCode]
20
20
21 ## email FROM address all mails will be sent
21 ## email FROM address all mails will be sent
22 #app_email_from = rhodecode-noreply@localhost
22 #app_email_from = rhodecode-noreply@localhost
23
23
24 #smtp_server = mail.server.com
24 #smtp_server = mail.server.com
25 #smtp_username =
25 #smtp_username =
26 #smtp_password =
26 #smtp_password =
27 #smtp_port =
27 #smtp_port =
28 #smtp_use_tls = false
28 #smtp_use_tls = false
29 #smtp_use_ssl = true
29 #smtp_use_ssl = true
30
30
31 [server:main]
31 [server:main]
32 ## COMMON ##
32 ## COMMON ##
33 host = 127.0.0.1
33 host = 127.0.0.1
34 port = 5000
34 port = 5000
35
35
36 ###########################################################
36 ###########################################################
37 ## WAITRESS WSGI SERVER - Recommended for Development ####
37 ## WAITRESS WSGI SERVER - Recommended for Development ####
38 ###########################################################
38 ###########################################################
39
39
40 #use = egg:waitress#main
40 #use = egg:waitress#main
41 ## number of worker threads
41 ## number of worker threads
42 #threads = 5
42 #threads = 5
43 ## MAX BODY SIZE 100GB
43 ## MAX BODY SIZE 100GB
44 #max_request_body_size = 107374182400
44 #max_request_body_size = 107374182400
45 ## Use poll instead of select, fixes file descriptors limits problems.
45 ## Use poll instead of select, fixes file descriptors limits problems.
46 ## May not work on old windows systems.
46 ## May not work on old windows systems.
47 #asyncore_use_poll = true
47 #asyncore_use_poll = true
48
48
49
49
50 ##########################
50 ##########################
51 ## GUNICORN WSGI SERVER ##
51 ## GUNICORN WSGI SERVER ##
52 ##########################
52 ##########################
53 ## run with gunicorn --log-config rhodecode.ini --paste rhodecode.ini
53 ## run with gunicorn --log-config rhodecode.ini --paste rhodecode.ini
54
54
55 use = egg:gunicorn#main
55 use = egg:gunicorn#main
56 ## Sets the number of process workers. More workers means more concurrent connections
56 ## Sets the number of process workers. More workers means more concurrent connections
57 ## RhodeCode can handle at the same time. Each additional worker also it increases
57 ## RhodeCode can handle at the same time. Each additional worker also it increases
58 ## memory usage as each has it's own set of caches.
58 ## memory usage as each has it's own set of caches.
59 ## Recommended value is (2 * NUMBER_OF_CPUS + 1), eg 2CPU = 5 workers, but no more
59 ## Recommended value is (2 * NUMBER_OF_CPUS + 1), eg 2CPU = 5 workers, but no more
60 ## than 8-10 unless for really big deployments .e.g 700-1000 users.
60 ## than 8-10 unless for really big deployments .e.g 700-1000 users.
61 ## `instance_id = *` must be set in the [app:main] section below (which is the default)
61 ## `instance_id = *` must be set in the [app:main] section below (which is the default)
62 ## when using more than 1 worker.
62 ## when using more than 1 worker.
63 workers = 2
63 workers = 2
64 ## process name visible in process list
64 ## process name visible in process list
65 proc_name = rhodecode
65 proc_name = rhodecode
66 ## type of worker class, one of sync, gevent
66 ## type of worker class, one of sync, gevent
67 ## recommended for bigger setup is using of of other than sync one
67 ## recommended for bigger setup is using of of other than sync one
68 worker_class = gevent
68 worker_class = gevent
69 ## The maximum number of simultaneous clients. Valid only for Gevent
69 ## The maximum number of simultaneous clients. Valid only for Gevent
70 worker_connections = 10
70 worker_connections = 10
71 ## max number of requests that worker will handle before being gracefully
71 ## max number of requests that worker will handle before being gracefully
72 ## restarted, could prevent memory leaks
72 ## restarted, could prevent memory leaks
73 max_requests = 1000
73 max_requests = 1000
74 max_requests_jitter = 30
74 max_requests_jitter = 30
75 ## amount of time a worker can spend with handling a request before it
75 ## amount of time a worker can spend with handling a request before it
76 ## gets killed and restarted. Set to 6hrs
76 ## gets killed and restarted. Set to 6hrs
77 timeout = 21600
77 timeout = 21600
78
78
79
79
80 ## prefix middleware for RhodeCode.
80 ## prefix middleware for RhodeCode.
81 ## recommended when using proxy setup.
81 ## recommended when using proxy setup.
82 ## allows to set RhodeCode under a prefix in server.
82 ## allows to set RhodeCode under a prefix in server.
83 ## eg https://server.com/custom_prefix. Enable `filter-with =` option below as well.
83 ## eg https://server.com/custom_prefix. Enable `filter-with =` option below as well.
84 ## And set your prefix like: `prefix = /custom_prefix`
84 ## And set your prefix like: `prefix = /custom_prefix`
85 ## be sure to also set beaker.session.cookie_path = /custom_prefix if you need
85 ## be sure to also set beaker.session.cookie_path = /custom_prefix if you need
86 ## to make your cookies only work on prefix url
86 ## to make your cookies only work on prefix url
87 [filter:proxy-prefix]
87 [filter:proxy-prefix]
88 use = egg:PasteDeploy#prefix
88 use = egg:PasteDeploy#prefix
89 prefix = /
89 prefix = /
90
90
91 [app:main]
91 [app:main]
92 ## The %(here)s variable will be replaced with the absolute path of parent directory
92 ## The %(here)s variable will be replaced with the absolute path of parent directory
93 ## of this file
93 ## of this file
94 ## In addition ENVIRONMENT variables usage is possible, e.g
94 ## In addition ENVIRONMENT variables usage is possible, e.g
95 ## sqlalchemy.db1.url = {ENV_RC_DB_URL}
95 ## sqlalchemy.db1.url = {ENV_RC_DB_URL}
96
96
97 use = egg:rhodecode-enterprise-ce
97 use = egg:rhodecode-enterprise-ce
98
98
99 ## enable proxy prefix middleware, defined above
99 ## enable proxy prefix middleware, defined above
100 #filter-with = proxy-prefix
100 #filter-with = proxy-prefix
101
101
102 ## encryption key used to encrypt social plugin tokens,
102 ## encryption key used to encrypt social plugin tokens,
103 ## remote_urls with credentials etc, if not set it defaults to
103 ## remote_urls with credentials etc, if not set it defaults to
104 ## `beaker.session.secret`
104 ## `beaker.session.secret`
105 #rhodecode.encrypted_values.secret =
105 #rhodecode.encrypted_values.secret =
106
106
107 ## decryption strict mode (enabled by default). It controls if decryption raises
107 ## decryption strict mode (enabled by default). It controls if decryption raises
108 ## `SignatureVerificationError` in case of wrong key, or damaged encryption data.
108 ## `SignatureVerificationError` in case of wrong key, or damaged encryption data.
109 #rhodecode.encrypted_values.strict = false
109 #rhodecode.encrypted_values.strict = false
110
110
111 ## Pick algorithm for encryption. Either fernet (more secure) or aes (default)
112 ## fernet is safer, and we strongly recommend switching to it.
113 ## Due to backward compatibility aes is used as default.
114 #rhodecode.encrypted_values.algorithm = fernet
115
111 ## return gzipped responses from RhodeCode (static files/application)
116 ## return gzipped responses from RhodeCode (static files/application)
112 gzip_responses = false
117 gzip_responses = false
113
118
114 ## auto-generate javascript routes file on startup
119 ## auto-generate javascript routes file on startup
115 generate_js_files = false
120 generate_js_files = false
116
121
117 ## System global default language.
122 ## System global default language.
118 ## All available languages: en(default), be, de, es, fr, it, ja, pl, pt, ru, zh
123 ## All available languages: en(default), be, de, es, fr, it, ja, pl, pt, ru, zh
119 lang = en
124 lang = en
120
125
121 ## Perform a full repository scan and import on each server start.
126 ## Perform a full repository scan and import on each server start.
122 ## Settings this to true could lead to very long startup time.
127 ## Settings this to true could lead to very long startup time.
123 startup.import_repos = false
128 startup.import_repos = false
124
129
125 ## Uncomment and set this path to use archive download cache.
130 ## Uncomment and set this path to use archive download cache.
126 ## Once enabled, generated archives will be cached at this location
131 ## Once enabled, generated archives will be cached at this location
127 ## and served from the cache during subsequent requests for the same archive of
132 ## and served from the cache during subsequent requests for the same archive of
128 ## the repository.
133 ## the repository.
129 #archive_cache_dir = /tmp/tarballcache
134 #archive_cache_dir = /tmp/tarballcache
130
135
131 ## URL at which the application is running. This is used for Bootstrapping
136 ## URL at which the application is running. This is used for Bootstrapping
132 ## requests in context when no web request is available. Used in ishell, or
137 ## requests in context when no web request is available. Used in ishell, or
133 ## SSH calls. Set this for events to receive proper url for SSH calls.
138 ## SSH calls. Set this for events to receive proper url for SSH calls.
134 app.base_url = http://rhodecode.local
139 app.base_url = http://rhodecode.local
135
140
136 ## Unique application ID. Should be a random unique string for security.
141 ## Unique application ID. Should be a random unique string for security.
137 app_instance_uuid = rc-production
142 app_instance_uuid = rc-production
138
143
139 ## Cut off limit for large diffs (size in bytes). If overall diff size on
144 ## Cut off limit for large diffs (size in bytes). If overall diff size on
140 ## commit, or pull request exceeds this limit this diff will be displayed
145 ## commit, or pull request exceeds this limit this diff will be displayed
141 ## partially. E.g 512000 == 512Kb
146 ## partially. E.g 512000 == 512Kb
142 cut_off_limit_diff = 512000
147 cut_off_limit_diff = 512000
143
148
144 ## Cut off limit for large files inside diffs (size in bytes). Each individual
149 ## Cut off limit for large files inside diffs (size in bytes). Each individual
145 ## file inside diff which exceeds this limit will be displayed partially.
150 ## file inside diff which exceeds this limit will be displayed partially.
146 ## E.g 128000 == 128Kb
151 ## E.g 128000 == 128Kb
147 cut_off_limit_file = 128000
152 cut_off_limit_file = 128000
148
153
149 ## use cached version of vcs repositories everywhere. Recommended to be `true`
154 ## use cached version of vcs repositories everywhere. Recommended to be `true`
150 vcs_full_cache = true
155 vcs_full_cache = true
151
156
152 ## Force https in RhodeCode, fixes https redirects, assumes it's always https.
157 ## Force https in RhodeCode, fixes https redirects, assumes it's always https.
153 ## Normally this is controlled by proper http flags sent from http server
158 ## Normally this is controlled by proper http flags sent from http server
154 force_https = false
159 force_https = false
155
160
156 ## use Strict-Transport-Security headers
161 ## use Strict-Transport-Security headers
157 use_htsts = false
162 use_htsts = false
158
163
159 ## git rev filter option, --all is the default filter, if you need to
164 ## git rev filter option, --all is the default filter, if you need to
160 ## hide all refs in changelog switch this to --branches --tags
165 ## hide all refs in changelog switch this to --branches --tags
161 git_rev_filter = --branches --tags
166 git_rev_filter = --branches --tags
162
167
163 # Set to true if your repos are exposed using the dumb protocol
168 # Set to true if your repos are exposed using the dumb protocol
164 git_update_server_info = false
169 git_update_server_info = false
165
170
166 ## RSS/ATOM feed options
171 ## RSS/ATOM feed options
167 rss_cut_off_limit = 256000
172 rss_cut_off_limit = 256000
168 rss_items_per_page = 10
173 rss_items_per_page = 10
169 rss_include_diff = false
174 rss_include_diff = false
170
175
171 ## gist URL alias, used to create nicer urls for gist. This should be an
176 ## gist URL alias, used to create nicer urls for gist. This should be an
172 ## url that does rewrites to _admin/gists/{gistid}.
177 ## url that does rewrites to _admin/gists/{gistid}.
173 ## example: http://gist.rhodecode.org/{gistid}. Empty means use the internal
178 ## example: http://gist.rhodecode.org/{gistid}. Empty means use the internal
174 ## RhodeCode url, ie. http[s]://rhodecode.server/_admin/gists/{gistid}
179 ## RhodeCode url, ie. http[s]://rhodecode.server/_admin/gists/{gistid}
175 gist_alias_url =
180 gist_alias_url =
176
181
177 ## List of views (using glob pattern syntax) that AUTH TOKENS could be
182 ## List of views (using glob pattern syntax) that AUTH TOKENS could be
178 ## used for access.
183 ## used for access.
179 ## Adding ?auth_token=TOKEN_HASH to the url authenticates this request as if it
184 ## Adding ?auth_token=TOKEN_HASH to the url authenticates this request as if it
180 ## came from the the logged in user who own this authentication token.
185 ## came from the the logged in user who own this authentication token.
181 ## Additionally @TOKEN syntax can be used to bound the view to specific
186 ## Additionally @TOKEN syntax can be used to bound the view to specific
182 ## authentication token. Such view would be only accessible when used together
187 ## authentication token. Such view would be only accessible when used together
183 ## with this authentication token
188 ## with this authentication token
184 ##
189 ##
185 ## list of all views can be found under `/_admin/permissions/auth_token_access`
190 ## list of all views can be found under `/_admin/permissions/auth_token_access`
186 ## The list should be "," separated and on a single line.
191 ## The list should be "," separated and on a single line.
187 ##
192 ##
188 ## Most common views to enable:
193 ## Most common views to enable:
189 # RepoCommitsView:repo_commit_download
194 # RepoCommitsView:repo_commit_download
190 # RepoCommitsView:repo_commit_patch
195 # RepoCommitsView:repo_commit_patch
191 # RepoCommitsView:repo_commit_raw
196 # RepoCommitsView:repo_commit_raw
192 # RepoCommitsView:repo_commit_raw@TOKEN
197 # RepoCommitsView:repo_commit_raw@TOKEN
193 # RepoFilesView:repo_files_diff
198 # RepoFilesView:repo_files_diff
194 # RepoFilesView:repo_archivefile
199 # RepoFilesView:repo_archivefile
195 # RepoFilesView:repo_file_raw
200 # RepoFilesView:repo_file_raw
196 # GistView:*
201 # GistView:*
197 api_access_controllers_whitelist =
202 api_access_controllers_whitelist =
198
203
199 ## Default encoding used to convert from and to unicode
204 ## Default encoding used to convert from and to unicode
200 ## can be also a comma separated list of encoding in case of mixed encodings
205 ## can be also a comma separated list of encoding in case of mixed encodings
201 default_encoding = UTF-8
206 default_encoding = UTF-8
202
207
203 ## instance-id prefix
208 ## instance-id prefix
204 ## a prefix key for this instance used for cache invalidation when running
209 ## a prefix key for this instance used for cache invalidation when running
205 ## multiple instances of RhodeCode, make sure it's globally unique for
210 ## multiple instances of RhodeCode, make sure it's globally unique for
206 ## all running RhodeCode instances. Leave empty if you don't use it
211 ## all running RhodeCode instances. Leave empty if you don't use it
207 instance_id =
212 instance_id =
208
213
209 ## Fallback authentication plugin. Set this to a plugin ID to force the usage
214 ## Fallback authentication plugin. Set this to a plugin ID to force the usage
210 ## of an authentication plugin also if it is disabled by it's settings.
215 ## of an authentication plugin also if it is disabled by it's settings.
211 ## This could be useful if you are unable to log in to the system due to broken
216 ## This could be useful if you are unable to log in to the system due to broken
212 ## authentication settings. Then you can enable e.g. the internal RhodeCode auth
217 ## authentication settings. Then you can enable e.g. the internal RhodeCode auth
213 ## module to log in again and fix the settings.
218 ## module to log in again and fix the settings.
214 ##
219 ##
215 ## Available builtin plugin IDs (hash is part of the ID):
220 ## Available builtin plugin IDs (hash is part of the ID):
216 ## egg:rhodecode-enterprise-ce#rhodecode
221 ## egg:rhodecode-enterprise-ce#rhodecode
217 ## egg:rhodecode-enterprise-ce#pam
222 ## egg:rhodecode-enterprise-ce#pam
218 ## egg:rhodecode-enterprise-ce#ldap
223 ## egg:rhodecode-enterprise-ce#ldap
219 ## egg:rhodecode-enterprise-ce#jasig_cas
224 ## egg:rhodecode-enterprise-ce#jasig_cas
220 ## egg:rhodecode-enterprise-ce#headers
225 ## egg:rhodecode-enterprise-ce#headers
221 ## egg:rhodecode-enterprise-ce#crowd
226 ## egg:rhodecode-enterprise-ce#crowd
222 #rhodecode.auth_plugin_fallback = egg:rhodecode-enterprise-ce#rhodecode
227 #rhodecode.auth_plugin_fallback = egg:rhodecode-enterprise-ce#rhodecode
223
228
224 ## alternative return HTTP header for failed authentication. Default HTTP
229 ## alternative return HTTP header for failed authentication. Default HTTP
225 ## response is 401 HTTPUnauthorized. Currently HG clients have troubles with
230 ## response is 401 HTTPUnauthorized. Currently HG clients have troubles with
226 ## handling that causing a series of failed authentication calls.
231 ## handling that causing a series of failed authentication calls.
227 ## Set this variable to 403 to return HTTPForbidden, or any other HTTP code
232 ## Set this variable to 403 to return HTTPForbidden, or any other HTTP code
228 ## This will be served instead of default 401 on bad authentication
233 ## This will be served instead of default 401 on bad authentication
229 auth_ret_code =
234 auth_ret_code =
230
235
231 ## use special detection method when serving auth_ret_code, instead of serving
236 ## use special detection method when serving auth_ret_code, instead of serving
232 ## ret_code directly, use 401 initially (Which triggers credentials prompt)
237 ## ret_code directly, use 401 initially (Which triggers credentials prompt)
233 ## and then serve auth_ret_code to clients
238 ## and then serve auth_ret_code to clients
234 auth_ret_code_detection = false
239 auth_ret_code_detection = false
235
240
236 ## locking return code. When repository is locked return this HTTP code. 2XX
241 ## locking return code. When repository is locked return this HTTP code. 2XX
237 ## codes don't break the transactions while 4XX codes do
242 ## codes don't break the transactions while 4XX codes do
238 lock_ret_code = 423
243 lock_ret_code = 423
239
244
240 ## allows to change the repository location in settings page
245 ## allows to change the repository location in settings page
241 allow_repo_location_change = true
246 allow_repo_location_change = true
242
247
243 ## allows to setup custom hooks in settings page
248 ## allows to setup custom hooks in settings page
244 allow_custom_hooks_settings = true
249 allow_custom_hooks_settings = true
245
250
246 ## Generated license token required for EE edition license.
251 ## Generated license token required for EE edition license.
247 ## New generated token value can be found in Admin > settings > license page.
252 ## New generated token value can be found in Admin > settings > license page.
248 license_token =
253 license_token =
249
254
250 ## supervisor connection uri, for managing supervisor and logs.
255 ## supervisor connection uri, for managing supervisor and logs.
251 supervisor.uri =
256 supervisor.uri =
252 ## supervisord group name/id we only want this RC instance to handle
257 ## supervisord group name/id we only want this RC instance to handle
253 supervisor.group_id = prod
258 supervisor.group_id = prod
254
259
255 ## Display extended labs settings
260 ## Display extended labs settings
256 labs_settings_active = true
261 labs_settings_active = true
257
262
258 ## Custom exception store path, defaults to TMPDIR
263 ## Custom exception store path, defaults to TMPDIR
259 ## This is used to store exception from RhodeCode in shared directory
264 ## This is used to store exception from RhodeCode in shared directory
260 #exception_tracker.store_path =
265 #exception_tracker.store_path =
261
266
262 ## File store configuration. This is used to store and serve uploaded files
267 ## File store configuration. This is used to store and serve uploaded files
263 file_store.enabled = true
268 file_store.enabled = true
264 ## Storage backend, available options are: local
269 ## Storage backend, available options are: local
265 file_store.backend = local
270 file_store.backend = local
266 ## path to store the uploaded binaries
271 ## path to store the uploaded binaries
267 file_store.storage_path = %(here)s/data/file_store
272 file_store.storage_path = %(here)s/data/file_store
268
273
269
274
270 ####################################
275 ####################################
271 ### CELERY CONFIG ####
276 ### CELERY CONFIG ####
272 ####################################
277 ####################################
273 ## run: /path/to/celery worker \
278 ## run: /path/to/celery worker \
274 ## -E --beat --app rhodecode.lib.celerylib.loader \
279 ## -E --beat --app rhodecode.lib.celerylib.loader \
275 ## --scheduler rhodecode.lib.celerylib.scheduler.RcScheduler \
280 ## --scheduler rhodecode.lib.celerylib.scheduler.RcScheduler \
276 ## --loglevel DEBUG --ini /path/to/rhodecode.ini
281 ## --loglevel DEBUG --ini /path/to/rhodecode.ini
277
282
278 use_celery = false
283 use_celery = false
279
284
280 ## connection url to the message broker (default rabbitmq)
285 ## connection url to the message broker (default rabbitmq)
281 celery.broker_url = amqp://rabbitmq:qweqwe@localhost:5672/rabbitmqhost
286 celery.broker_url = amqp://rabbitmq:qweqwe@localhost:5672/rabbitmqhost
282
287
283 ## maximum tasks to execute before worker restart
288 ## maximum tasks to execute before worker restart
284 celery.max_tasks_per_child = 100
289 celery.max_tasks_per_child = 100
285
290
286 ## tasks will never be sent to the queue, but executed locally instead.
291 ## tasks will never be sent to the queue, but executed locally instead.
287 celery.task_always_eager = false
292 celery.task_always_eager = false
288
293
289 #####################################
294 #####################################
290 ### DOGPILE CACHE ####
295 ### DOGPILE CACHE ####
291 #####################################
296 #####################################
292 ## Default cache dir for caches. Putting this into a ramdisk
297 ## Default cache dir for caches. Putting this into a ramdisk
293 ## can boost performance, eg. /tmpfs/data_ramdisk, however this directory might require
298 ## can boost performance, eg. /tmpfs/data_ramdisk, however this directory might require
294 ## large amount of space
299 ## large amount of space
295 cache_dir = %(here)s/data
300 cache_dir = %(here)s/data
296
301
297 ## `cache_perms` cache settings for permission tree, auth TTL.
302 ## `cache_perms` cache settings for permission tree, auth TTL.
298 rc_cache.cache_perms.backend = dogpile.cache.rc.file_namespace
303 rc_cache.cache_perms.backend = dogpile.cache.rc.file_namespace
299 rc_cache.cache_perms.expiration_time = 300
304 rc_cache.cache_perms.expiration_time = 300
300
305
301 ## alternative `cache_perms` redis backend with distributed lock
306 ## alternative `cache_perms` redis backend with distributed lock
302 #rc_cache.cache_perms.backend = dogpile.cache.rc.redis
307 #rc_cache.cache_perms.backend = dogpile.cache.rc.redis
303 #rc_cache.cache_perms.expiration_time = 300
308 #rc_cache.cache_perms.expiration_time = 300
304 ## redis_expiration_time needs to be greater then expiration_time
309 ## redis_expiration_time needs to be greater then expiration_time
305 #rc_cache.cache_perms.arguments.redis_expiration_time = 7200
310 #rc_cache.cache_perms.arguments.redis_expiration_time = 7200
306 #rc_cache.cache_perms.arguments.socket_timeout = 30
311 #rc_cache.cache_perms.arguments.socket_timeout = 30
307 #rc_cache.cache_perms.arguments.host = localhost
312 #rc_cache.cache_perms.arguments.host = localhost
308 #rc_cache.cache_perms.arguments.port = 6379
313 #rc_cache.cache_perms.arguments.port = 6379
309 #rc_cache.cache_perms.arguments.db = 0
314 #rc_cache.cache_perms.arguments.db = 0
310 ## more Redis options: https://dogpilecache.sqlalchemy.org/en/latest/api.html#redis-backends
315 ## more Redis options: https://dogpilecache.sqlalchemy.org/en/latest/api.html#redis-backends
311 #rc_cache.cache_perms.arguments.distributed_lock = true
316 #rc_cache.cache_perms.arguments.distributed_lock = true
312
317
313 ## `cache_repo` cache settings for FileTree, Readme, RSS FEEDS
318 ## `cache_repo` cache settings for FileTree, Readme, RSS FEEDS
314 rc_cache.cache_repo.backend = dogpile.cache.rc.file_namespace
319 rc_cache.cache_repo.backend = dogpile.cache.rc.file_namespace
315 rc_cache.cache_repo.expiration_time = 2592000
320 rc_cache.cache_repo.expiration_time = 2592000
316
321
317 ## alternative `cache_repo` redis backend with distributed lock
322 ## alternative `cache_repo` redis backend with distributed lock
318 #rc_cache.cache_repo.backend = dogpile.cache.rc.redis
323 #rc_cache.cache_repo.backend = dogpile.cache.rc.redis
319 #rc_cache.cache_repo.expiration_time = 2592000
324 #rc_cache.cache_repo.expiration_time = 2592000
320 ## redis_expiration_time needs to be greater then expiration_time
325 ## redis_expiration_time needs to be greater then expiration_time
321 #rc_cache.cache_repo.arguments.redis_expiration_time = 2678400
326 #rc_cache.cache_repo.arguments.redis_expiration_time = 2678400
322 #rc_cache.cache_repo.arguments.socket_timeout = 30
327 #rc_cache.cache_repo.arguments.socket_timeout = 30
323 #rc_cache.cache_repo.arguments.host = localhost
328 #rc_cache.cache_repo.arguments.host = localhost
324 #rc_cache.cache_repo.arguments.port = 6379
329 #rc_cache.cache_repo.arguments.port = 6379
325 #rc_cache.cache_repo.arguments.db = 1
330 #rc_cache.cache_repo.arguments.db = 1
326 ## more Redis options: https://dogpilecache.sqlalchemy.org/en/latest/api.html#redis-backends
331 ## more Redis options: https://dogpilecache.sqlalchemy.org/en/latest/api.html#redis-backends
327 #rc_cache.cache_repo.arguments.distributed_lock = true
332 #rc_cache.cache_repo.arguments.distributed_lock = true
328
333
329 ## cache settings for SQL queries, this needs to use memory type backend
334 ## cache settings for SQL queries, this needs to use memory type backend
330 rc_cache.sql_cache_short.backend = dogpile.cache.rc.memory_lru
335 rc_cache.sql_cache_short.backend = dogpile.cache.rc.memory_lru
331 rc_cache.sql_cache_short.expiration_time = 30
336 rc_cache.sql_cache_short.expiration_time = 30
332
337
333 ## `cache_repo_longterm` cache for repo object instances, this needs to use memory
338 ## `cache_repo_longterm` cache for repo object instances, this needs to use memory
334 ## type backend as the objects kept are not pickle serializable
339 ## type backend as the objects kept are not pickle serializable
335 rc_cache.cache_repo_longterm.backend = dogpile.cache.rc.memory_lru
340 rc_cache.cache_repo_longterm.backend = dogpile.cache.rc.memory_lru
336 ## by default we use 96H, this is using invalidation on push anyway
341 ## by default we use 96H, this is using invalidation on push anyway
337 rc_cache.cache_repo_longterm.expiration_time = 345600
342 rc_cache.cache_repo_longterm.expiration_time = 345600
338 ## max items in LRU cache, reduce this number to save memory, and expire last used
343 ## max items in LRU cache, reduce this number to save memory, and expire last used
339 ## cached objects
344 ## cached objects
340 rc_cache.cache_repo_longterm.max_size = 10000
345 rc_cache.cache_repo_longterm.max_size = 10000
341
346
342
347
343 ####################################
348 ####################################
344 ### BEAKER SESSION ####
349 ### BEAKER SESSION ####
345 ####################################
350 ####################################
346
351
347 ## .session.type is type of storage options for the session, current allowed
352 ## .session.type is type of storage options for the session, current allowed
348 ## types are file, ext:memcached, ext:redis, ext:database, and memory (default).
353 ## types are file, ext:memcached, ext:redis, ext:database, and memory (default).
349 beaker.session.type = file
354 beaker.session.type = file
350 beaker.session.data_dir = %(here)s/data/sessions
355 beaker.session.data_dir = %(here)s/data/sessions
351
356
352 ## db based session, fast, and allows easy management over logged in users
357 ## db based session, fast, and allows easy management over logged in users
353 #beaker.session.type = ext:database
358 #beaker.session.type = ext:database
354 #beaker.session.table_name = db_session
359 #beaker.session.table_name = db_session
355 #beaker.session.sa.url = postgresql://postgres:secret@localhost/rhodecode
360 #beaker.session.sa.url = postgresql://postgres:secret@localhost/rhodecode
356 #beaker.session.sa.url = mysql://root:secret@127.0.0.1/rhodecode
361 #beaker.session.sa.url = mysql://root:secret@127.0.0.1/rhodecode
357 #beaker.session.sa.pool_recycle = 3600
362 #beaker.session.sa.pool_recycle = 3600
358 #beaker.session.sa.echo = false
363 #beaker.session.sa.echo = false
359
364
360 beaker.session.key = rhodecode
365 beaker.session.key = rhodecode
361 beaker.session.secret = production-rc-uytcxaz
366 beaker.session.secret = production-rc-uytcxaz
362 beaker.session.lock_dir = %(here)s/data/sessions/lock
367 beaker.session.lock_dir = %(here)s/data/sessions/lock
363
368
364 ## Secure encrypted cookie. Requires AES and AES python libraries
369 ## Secure encrypted cookie. Requires AES and AES python libraries
365 ## you must disable beaker.session.secret to use this
370 ## you must disable beaker.session.secret to use this
366 #beaker.session.encrypt_key = key_for_encryption
371 #beaker.session.encrypt_key = key_for_encryption
367 #beaker.session.validate_key = validation_key
372 #beaker.session.validate_key = validation_key
368
373
369 ## sets session as invalid(also logging out user) if it haven not been
374 ## sets session as invalid(also logging out user) if it haven not been
370 ## accessed for given amount of time in seconds
375 ## accessed for given amount of time in seconds
371 beaker.session.timeout = 2592000
376 beaker.session.timeout = 2592000
372 beaker.session.httponly = true
377 beaker.session.httponly = true
373 ## Path to use for the cookie. Set to prefix if you use prefix middleware
378 ## Path to use for the cookie. Set to prefix if you use prefix middleware
374 #beaker.session.cookie_path = /custom_prefix
379 #beaker.session.cookie_path = /custom_prefix
375
380
376 ## uncomment for https secure cookie
381 ## uncomment for https secure cookie
377 beaker.session.secure = false
382 beaker.session.secure = false
378
383
379 ## auto save the session to not to use .save()
384 ## auto save the session to not to use .save()
380 beaker.session.auto = false
385 beaker.session.auto = false
381
386
382 ## default cookie expiration time in seconds, set to `true` to set expire
387 ## default cookie expiration time in seconds, set to `true` to set expire
383 ## at browser close
388 ## at browser close
384 #beaker.session.cookie_expires = 3600
389 #beaker.session.cookie_expires = 3600
385
390
386 ###################################
391 ###################################
387 ## SEARCH INDEXING CONFIGURATION ##
392 ## SEARCH INDEXING CONFIGURATION ##
388 ###################################
393 ###################################
389 ## Full text search indexer is available in rhodecode-tools under
394 ## Full text search indexer is available in rhodecode-tools under
390 ## `rhodecode-tools index` command
395 ## `rhodecode-tools index` command
391
396
392 ## WHOOSH Backend, doesn't require additional services to run
397 ## WHOOSH Backend, doesn't require additional services to run
393 ## it works good with few dozen repos
398 ## it works good with few dozen repos
394 search.module = rhodecode.lib.index.whoosh
399 search.module = rhodecode.lib.index.whoosh
395 search.location = %(here)s/data/index
400 search.location = %(here)s/data/index
396
401
397 ########################################
402 ########################################
398 ### CHANNELSTREAM CONFIG ####
403 ### CHANNELSTREAM CONFIG ####
399 ########################################
404 ########################################
400 ## channelstream enables persistent connections and live notification
405 ## channelstream enables persistent connections and live notification
401 ## in the system. It's also used by the chat system
406 ## in the system. It's also used by the chat system
402
407
403 channelstream.enabled = false
408 channelstream.enabled = false
404
409
405 ## server address for channelstream server on the backend
410 ## server address for channelstream server on the backend
406 channelstream.server = 127.0.0.1:9800
411 channelstream.server = 127.0.0.1:9800
407
412
408 ## location of the channelstream server from outside world
413 ## location of the channelstream server from outside world
409 ## use ws:// for http or wss:// for https. This address needs to be handled
414 ## use ws:// for http or wss:// for https. This address needs to be handled
410 ## by external HTTP server such as Nginx or Apache
415 ## by external HTTP server such as Nginx or Apache
411 ## see Nginx/Apache configuration examples in our docs
416 ## see Nginx/Apache configuration examples in our docs
412 channelstream.ws_url = ws://rhodecode.yourserver.com/_channelstream
417 channelstream.ws_url = ws://rhodecode.yourserver.com/_channelstream
413 channelstream.secret = secret
418 channelstream.secret = secret
414 channelstream.history.location = %(here)s/channelstream_history
419 channelstream.history.location = %(here)s/channelstream_history
415
420
416 ## Internal application path that Javascript uses to connect into.
421 ## Internal application path that Javascript uses to connect into.
417 ## If you use proxy-prefix the prefix should be added before /_channelstream
422 ## If you use proxy-prefix the prefix should be added before /_channelstream
418 channelstream.proxy_path = /_channelstream
423 channelstream.proxy_path = /_channelstream
419
424
420
425
421 ###################################
426 ###################################
422 ## APPENLIGHT CONFIG ##
427 ## APPENLIGHT CONFIG ##
423 ###################################
428 ###################################
424
429
425 ## Appenlight is tailored to work with RhodeCode, see
430 ## Appenlight is tailored to work with RhodeCode, see
426 ## http://appenlight.com for details how to obtain an account
431 ## http://appenlight.com for details how to obtain an account
427
432
428 ## Appenlight integration enabled
433 ## Appenlight integration enabled
429 appenlight = false
434 appenlight = false
430
435
431 appenlight.server_url = https://api.appenlight.com
436 appenlight.server_url = https://api.appenlight.com
432 appenlight.api_key = YOUR_API_KEY
437 appenlight.api_key = YOUR_API_KEY
433 #appenlight.transport_config = https://api.appenlight.com?threaded=1&timeout=5
438 #appenlight.transport_config = https://api.appenlight.com?threaded=1&timeout=5
434
439
435 ## used for JS client
440 ## used for JS client
436 appenlight.api_public_key = YOUR_API_PUBLIC_KEY
441 appenlight.api_public_key = YOUR_API_PUBLIC_KEY
437
442
438 ## TWEAK AMOUNT OF INFO SENT HERE
443 ## TWEAK AMOUNT OF INFO SENT HERE
439
444
440 ## enables 404 error logging (default False)
445 ## enables 404 error logging (default False)
441 appenlight.report_404 = false
446 appenlight.report_404 = false
442
447
443 ## time in seconds after request is considered being slow (default 1)
448 ## time in seconds after request is considered being slow (default 1)
444 appenlight.slow_request_time = 1
449 appenlight.slow_request_time = 1
445
450
446 ## record slow requests in application
451 ## record slow requests in application
447 ## (needs to be enabled for slow datastore recording and time tracking)
452 ## (needs to be enabled for slow datastore recording and time tracking)
448 appenlight.slow_requests = true
453 appenlight.slow_requests = true
449
454
450 ## enable hooking to application loggers
455 ## enable hooking to application loggers
451 appenlight.logging = true
456 appenlight.logging = true
452
457
453 ## minimum log level for log capture
458 ## minimum log level for log capture
454 appenlight.logging.level = WARNING
459 appenlight.logging.level = WARNING
455
460
456 ## send logs only from erroneous/slow requests
461 ## send logs only from erroneous/slow requests
457 ## (saves API quota for intensive logging)
462 ## (saves API quota for intensive logging)
458 appenlight.logging_on_error = false
463 appenlight.logging_on_error = false
459
464
460 ## list of additional keywords that should be grabbed from environ object
465 ## list of additional keywords that should be grabbed from environ object
461 ## can be string with comma separated list of words in lowercase
466 ## can be string with comma separated list of words in lowercase
462 ## (by default client will always send following info:
467 ## (by default client will always send following info:
463 ## 'REMOTE_USER', 'REMOTE_ADDR', 'SERVER_NAME', 'CONTENT_TYPE' + all keys that
468 ## 'REMOTE_USER', 'REMOTE_ADDR', 'SERVER_NAME', 'CONTENT_TYPE' + all keys that
464 ## start with HTTP* this list be extended with additional keywords here
469 ## start with HTTP* this list be extended with additional keywords here
465 appenlight.environ_keys_whitelist =
470 appenlight.environ_keys_whitelist =
466
471
467 ## list of keywords that should be blanked from request object
472 ## list of keywords that should be blanked from request object
468 ## can be string with comma separated list of words in lowercase
473 ## can be string with comma separated list of words in lowercase
469 ## (by default client will always blank keys that contain following words
474 ## (by default client will always blank keys that contain following words
470 ## 'password', 'passwd', 'pwd', 'auth_tkt', 'secret', 'csrf'
475 ## 'password', 'passwd', 'pwd', 'auth_tkt', 'secret', 'csrf'
471 ## this list be extended with additional keywords set here
476 ## this list be extended with additional keywords set here
472 appenlight.request_keys_blacklist =
477 appenlight.request_keys_blacklist =
473
478
474 ## list of namespaces that should be ignores when gathering log entries
479 ## list of namespaces that should be ignores when gathering log entries
475 ## can be string with comma separated list of namespaces
480 ## can be string with comma separated list of namespaces
476 ## (by default the client ignores own entries: appenlight_client.client)
481 ## (by default the client ignores own entries: appenlight_client.client)
477 appenlight.log_namespace_blacklist =
482 appenlight.log_namespace_blacklist =
478
483
479
484
480 ###########################################
485 ###########################################
481 ### MAIN RHODECODE DATABASE CONFIG ###
486 ### MAIN RHODECODE DATABASE CONFIG ###
482 ###########################################
487 ###########################################
483 #sqlalchemy.db1.url = sqlite:///%(here)s/rhodecode.db?timeout=30
488 #sqlalchemy.db1.url = sqlite:///%(here)s/rhodecode.db?timeout=30
484 #sqlalchemy.db1.url = postgresql://postgres:qweqwe@localhost/rhodecode
489 #sqlalchemy.db1.url = postgresql://postgres:qweqwe@localhost/rhodecode
485 #sqlalchemy.db1.url = mysql://root:qweqwe@localhost/rhodecode?charset=utf8
490 #sqlalchemy.db1.url = mysql://root:qweqwe@localhost/rhodecode?charset=utf8
486 # pymysql is an alternative driver for MySQL, use in case of problems with default one
491 # pymysql is an alternative driver for MySQL, use in case of problems with default one
487 #sqlalchemy.db1.url = mysql+pymysql://root:qweqwe@localhost/rhodecode
492 #sqlalchemy.db1.url = mysql+pymysql://root:qweqwe@localhost/rhodecode
488
493
489 sqlalchemy.db1.url = postgresql://postgres:qweqwe@localhost/rhodecode
494 sqlalchemy.db1.url = postgresql://postgres:qweqwe@localhost/rhodecode
490
495
491 # see sqlalchemy docs for other advanced settings
496 # see sqlalchemy docs for other advanced settings
492
497
493 ## print the sql statements to output
498 ## print the sql statements to output
494 sqlalchemy.db1.echo = false
499 sqlalchemy.db1.echo = false
495 ## recycle the connections after this amount of seconds
500 ## recycle the connections after this amount of seconds
496 sqlalchemy.db1.pool_recycle = 3600
501 sqlalchemy.db1.pool_recycle = 3600
497 sqlalchemy.db1.convert_unicode = true
502 sqlalchemy.db1.convert_unicode = true
498
503
499 ## the number of connections to keep open inside the connection pool.
504 ## the number of connections to keep open inside the connection pool.
500 ## 0 indicates no limit
505 ## 0 indicates no limit
501 #sqlalchemy.db1.pool_size = 5
506 #sqlalchemy.db1.pool_size = 5
502
507
503 ## the number of connections to allow in connection pool "overflow", that is
508 ## the number of connections to allow in connection pool "overflow", that is
504 ## connections that can be opened above and beyond the pool_size setting,
509 ## connections that can be opened above and beyond the pool_size setting,
505 ## which defaults to five.
510 ## which defaults to five.
506 #sqlalchemy.db1.max_overflow = 10
511 #sqlalchemy.db1.max_overflow = 10
507
512
508 ## Connection check ping, used to detect broken database connections
513 ## Connection check ping, used to detect broken database connections
509 ## could be enabled to better handle cases if MySQL has gone away errors
514 ## could be enabled to better handle cases if MySQL has gone away errors
510 #sqlalchemy.db1.ping_connection = true
515 #sqlalchemy.db1.ping_connection = true
511
516
512 ##################
517 ##################
513 ### VCS CONFIG ###
518 ### VCS CONFIG ###
514 ##################
519 ##################
515 vcs.server.enable = true
520 vcs.server.enable = true
516 vcs.server = localhost:9900
521 vcs.server = localhost:9900
517
522
518 ## Web server connectivity protocol, responsible for web based VCS operations
523 ## Web server connectivity protocol, responsible for web based VCS operations
519 ## Available protocols are:
524 ## Available protocols are:
520 ## `http` - use http-rpc backend (default)
525 ## `http` - use http-rpc backend (default)
521 vcs.server.protocol = http
526 vcs.server.protocol = http
522
527
523 ## Push/Pull operations protocol, available options are:
528 ## Push/Pull operations protocol, available options are:
524 ## `http` - use http-rpc backend (default)
529 ## `http` - use http-rpc backend (default)
525 vcs.scm_app_implementation = http
530 vcs.scm_app_implementation = http
526
531
527 ## Push/Pull operations hooks protocol, available options are:
532 ## Push/Pull operations hooks protocol, available options are:
528 ## `http` - use http-rpc backend (default)
533 ## `http` - use http-rpc backend (default)
529 vcs.hooks.protocol = http
534 vcs.hooks.protocol = http
530
535
531 ## Host on which this instance is listening for hooks. If vcsserver is in other location
536 ## Host on which this instance is listening for hooks. If vcsserver is in other location
532 ## this should be adjusted.
537 ## this should be adjusted.
533 vcs.hooks.host = 127.0.0.1
538 vcs.hooks.host = 127.0.0.1
534
539
535 vcs.server.log_level = info
540 vcs.server.log_level = info
536 ## Start VCSServer with this instance as a subprocess, useful for development
541 ## Start VCSServer with this instance as a subprocess, useful for development
537 vcs.start_server = false
542 vcs.start_server = false
538
543
539 ## List of enabled VCS backends, available options are:
544 ## List of enabled VCS backends, available options are:
540 ## `hg` - mercurial
545 ## `hg` - mercurial
541 ## `git` - git
546 ## `git` - git
542 ## `svn` - subversion
547 ## `svn` - subversion
543 vcs.backends = hg, git, svn
548 vcs.backends = hg, git, svn
544
549
545 vcs.connection_timeout = 3600
550 vcs.connection_timeout = 3600
546 ## Compatibility version when creating SVN repositories. Defaults to newest version when commented out.
551 ## Compatibility version when creating SVN repositories. Defaults to newest version when commented out.
547 ## Available options are: pre-1.4-compatible, pre-1.5-compatible, pre-1.6-compatible, pre-1.8-compatible, pre-1.9-compatible
552 ## Available options are: pre-1.4-compatible, pre-1.5-compatible, pre-1.6-compatible, pre-1.8-compatible, pre-1.9-compatible
548 #vcs.svn.compatible_version = pre-1.8-compatible
553 #vcs.svn.compatible_version = pre-1.8-compatible
549
554
550
555
551 ############################################################
556 ############################################################
552 ### Subversion proxy support (mod_dav_svn) ###
557 ### Subversion proxy support (mod_dav_svn) ###
553 ### Maps RhodeCode repo groups into SVN paths for Apache ###
558 ### Maps RhodeCode repo groups into SVN paths for Apache ###
554 ############################################################
559 ############################################################
555 ## Enable or disable the config file generation.
560 ## Enable or disable the config file generation.
556 svn.proxy.generate_config = false
561 svn.proxy.generate_config = false
557 ## Generate config file with `SVNListParentPath` set to `On`.
562 ## Generate config file with `SVNListParentPath` set to `On`.
558 svn.proxy.list_parent_path = true
563 svn.proxy.list_parent_path = true
559 ## Set location and file name of generated config file.
564 ## Set location and file name of generated config file.
560 svn.proxy.config_file_path = %(here)s/mod_dav_svn.conf
565 svn.proxy.config_file_path = %(here)s/mod_dav_svn.conf
561 ## alternative mod_dav config template. This needs to be a mako template
566 ## alternative mod_dav config template. This needs to be a mako template
562 #svn.proxy.config_template = ~/.rccontrol/enterprise-1/custom_svn_conf.mako
567 #svn.proxy.config_template = ~/.rccontrol/enterprise-1/custom_svn_conf.mako
563 ## Used as a prefix to the `Location` block in the generated config file.
568 ## Used as a prefix to the `Location` block in the generated config file.
564 ## In most cases it should be set to `/`.
569 ## In most cases it should be set to `/`.
565 svn.proxy.location_root = /
570 svn.proxy.location_root = /
566 ## Command to reload the mod dav svn configuration on change.
571 ## Command to reload the mod dav svn configuration on change.
567 ## Example: `/etc/init.d/apache2 reload` or /home/USER/apache_reload.sh
572 ## Example: `/etc/init.d/apache2 reload` or /home/USER/apache_reload.sh
568 ## Make sure user who runs RhodeCode process is allowed to reload Apache
573 ## Make sure user who runs RhodeCode process is allowed to reload Apache
569 #svn.proxy.reload_cmd = /etc/init.d/apache2 reload
574 #svn.proxy.reload_cmd = /etc/init.d/apache2 reload
570 ## If the timeout expires before the reload command finishes, the command will
575 ## If the timeout expires before the reload command finishes, the command will
571 ## be killed. Setting it to zero means no timeout. Defaults to 10 seconds.
576 ## be killed. Setting it to zero means no timeout. Defaults to 10 seconds.
572 #svn.proxy.reload_timeout = 10
577 #svn.proxy.reload_timeout = 10
573
578
574 ############################################################
579 ############################################################
575 ### SSH Support Settings ###
580 ### SSH Support Settings ###
576 ############################################################
581 ############################################################
577
582
578 ## Defines if a custom authorized_keys file should be created and written on
583 ## Defines if a custom authorized_keys file should be created and written on
579 ## any change user ssh keys. Setting this to false also disables possibility
584 ## any change user ssh keys. Setting this to false also disables possibility
580 ## of adding SSH keys by users from web interface. Super admins can still
585 ## of adding SSH keys by users from web interface. Super admins can still
581 ## manage SSH Keys.
586 ## manage SSH Keys.
582 ssh.generate_authorized_keyfile = false
587 ssh.generate_authorized_keyfile = false
583
588
584 ## Options for ssh, default is `no-pty,no-port-forwarding,no-X11-forwarding,no-agent-forwarding`
589 ## Options for ssh, default is `no-pty,no-port-forwarding,no-X11-forwarding,no-agent-forwarding`
585 # ssh.authorized_keys_ssh_opts =
590 # ssh.authorized_keys_ssh_opts =
586
591
587 ## Path to the authorized_keys file where the generate entries are placed.
592 ## Path to the authorized_keys file where the generate entries are placed.
588 ## It is possible to have multiple key files specified in `sshd_config` e.g.
593 ## It is possible to have multiple key files specified in `sshd_config` e.g.
589 ## AuthorizedKeysFile %h/.ssh/authorized_keys %h/.ssh/authorized_keys_rhodecode
594 ## AuthorizedKeysFile %h/.ssh/authorized_keys %h/.ssh/authorized_keys_rhodecode
590 ssh.authorized_keys_file_path = ~/.ssh/authorized_keys_rhodecode
595 ssh.authorized_keys_file_path = ~/.ssh/authorized_keys_rhodecode
591
596
592 ## Command to execute the SSH wrapper. The binary is available in the
597 ## Command to execute the SSH wrapper. The binary is available in the
593 ## RhodeCode installation directory.
598 ## RhodeCode installation directory.
594 ## e.g ~/.rccontrol/community-1/profile/bin/rc-ssh-wrapper
599 ## e.g ~/.rccontrol/community-1/profile/bin/rc-ssh-wrapper
595 ssh.wrapper_cmd = ~/.rccontrol/community-1/rc-ssh-wrapper
600 ssh.wrapper_cmd = ~/.rccontrol/community-1/rc-ssh-wrapper
596
601
597 ## Allow shell when executing the ssh-wrapper command
602 ## Allow shell when executing the ssh-wrapper command
598 ssh.wrapper_cmd_allow_shell = false
603 ssh.wrapper_cmd_allow_shell = false
599
604
600 ## Enables logging, and detailed output send back to the client during SSH
605 ## Enables logging, and detailed output send back to the client during SSH
601 ## operations. Useful for debugging, shouldn't be used in production.
606 ## operations. Useful for debugging, shouldn't be used in production.
602 ssh.enable_debug_logging = false
607 ssh.enable_debug_logging = false
603
608
604 ## Paths to binary executable, by default they are the names, but we can
609 ## Paths to binary executable, by default they are the names, but we can
605 ## override them if we want to use a custom one
610 ## override them if we want to use a custom one
606 ssh.executable.hg = ~/.rccontrol/vcsserver-1/profile/bin/hg
611 ssh.executable.hg = ~/.rccontrol/vcsserver-1/profile/bin/hg
607 ssh.executable.git = ~/.rccontrol/vcsserver-1/profile/bin/git
612 ssh.executable.git = ~/.rccontrol/vcsserver-1/profile/bin/git
608 ssh.executable.svn = ~/.rccontrol/vcsserver-1/profile/bin/svnserve
613 ssh.executable.svn = ~/.rccontrol/vcsserver-1/profile/bin/svnserve
609
614
610 ## Enables SSH key generator web interface. Disabling this still allows users
615 ## Enables SSH key generator web interface. Disabling this still allows users
611 ## to add their own keys.
616 ## to add their own keys.
612 ssh.enable_ui_key_generator = true
617 ssh.enable_ui_key_generator = true
613
618
614
619
615 ## Dummy marker to add new entries after.
620 ## Dummy marker to add new entries after.
616 ## Add any custom entries below. Please don't remove.
621 ## Add any custom entries below. Please don't remove.
617 custom.conf = 1
622 custom.conf = 1
618
623
619
624
620 ################################
625 ################################
621 ### LOGGING CONFIGURATION ####
626 ### LOGGING CONFIGURATION ####
622 ################################
627 ################################
623 [loggers]
628 [loggers]
624 keys = root, sqlalchemy, beaker, celery, rhodecode, ssh_wrapper
629 keys = root, sqlalchemy, beaker, celery, rhodecode, ssh_wrapper
625
630
626 [handlers]
631 [handlers]
627 keys = console, console_sql
632 keys = console, console_sql
628
633
629 [formatters]
634 [formatters]
630 keys = generic, color_formatter, color_formatter_sql
635 keys = generic, color_formatter, color_formatter_sql
631
636
632 #############
637 #############
633 ## LOGGERS ##
638 ## LOGGERS ##
634 #############
639 #############
635 [logger_root]
640 [logger_root]
636 level = NOTSET
641 level = NOTSET
637 handlers = console
642 handlers = console
638
643
639 [logger_sqlalchemy]
644 [logger_sqlalchemy]
640 level = INFO
645 level = INFO
641 handlers = console_sql
646 handlers = console_sql
642 qualname = sqlalchemy.engine
647 qualname = sqlalchemy.engine
643 propagate = 0
648 propagate = 0
644
649
645 [logger_beaker]
650 [logger_beaker]
646 level = DEBUG
651 level = DEBUG
647 handlers =
652 handlers =
648 qualname = beaker.container
653 qualname = beaker.container
649 propagate = 1
654 propagate = 1
650
655
651 [logger_rhodecode]
656 [logger_rhodecode]
652 level = DEBUG
657 level = DEBUG
653 handlers =
658 handlers =
654 qualname = rhodecode
659 qualname = rhodecode
655 propagate = 1
660 propagate = 1
656
661
657 [logger_ssh_wrapper]
662 [logger_ssh_wrapper]
658 level = DEBUG
663 level = DEBUG
659 handlers =
664 handlers =
660 qualname = ssh_wrapper
665 qualname = ssh_wrapper
661 propagate = 1
666 propagate = 1
662
667
663 [logger_celery]
668 [logger_celery]
664 level = DEBUG
669 level = DEBUG
665 handlers =
670 handlers =
666 qualname = celery
671 qualname = celery
667
672
668
673
669 ##############
674 ##############
670 ## HANDLERS ##
675 ## HANDLERS ##
671 ##############
676 ##############
672
677
673 [handler_console]
678 [handler_console]
674 class = StreamHandler
679 class = StreamHandler
675 args = (sys.stderr, )
680 args = (sys.stderr, )
676 level = INFO
681 level = INFO
677 formatter = generic
682 formatter = generic
678
683
679 [handler_console_sql]
684 [handler_console_sql]
680 # "level = DEBUG" logs SQL queries and results.
685 # "level = DEBUG" logs SQL queries and results.
681 # "level = INFO" logs SQL queries.
686 # "level = INFO" logs SQL queries.
682 # "level = WARN" logs neither. (Recommended for production systems.)
687 # "level = WARN" logs neither. (Recommended for production systems.)
683 class = StreamHandler
688 class = StreamHandler
684 args = (sys.stderr, )
689 args = (sys.stderr, )
685 level = WARN
690 level = WARN
686 formatter = generic
691 formatter = generic
687
692
688 ################
693 ################
689 ## FORMATTERS ##
694 ## FORMATTERS ##
690 ################
695 ################
691
696
692 [formatter_generic]
697 [formatter_generic]
693 class = rhodecode.lib.logging_formatter.ExceptionAwareFormatter
698 class = rhodecode.lib.logging_formatter.ExceptionAwareFormatter
694 format = %(asctime)s.%(msecs)03d [%(process)d] %(levelname)-5.5s [%(name)s] %(message)s
699 format = %(asctime)s.%(msecs)03d [%(process)d] %(levelname)-5.5s [%(name)s] %(message)s
695 datefmt = %Y-%m-%d %H:%M:%S
700 datefmt = %Y-%m-%d %H:%M:%S
696
701
697 [formatter_color_formatter]
702 [formatter_color_formatter]
698 class = rhodecode.lib.logging_formatter.ColorFormatter
703 class = rhodecode.lib.logging_formatter.ColorFormatter
699 format = %(asctime)s.%(msecs)03d [%(process)d] %(levelname)-5.5s [%(name)s] %(message)s
704 format = %(asctime)s.%(msecs)03d [%(process)d] %(levelname)-5.5s [%(name)s] %(message)s
700 datefmt = %Y-%m-%d %H:%M:%S
705 datefmt = %Y-%m-%d %H:%M:%S
701
706
702 [formatter_color_formatter_sql]
707 [formatter_color_formatter_sql]
703 class = rhodecode.lib.logging_formatter.ColorFormatterSql
708 class = rhodecode.lib.logging_formatter.ColorFormatterSql
704 format = %(asctime)s.%(msecs)03d [%(process)d] %(levelname)-5.5s [%(name)s] %(message)s
709 format = %(asctime)s.%(msecs)03d [%(process)d] %(levelname)-5.5s [%(name)s] %(message)s
705 datefmt = %Y-%m-%d %H:%M:%S
710 datefmt = %Y-%m-%d %H:%M:%S
@@ -1,114 +1,138 b''
1 # -*- coding: utf-8 -*-
1 # -*- coding: utf-8 -*-
2
2
3 # Copyright (C) 2014-2019 RhodeCode GmbH
3 # Copyright (C) 2014-2019 RhodeCode GmbH
4 #
4 #
5 # This program is free software: you can redistribute it and/or modify
5 # This program is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU Affero General Public License, version 3
6 # it under the terms of the GNU Affero General Public License, version 3
7 # (only), as published by the Free Software Foundation.
7 # (only), as published by the Free Software Foundation.
8 #
8 #
9 # This program is distributed in the hope that it will be useful,
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
12 # GNU General Public License for more details.
13 #
13 #
14 # You should have received a copy of the GNU Affero General Public License
14 # You should have received a copy of the GNU Affero General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
16 #
16 #
17 # This program is dual-licensed. If you wish to learn more about the
17 # This program is dual-licensed. If you wish to learn more about the
18 # RhodeCode Enterprise Edition, including its added features, Support services,
18 # RhodeCode Enterprise Edition, including its added features, Support services,
19 # and proprietary license terms, please see https://rhodecode.com/licenses/
19 # and proprietary license terms, please see https://rhodecode.com/licenses/
20
20
21
21
22 """
22 """
23 Generic encryption library for RhodeCode
23 Generic encryption library for RhodeCode
24 """
24 """
25
25
26 import base64
26 import base64
27
27
28 from Crypto.Cipher import AES
28 from Crypto.Cipher import AES
29 from Crypto import Random
29 from Crypto import Random
30 from Crypto.Hash import HMAC, SHA256
30 from Crypto.Hash import HMAC, SHA256
31
31
32 from rhodecode.lib.utils2 import safe_str
32 from rhodecode.lib.utils2 import safe_str
33
33
34
34
35 class SignatureVerificationError(Exception):
35 class SignatureVerificationError(Exception):
36 pass
36 pass
37
37
38
38
39 class InvalidDecryptedValue(str):
39 class InvalidDecryptedValue(str):
40
40
41 def __new__(cls, content):
41 def __new__(cls, content):
42 """
42 """
43 This will generate something like this::
43 This will generate something like this::
44 <InvalidDecryptedValue(QkWusFgLJXR6m42v...)>
44 <InvalidDecryptedValue(QkWusFgLJXR6m42v...)>
45 And represent a safe indicator that encryption key is broken
45 And represent a safe indicator that encryption key is broken
46 """
46 """
47 content = '<{}({}...)>'.format(cls.__name__, content[:16])
47 content = '<{}({}...)>'.format(cls.__name__, content[:16])
48 return str.__new__(cls, content)
48 return str.__new__(cls, content)
49
49
50
50
51 class AESCipher(object):
51 class AESCipher(object):
52 def __init__(self, key, hmac=False, strict_verification=True):
52 def __init__(self, key, hmac=False, strict_verification=True):
53 if not key:
53 if not key:
54 raise ValueError('passed key variable is empty')
54 raise ValueError('passed key variable is empty')
55 self.strict_verification = strict_verification
55 self.strict_verification = strict_verification
56 self.block_size = 32
56 self.block_size = 32
57 self.hmac_size = 32
57 self.hmac_size = 32
58 self.hmac = hmac
58 self.hmac = hmac
59
59
60 self.key = SHA256.new(safe_str(key)).digest()
60 self.key = SHA256.new(safe_str(key)).digest()
61 self.hmac_key = SHA256.new(self.key).digest()
61 self.hmac_key = SHA256.new(self.key).digest()
62
62
63 def verify_hmac_signature(self, raw_data):
63 def verify_hmac_signature(self, raw_data):
64 org_hmac_signature = raw_data[-self.hmac_size:]
64 org_hmac_signature = raw_data[-self.hmac_size:]
65 data_without_sig = raw_data[:-self.hmac_size]
65 data_without_sig = raw_data[:-self.hmac_size]
66 recomputed_hmac = HMAC.new(
66 recomputed_hmac = HMAC.new(
67 self.hmac_key, data_without_sig, digestmod=SHA256).digest()
67 self.hmac_key, data_without_sig, digestmod=SHA256).digest()
68 return org_hmac_signature == recomputed_hmac
68 return org_hmac_signature == recomputed_hmac
69
69
70 def encrypt(self, raw):
70 def encrypt(self, raw):
71 raw = self._pad(raw)
71 raw = self._pad(raw)
72 iv = Random.new().read(AES.block_size)
72 iv = Random.new().read(AES.block_size)
73 cipher = AES.new(self.key, AES.MODE_CBC, iv)
73 cipher = AES.new(self.key, AES.MODE_CBC, iv)
74 enc_value = cipher.encrypt(raw)
74 enc_value = cipher.encrypt(raw)
75
75
76 hmac_signature = ''
76 hmac_signature = ''
77 if self.hmac:
77 if self.hmac:
78 # compute hmac+sha256 on iv + enc text, we use
78 # compute hmac+sha256 on iv + enc text, we use
79 # encrypt then mac method to create the signature
79 # encrypt then mac method to create the signature
80 hmac_signature = HMAC.new(
80 hmac_signature = HMAC.new(
81 self.hmac_key, iv + enc_value, digestmod=SHA256).digest()
81 self.hmac_key, iv + enc_value, digestmod=SHA256).digest()
82
82
83 return base64.b64encode(iv + enc_value + hmac_signature)
83 return base64.b64encode(iv + enc_value + hmac_signature)
84
84
85 def decrypt(self, enc):
85 def decrypt(self, enc):
86 enc_org = enc
86 enc_org = enc
87 enc = base64.b64decode(enc)
87 enc = base64.b64decode(enc)
88
88
89 if self.hmac and len(enc) > self.hmac_size:
89 if self.hmac and len(enc) > self.hmac_size:
90 if self.verify_hmac_signature(enc):
90 if self.verify_hmac_signature(enc):
91 # cut off the HMAC verification digest
91 # cut off the HMAC verification digest
92 enc = enc[:-self.hmac_size]
92 enc = enc[:-self.hmac_size]
93 else:
93 else:
94 if self.strict_verification:
94 if self.strict_verification:
95 raise SignatureVerificationError(
95 raise SignatureVerificationError(
96 "Encryption signature verification failed. "
96 "Encryption signature verification failed. "
97 "Please check your secret key, and/or encrypted value. "
97 "Please check your secret key, and/or encrypted value. "
98 "Secret key is stored as "
98 "Secret key is stored as "
99 "`rhodecode.encrypted_values.secret` or "
99 "`rhodecode.encrypted_values.secret` or "
100 "`beaker.session.secret` inside .ini file")
100 "`beaker.session.secret` inside .ini file")
101
101
102 return InvalidDecryptedValue(enc_org)
102 return InvalidDecryptedValue(enc_org)
103
103
104 iv = enc[:AES.block_size]
104 iv = enc[:AES.block_size]
105 cipher = AES.new(self.key, AES.MODE_CBC, iv)
105 cipher = AES.new(self.key, AES.MODE_CBC, iv)
106 return self._unpad(cipher.decrypt(enc[AES.block_size:]))
106 return self._unpad(cipher.decrypt(enc[AES.block_size:]))
107
107
108 def _pad(self, s):
108 def _pad(self, s):
109 return (s + (self.block_size - len(s) % self.block_size)
109 return (s + (self.block_size - len(s) % self.block_size)
110 * chr(self.block_size - len(s) % self.block_size))
110 * chr(self.block_size - len(s) % self.block_size))
111
111
112 @staticmethod
112 @staticmethod
113 def _unpad(s):
113 def _unpad(s):
114 return s[:-ord(s[len(s)-1:])] No newline at end of file
114 return s[:-ord(s[len(s)-1:])]
115
116
117 def validate_and_get_enc_data(enc_data, enc_key, enc_strict_mode):
118 parts = enc_data.split('$', 3)
119 if not len(parts) == 3:
120 # probably not encrypted values
121 return enc_data
122 else:
123 if parts[0] != 'enc':
124 # parts ok but without our header ?
125 return enc_data
126
127 # at that stage we know it's our encryption
128 if parts[1] == 'aes':
129 decrypted_data = AESCipher(enc_key).decrypt(parts[2])
130 elif parts[1] == 'aes_hmac':
131 decrypted_data = AESCipher(
132 enc_key, hmac=True,
133 strict_verification=enc_strict_mode).decrypt(parts[2])
134 else:
135 raise ValueError(
136 'Encryption type part is wrong, must be `aes` '
137 'or `aes_hmac`, got `%s` instead' % (parts[1]))
138 return decrypted_data
1 NO CONTENT: modified file
NO CONTENT: modified file
The requested commit or file is too big and content was truncated. Show full diff
@@ -1,76 +1,133 b''
1 # -*- coding: utf-8 -*-
1 # -*- coding: utf-8 -*-
2
2
3 # Copyright (C) 2010-2019 RhodeCode GmbH
3 # Copyright (C) 2010-2019 RhodeCode GmbH
4 #
4 #
5 # This program is free software: you can redistribute it and/or modify
5 # This program is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU Affero General Public License, version 3
6 # it under the terms of the GNU Affero General Public License, version 3
7 # (only), as published by the Free Software Foundation.
7 # (only), as published by the Free Software Foundation.
8 #
8 #
9 # This program is distributed in the hope that it will be useful,
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
12 # GNU General Public License for more details.
13 #
13 #
14 # You should have received a copy of the GNU Affero General Public License
14 # You should have received a copy of the GNU Affero General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
16 #
16 #
17 # This program is dual-licensed. If you wish to learn more about the
17 # This program is dual-licensed. If you wish to learn more about the
18 # RhodeCode Enterprise Edition, including its added features, Support services,
18 # RhodeCode Enterprise Edition, including its added features, Support services,
19 # and proprietary license terms, please see https://rhodecode.com/licenses/
19 # and proprietary license terms, please see https://rhodecode.com/licenses/
20
20
21 import pytest
21 import pytest
22
22
23 from rhodecode.lib.encrypt import (
23 from rhodecode.lib.encrypt import (
24 AESCipher, SignatureVerificationError, InvalidDecryptedValue)
24 AESCipher, SignatureVerificationError, InvalidDecryptedValue)
25 from rhodecode.lib.encrypt2 import (Encryptor, InvalidToken)
25
26
26
27
27 class TestEncryptModule(object):
28 class TestEncryptModule(object):
28
29
29 @pytest.mark.parametrize(
30 @pytest.mark.parametrize(
30 "key, text",
31 "key, text",
31 [
32 [
32 ('a', 'short'),
33 ('a', 'short'),
33 ('a'*64, 'too long(trimmed to 32)'),
34 ('a'*64, 'too long(trimmed to 32)'),
34 ('a'*32, 'just enough'),
35 ('a'*32, 'just enough'),
35 ('Δ…Δ‡Δ™Δ‡Δ™', 'non asci'),
36 ('Δ…Δ‡Δ™Δ‡Δ™', 'non asci'),
36 ('$asa$asa', 'special $ used'),
37 ('$asa$asa', 'special $ used'),
37 ]
38 ]
38 )
39 )
39 def test_encryption(self, key, text):
40 def test_encryption(self, key, text):
40 enc = AESCipher(key).encrypt(text)
41 enc = AESCipher(key).encrypt(text)
41 assert AESCipher(key).decrypt(enc) == text
42 assert AESCipher(key).decrypt(enc) == text
42
43
43 def test_encryption_with_hmac(self):
44 def test_encryption_with_hmac(self):
44 key = 'secret'
45 key = 'secret'
45 text = 'ihatemysql'
46 text = 'ihatemysql'
46 enc = AESCipher(key, hmac=True).encrypt(text)
47 enc = AESCipher(key, hmac=True).encrypt(text)
47 assert AESCipher(key, hmac=True).decrypt(enc) == text
48 assert AESCipher(key, hmac=True).decrypt(enc) == text
48
49
49 def test_encryption_with_hmac_with_bad_key(self):
50 def test_encryption_with_hmac_with_bad_key(self):
50 key = 'secretstring'
51 key = 'secretstring'
51 text = 'ihatemysql'
52 text = 'ihatemysql'
52 enc = AESCipher(key, hmac=True).encrypt(text)
53 enc = AESCipher(key, hmac=True).encrypt(text)
53
54
54 with pytest.raises(SignatureVerificationError) as e:
55 with pytest.raises(SignatureVerificationError) as e:
55 assert AESCipher('differentsecret', hmac=True).decrypt(enc) == ''
56 assert AESCipher('differentsecret', hmac=True).decrypt(enc) == ''
56
57
57 assert 'Encryption signature verification failed' in str(e)
58 assert 'Encryption signature verification failed' in str(e)
58
59
59 def test_encryption_with_hmac_with_bad_data(self):
60 def test_encryption_with_hmac_with_bad_data(self):
60 key = 'secret'
61 key = 'secret'
61 text = 'ihatemysql'
62 text = 'ihatemysql'
62 enc = AESCipher(key, hmac=True).encrypt(text)
63 enc = AESCipher(key, hmac=True).encrypt(text)
63 enc = 'xyz' + enc[3:]
64 enc = 'xyz' + enc[3:]
64 with pytest.raises(SignatureVerificationError) as e:
65 with pytest.raises(SignatureVerificationError) as e:
65 assert AESCipher(key, hmac=True).decrypt(enc) == text
66 assert AESCipher(key, hmac=True).decrypt(enc) == text
66
67
67 assert 'Encryption signature verification failed' in str(e)
68 assert 'Encryption signature verification failed' in str(e)
68
69
69 def test_encryption_with_hmac_with_bad_key_not_strict(self):
70 def test_encryption_with_hmac_with_bad_key_not_strict(self):
70 key = 'secretstring'
71 key = 'secretstring'
71 text = 'ihatemysql'
72 text = 'ihatemysql'
72 enc = AESCipher(key, hmac=True).encrypt(text)
73 enc = AESCipher(key, hmac=True).encrypt(text)
73
74
74 assert isinstance(AESCipher(
75 assert isinstance(AESCipher(
75 'differentsecret', hmac=True, strict_verification=False
76 'differentsecret', hmac=True, strict_verification=False
76 ).decrypt(enc), InvalidDecryptedValue)
77 ).decrypt(enc), InvalidDecryptedValue)
78
79
80 class TestEncryptModule2(object):
81
82 @pytest.mark.parametrize(
83 "key, text",
84 [
85 ('a', 'short'),
86 ('a'*64, 'too long(trimmed to 32)'),
87 ('a'*32, 'just enough'),
88 ('Δ…Δ‡Δ™Δ‡Δ™', 'non asci'),
89 ('$asa$asa', 'special $ used'),
90 ]
91 )
92 def test_encryption(self, key, text):
93 enc = Encryptor(key).encrypt(text)
94 assert Encryptor(key).decrypt(enc) == text
95
96 def test_encryption_with_bad_key(self):
97 key = 'secretstring'
98 text = 'ihatemysql'
99 enc = Encryptor(key).encrypt(text)
100
101 assert Encryptor('differentsecret').decrypt(enc) == ''
102
103 def test_encryption_with_bad_key_raises(self):
104 key = 'secretstring'
105 text = 'ihatemysql'
106 enc = Encryptor(key).encrypt(text)
107
108 with pytest.raises(InvalidToken) as e:
109 Encryptor('differentsecret').decrypt(enc, safe=False)
110
111 assert 'InvalidToken' in str(e)
112
113 def test_encryption_with_bad_format_data(self):
114 key = 'secret'
115 text = 'ihatemysql'
116 enc = Encryptor(key).encrypt(text)
117 enc = '$xyz' + enc[3:]
118
119 with pytest.raises(ValueError) as e:
120 Encryptor(key).decrypt(enc, safe=False)
121
122 assert 'Encrypted Data has invalid format' in str(e)
123
124 def test_encryption_with_bad_data(self):
125 key = 'secret'
126 text = 'ihatemysql'
127 enc = Encryptor(key).encrypt(text)
128 enc = enc[:-5]
129
130 with pytest.raises(InvalidToken) as e:
131 Encryptor(key).decrypt(enc, safe=False)
132
133 assert 'InvalidToken' in str(e)
General Comments 0
You need to be logged in to leave comments. Login now