Skip to content

Commit ae83f92

Browse files
author
Todd O'Connor
authored
Merge f7300be into d39dd97
2 parents d39dd97 + f7300be commit ae83f92

File tree

8 files changed

+129
-3
lines changed

8 files changed

+129
-3
lines changed

docs/_data/navigation.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,13 @@
5555
url: "/housekeeping-repo-location"
5656
- title: "Forks"
5757
url: "/housekeeping-forks"
58-
- title: "Failed Webhooks"
59-
url: "/housekeeping-failed-webhooks"
58+
- title: "Failures"
59+
url: "/failures-failed-authentication"
60+
subnavigation:
61+
- title: "Authentication"
62+
url: "/failures-failed-authentication"
63+
- title: "Webhooks"
64+
url: "/failures-failed-webhooks"
6065
- title: "Recommendations"
6166
url: "/recommendations-tokenless-auth"
6267
subnavigation:
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
user count
2+
tom 105
3+
mary 96
4+
jane 48
5+
mike 48
6+
bob 40
7+
bill 33
8+
sue 16
9+
cindy 9
10+
joe 3
11+
buildbot 3
12+
deploybot 3
13+
testbot 3

docs/demo-data/failed-auth.tsv

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
date failed authentication
2+
2020-12-01 1005
3+
2020-12-02 352
4+
2020-12-03 564
5+
2020-12-04 410
6+
2020-12-05 455
7+
2020-12-06 407
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
---
2+
layout: default
3+
title: Failed Authentication
4+
permalink: /failures-failed-authentication
5+
---
6+
7+
<div class="chart-placeholder">
8+
<h3>Failed Authentication</h3>
9+
<canvas
10+
data-url="{{ site.dataURL }}/failed-auth.tsv"
11+
data-type="history"
12+
data-config='{
13+
"views":
14+
[
15+
{
16+
"label": "2 m",
17+
"tooltip": "Show the last 2 months",
18+
"aggregate": false,
19+
"slice": [0, 61],
20+
"default": true
21+
},
22+
{
23+
"label": "2 y",
24+
"tooltip": "Show the last 2 years",
25+
"aggregate":
26+
{
27+
"period": "week",
28+
"method": "sum"
29+
},
30+
"slice": [0, 106]
31+
},
32+
{
33+
"label": "all",
34+
"tooltip": "Show all data",
35+
"aggregate":
36+
{
37+
"period": "week",
38+
"method": "sum"
39+
}
40+
}
41+
]
42+
}'></canvas>
43+
<div class="info-box">
44+
<p>
45+
Looking at failed authentication attempts across the system is helpful in spotting misconfigured systems that may be tying up authentication workers.
46+
</p>
47+
<p>
48+
For example, users may have changed credentials used to access GitHub, however they failed to update CI/CD systems using those credentials. Another example is that a CI/CD system
49+
may be configured with a user account which is no longer active in GitHub and/or your company.
50+
</p>
51+
<p>
52+
Therefore, you should try to reduce them.
53+
</p>
54+
</div>
55+
</div>
56+
57+
<div class="chart-placeholder">
58+
<table data-url="{{ site.dataURL }}/failed-auth-detailed.tsv" data-type="table"></table>
59+
</div>

docs/housekeeping-failed-webhooks.html renamed to docs/failures-failed-webhooks.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
layout: default
33
title: Failed Webhooks
4-
permalink: /housekeeping-failed-webhooks
4+
permalink: /failures-failed-webhooks
55
---
66

77
<div class="chart-placeholder">
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
from .ReportDaily import *
2+
3+
# Report how many failed authentication attempts
4+
class ReportFailedAuth(ReportDaily):
5+
def name(self):
6+
return "failed-auth"
7+
8+
def updateDailyData(self):
9+
self.detailedHeader, newData = self.parseData(
10+
self.executeScript(self.scriptPath("failed-auth.sh")))
11+
self.header = ["date", "failed authentication"]
12+
self.data.append(
13+
[
14+
str(self.yesterday()),
15+
sum(map(lambda x: int(x[4] if len(x) > 3 else 0), newData)),
16+
])
17+
self.detailedData = newData[:25]
18+
self.truncateData(self.timeRangeTotal())
19+
self.sortDataByDate()

updater/scripts/failed-auth.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
3+
#
4+
# List failed authentication attempts
5+
#
6+
7+
echo -e "user\tcount"
8+
9+
zcat -f /var/log/github/auth.log.1* |
10+
grep -hF 'at=failure' |
11+
grep -vF 'raw_login=nil' |
12+
grep -oP ' login=.+?(?=raw_login)' |
13+
grep -v 'https' |
14+
grep -vF 'login=nil' |
15+
grep -vF 'login=api' |
16+
grep -vF 'login=git' |
17+
perl -lape 's/login=//' |
18+
sort |
19+
uniq -ic |
20+
sort -rn |
21+
awk '{printf("%s\t%s\n",$2,$1)}'

updater/update-stats.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from reports.ReportAPIRequestsByUser import *
1313
from reports.ReportContributorsByOrg import *
1414
from reports.ReportContributorsByRepo import *
15+
from reports.ReportFailedAuth import *
1516
from reports.ReportFailedWebhooks import *
1617
from reports.ReportForksToOrgs import *
1718
from reports.ReportGitDownload import *
@@ -81,6 +82,7 @@ def main():
8182
ReportAPIRequestsByUser(configuration, dataDirectory, metaStats).update()
8283
ReportContributorsByOrg(configuration, dataDirectory, metaStats).update()
8384
ReportContributorsByRepo(configuration, dataDirectory, metaStats).update()
85+
ReportFailedAuth(configuration, dataDirectory, metaStats).update()
8486
ReportFailedWebhooks(configuration, dataDirectory, metaStats).update()
8587
ReportForksToOrgs(configuration, dataDirectory, metaStats).update()
8688
ReportGitDownload(configuration, dataDirectory, metaStats).update()

0 commit comments

Comments
 (0)