Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
Tor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Benjamin J. Thompson
Tor
Commits
d34a5cdc
Commit
d34a5cdc
authored
14 years ago
by
Nick Mathewson
Browse files
Options
Downloads
Plain Diff
Merge branch 'hsdir_assignment' into maint-0.2.2
parents
600ad7bf
3a0c6021
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
changes/hsdir_assignment
+8
-0
8 additions, 0 deletions
changes/hsdir_assignment
src/or/dirserv.c
+18
-1
18 additions, 1 deletion
src/or/dirserv.c
src/or/rephist.c
+14
-0
14 additions, 0 deletions
src/or/rephist.c
src/or/rephist.h
+1
-0
1 addition, 0 deletions
src/or/rephist.h
with
41 additions
and
1 deletion
changes/hsdir_assignment
0 → 100644
+
8
−
0
View file @
d34a5cdc
o Security fixes:
- Directory authorities now use data collected from rephist when
choosing whether to assign the HSDir flag to relays, instead of
trusting the uptime value the relay reports in its descriptor.
This helps prevent an attack where a small set of nodes with
frequently-changing identity keys can blackhole a hidden service.
(Only authorities need upgrade; others will be fine once they do.)
Bugfix on 0.2.0.10-alpha; fixes bug 2709.
This diff is collapsed.
Click to expand it.
src/or/dirserv.c
+
18
−
1
View file @
d34a5cdc
...
...
@@ -43,6 +43,8 @@
extern
time_t
time_of_process_start
;
/* from main.c */
extern
long
stats_n_seconds_working
;
/* from main.c */
/** Do we need to regenerate the v1 directory when someone asks for it? */
static
time_t
the_directory_is_dirty
=
1
;
/** Do we need to regenerate the v1 runningrouters document when somebody
...
...
@@ -1775,7 +1777,22 @@ dirserv_thinks_router_is_unreliable(time_t now,
static
int
dirserv_thinks_router_is_hs_dir
(
routerinfo_t
*
router
,
time_t
now
)
{
long
uptime
=
real_uptime
(
router
,
now
);
long
uptime
;
/* If we haven't been running for at least
* get_options()->MinUptimeHidServDirectoryV2 seconds, we can't
* have accurate data telling us a relay has been up for at least
* that long. We also want to allow a bit of slack: Reachability
* tests aren't instant. If we haven't been running long enough,
* trust the relay. */
if
(
stats_n_seconds_working
>
get_options
()
->
MinUptimeHidServDirectoryV2
*
1
.
1
)
uptime
=
MIN
(
rep_hist_get_uptime
(
router
->
cache_info
.
identity_digest
,
now
),
real_uptime
(
router
,
now
));
else
uptime
=
real_uptime
(
router
,
now
);
/* XXX We shouldn't need to check dir_port, but we do because of
* bug 1693. In the future, once relays set wants_to_be_hs_dir
...
...
This diff is collapsed.
Click to expand it.
src/or/rephist.c
+
14
−
0
View file @
d34a5cdc
...
...
@@ -528,6 +528,20 @@ get_weighted_fractional_uptime(or_history_t *hist, time_t when)
return
((
double
)
up
)
/
total
;
}
/** Return how long the router whose identity digest is <b>id</b> has
* been reachable. Return 0 if the router is unknown or currently deemed
* unreachable. */
long
rep_hist_get_uptime
(
const
char
*
id
,
time_t
when
)
{
or_history_t
*
hist
=
get_or_history
(
id
);
if
(
!
hist
)
return
0
;
if
(
!
hist
->
start_of_run
||
when
<
hist
->
start_of_run
)
return
0
;
return
when
-
hist
->
start_of_run
;
}
/** Return an estimated MTBF for the router whose identity digest is
* <b>id</b>. Return 0 if the router is unknown. */
double
...
...
This diff is collapsed.
Click to expand it.
src/or/rephist.h
+
1
−
0
View file @
d34a5cdc
...
...
@@ -40,6 +40,7 @@ int rep_hist_record_mtbf_data(time_t now, int missing_means_down);
int
rep_hist_load_mtbf_data
(
time_t
now
);
time_t
rep_hist_downrate_old_runs
(
time_t
now
);
long
rep_hist_get_uptime
(
const
char
*
id
,
time_t
when
);
double
rep_hist_get_stability
(
const
char
*
id
,
time_t
when
);
double
rep_hist_get_weighted_fractional_uptime
(
const
char
*
id
,
time_t
when
);
long
rep_hist_get_weighted_time_known
(
const
char
*
id
,
time_t
when
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment