List of commits:
Subject Hash Author Date (UTC)
Added rate limit for ssh and git connections b667130e6c5721a3d30193863a5defd8bbff50f1 Catalin(ux) M. BOIE 2020-11-30 10:49:27
cosmetic abe44edadda9da7c639b7bd8c9e13e6058555669 Catalin(ux) M. BOIE 2020-11-30 10:21:01
gpg functions and test ecb9e05c99a2b73edfba5014329e362d8c6e9246 Catalin(ux) M. BOIE 2020-11-09 07:38:11
Stats page is not rendered for bots. 29ca3f62ac460b64eb0a10fbb8bdfdf4a1767dc5 Catalin(ux) M. BOIE 2020-10-13 05:48:43
Added rate limit options 60e939a52577a01603f9f386ffaf1a9712f99ab6 Catalin(ux) M. BOIE 2020-10-07 05:02:25
Improved bots list and clean old entries 9da0a014040753734beabfecb298b8956fc25fe3 Catalin(ux) M. BOIE 2020-10-05 06:34:43
builder: use secrets only if available 4fe47afc60435508ad90f62c51d489ac3c20b4d0 Catalin(ux) M. BOIE 2020-08-28 07:29:14
worker: use secrets only if available 5371e918e294a46cc38c765371a1caf7a3083eef Catalin(ux) M. BOIE 2020-08-28 07:28:12
builder: do not break meta variable 1d8207b1a782ab039406dbd087cdc9bb5ea0b898 Catalin(ux) M. BOIE 2020-08-28 07:27:48
Whitespace 86086337c5323b073f517bc59c18aba0808fb4f3 Catalin(ux) M. BOIE 2020-08-24 07:22:13
Bump version to 0.73 7cac4d7a31116ac9ad86e0babeb0c1aace5dd852 Catalin(ux) M. BOIE 2020-08-23 15:32:03
duilder update f691d84aa0aa70ef60a7487f247ed1a9ab1e3ab1 Catalin(ux) M. BOIE 2020-08-23 15:31:38
Bot prevention should not be active for edit operation 371c60a486ea989fafb66266cab71ea9f7db0269 Catalin(ux) M. BOIE 2020-08-23 15:02:13
TODO update 32591f3b1cf054bd70411592e5a82f5898d7da2f Catalin(ux) M. BOIE 2020-08-23 15:01:51
Show also by which protocol a user is connecting d35b5b12103f9a72a3e8788e7c48532b9c1e5b89 Catalin(ux) M. BOIE 2020-08-23 15:01:30
Fixed a small locking issue (unlock without lock) 0d1e7915545de251eea7f3bce468647fc2df1bf9 Catalin(ux) M. BOIE 2020-08-23 15:00:58
Give up the cache if we cannot connect in 150ms dad6cf20f9f4bdbfe2026809a404e852e7cd8e53 Catalin(ux) M. BOIE 2020-08-23 15:00:20
Limit the number of repositories in the discover page a0de6d683b59934168ef8415c9ec716aef68b195 Catalin(ux) M. BOIE 2020-08-23 14:58:37
Added support for other branch then master (main prefered) 1108f43c3639ffcc06f1314d901640564fae7483 Catalin(ux) M. BOIE 2020-08-23 14:55:51
Added possibility for admin to mail users 05068314021bbdf6f26bc92bee47177b170b2a1c Catalin(ux) M. BOIE 2020-08-23 14:43:10
Commit b667130e6c5721a3d30193863a5defd8bbff50f1 - Added rate limit for ssh and git connections
Author: Catalin(ux) M. BOIE
Author date (UTC): 2020-11-30 10:49
Committer name: Catalin(ux) M. BOIE
Committer date (UTC): 2020-11-30 10:49
Parent(s): abe44edadda9da7c639b7bd8c9e13e6058555669
Signer:
Signing key:
Signing status: N
Tree: 14b73bd4f98a6e42f48542e7465ddba36a4c629c
File Lines added Lines deleted
scripts/remote.php 24 16
File scripts/remote.php changed (mode: 100644) (index 308edbe..112281c)
... ... ini_set('track_errors', 'On');
5 5
6 6 require_once('/etc/rocketgit/config.php'); require_once('/etc/rocketgit/config.php');
7 7
8 require_once(__DIR__ . '/../init.inc.php');
9 require_once(__DIR__ . '/../util.inc.php');
10 require_once(__DIR__ . '/../log.inc.php');
11 require_once(__DIR__ . '/../sql.inc.php');
12 require_once(__DIR__ . '/../struct.inc.php');
13 require_once(__DIR__ . '/../user.inc.php');
14 require_once(__DIR__ . '/../repo.inc.php');
15 require_once(__DIR__ . '/../prof.inc.php');
16 require_once(__DIR__ . '/../ssh.inc.php');
17 require_once(__DIR__ . '/../keys.inc.php');
18 require_once(__DIR__ . '/../fixes.inc.php');
19 require_once(__DIR__ . '/../plan.inc.php');
20 require_once(__DIR__ . '/../stats.inc.php');
21 require_once(__DIR__ . '/../ver.php');
8 require_once(__DIR__ . '/../inc/init.inc.php');
9 require_once(__DIR__ . '/../inc/util.inc.php');
10 require_once(__DIR__ . '/../inc/log.inc.php');
11 require_once(__DIR__ . '/../inc/sql.inc.php');
12 require_once(__DIR__ . '/../inc/struct.inc.php');
13 require_once(__DIR__ . '/../inc/user.inc.php');
14 require_once(__DIR__ . '/../inc/repo.inc.php');
15 require_once(__DIR__ . '/../inc/prof.inc.php');
16 require_once(__DIR__ . '/../inc/ssh.inc.php');
17 require_once(__DIR__ . '/../inc/keys.inc.php');
18 require_once(__DIR__ . '/../inc/fixes.inc.php');
19 require_once(__DIR__ . '/../inc/plan.inc.php');
20 require_once(__DIR__ . '/../inc/stats.inc.php');
21 require_once(__DIR__ . '/../inc/ratelimit.inc.php');
22 require_once(__DIR__ . '/../inc/ver.php');
22 23
23 24 rg_prof_start('remote.php'); rg_prof_start('remote.php');
24 25
 
