Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
helper-scripts
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
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
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Georg Koppen
helper-scripts
Commits
b40a0e10
Commit
b40a0e10
authored
Mar 16, 2020
by
Georg Koppen
Browse files
Options
Downloads
Patches
Plain Diff
Bug 32864: Add script for help with exit relays with DNS issues
parent
22e35449
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
bad-exit-dns.sh
+88
-0
88 additions, 0 deletions
bad-exit-dns.sh
with
88 additions
and
0 deletions
bad-exit-dns.sh
0 → 100755
+
88
−
0
View file @
b40a0e10
#!/bin/bash
# Copyright (c) 2020, The Tor Project, Inc.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
#
# * Neither the names of the copyright owners nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# Usage:
# 0) Make sure you have the `jr` tool installed first
# 1) Point this script to a file containing the JSON result of a
# `tor_dns_survey`-run, optionally specifying an error threshold for relays
# we are interested in (default is 10)
# 2) The result will be the RSA fingerprints of relays with at least as many
# test run errors shown as the chosen threshold specifies.
if
[
"$#"
=
1
]
;
then
json_file
=
"
$1
"
threshold
=
10
elif
[
"$#"
=
2
]
;
then
json_file
=
"
$1
"
threshold
=
"
$2
"
else
echo
>
&2
"Usage:
$0
JSON_file [error threshold]"
exit
1
fi
date
=
`
date
+%s
`
# Extract the relays and fingerprints
relays
=
`
jq
'.["eff.org"]'
$json_file
`
fps
=
`
jq keys
<<<
$relays
`
# How many relays we tested
relay_length
=
`
jq length
<<<
$fps
`
for
((
r
=
0
;
r <
$relay_length
;
r++
))
do
failures
=
0
status
=()
relay
=
`
jq .[
$r
]
<<<
$fps
`
echo
"Relay to check:
$relay
"
relay_results
=
`
jq .[
"
$relay
"
]
<<<
$relays
`
# We have measured each relay ten times, let's check the results
for
i
in
{
0..9
}
do
result
=
`
jq
--arg
count
$i
'.[$count|tonumber] | .[0]'
<<<
$relay_results
`
# Record the status, so we can help relay operators better
status+
=(
"
$result
"
)
if
[[
$result
!=
*
"
\"
SUCCEEDED
\"
"
*
]]
then
((
failures++
))
fi
done
# We are only interested in relays with failures that are equal to or above our
# threshold.
if
[[
$failures
-ge
$threshold
]]
then
echo
"
$relay
"
|
grep
-oh
-E
[
0-9A-F]
{
40
}
>>
dns_failures_
$date
for
i
in
"
${
status
[@]
}
"
do
echo
"
$i
"
>>
dns_failures_
$date
done
echo
""
>>
dns_failures_
$date
fi
done
exit
0
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