... ... if (isset($_SERVER['SSH_CONNECTION'])) {
133 134 info('date/time: ' . gmdate('Y-m-d H:i:s') info('date/time: ' . gmdate('Y-m-d H:i:s')
134 135 . ', debug id ' . $rg_log_sid . '.'); . ', debug id ' . $rg_log_sid . '.');
135 136
136 $must_exit = FALSE;
137 if (strstr($flags, 'N')) {
137 if (strstr($flags, 'N')) { // normal key
138 138 $login_ui = rg_user_info($db, $login_uid, '', ''); $login_ui = rg_user_info($db, $login_uid, '', '');
139 139 if ($login_ui['exists'] != 1) if ($login_ui['exists'] != 1)
140 140 fatal('User does not exists (conn).'); fatal('User does not exists (conn).');
 
... ... if (isset($_SERVER['SSH_CONNECTION'])) {
143 143
144 144 putenv('ROCKETGIT_SHOW_INFO=0'); putenv('ROCKETGIT_SHOW_INFO=0');
145 145
146 $lim = rg_rate_limit($db, $rg['ip']);
147 if ($lim == 0)
148 fatal('Too many requests! Please slow down.');
149
146 150 // We assume that the login user is the target user and no repo // We assume that the login user is the target user and no repo
147 151 rg_stats_conns_set('uid', $login_ui['uid']); rg_stats_conns_set('uid', $login_ui['uid']);
148 152 rg_stats_conns_set('repo_id', 0); rg_stats_conns_set('repo_id', 0);
 
... ... if (isset($_SERVER['SSH_CONNECTION'])) {
211 215
212 216 $rg['ip'] = rg_fix_ip(getenv('REMOTE_HOST')); $rg['ip'] = rg_fix_ip(getenv('REMOTE_HOST'));
213 217 rg_stats_conns_set('ip', $rg['ip']); rg_stats_conns_set('ip', $rg['ip']);
218
219 $lim = rg_rate_limit($db, $rg['ip']);
220 if ($lim == 0)
221 fatal('Too many requests! Please slow down.');
214 222 } }
215 223
216 224 if (strncasecmp($cmd_repo, 'git-upload-pack', 15) == 0) { if (strncasecmp($cmd_repo, 'git-upload-pack', 15) == 0) {
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/catalinux/rocketgit

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/catalinux/rocketgit

Clone this repository using git:
git clone git://git.rocketgit.com/user/catalinux/rocketgit

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main