Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new failures report and main category #224

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
new failures report and main category
    - create new main category Failures
    - create new report for failed authentication attempts
    - move failed webhooks report to this new category
  • Loading branch information
Todd O'Connor committed Dec 20, 2020
commit fe9ecadd1a97eb60d5fabe12fc0c082d56cc2174
9 changes: 7 additions & 2 deletions docs/_data/navigation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,13 @@
url: "/housekeeping-repo-location"
- title: "Forks"
url: "/housekeeping-forks"
- title: "Failed Webhooks"
url: "/housekeeping-failed-webhooks"
- title: "Failures"
url: "/failures-failed-authentication"
subnavigation:
- title: "Authentication"
url: "/failures-failed-authentication"
- title: "Webhooks"
url: "/failures-failed-webhooks"
- title: "Recommendations"
url: "/recommendations-tokenless-auth"
subnavigation:
Expand Down
13 changes: 13 additions & 0 deletions docs/demo-data/failed-auth-detailed.tsv
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
user count
tom 105
mary 96
jane 48
mike 48
bob 40
bill 33
sue 16
cindy 9
joe 3
buildbot 3
deploybot 3
testbot 3
7 changes: 7 additions & 0 deletions docs/demo-data/failed-auth.tsv
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
date failed authentication
2020-12-01 1005
2020-12-02 352
2020-12-03 564
2020-12-04 410
2020-12-05 455
2020-12-06 407
59 changes: 59 additions & 0 deletions docs/failures-failed-authentication.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
---
layout: default
title: Failed Authentication
permalink: /failures-failed-authentication
---

<div class="chart-placeholder">
<h3>Failed Authentication</h3>
<canvas
data-url="{{ site.dataURL }}/failed-auth.tsv"
data-type="history"
data-config='{
"views":
[
{
"label": "2 m",
"tooltip": "Show the last 2 months",
"aggregate": false,
"slice": [0, 61],
"default": true
},
{
"label": "2 y",
"tooltip": "Show the last 2 years",
"aggregate":
{
"period": "week",
"method": "sum"
},
"slice": [0, 106]
},
{
"label": "all",
"tooltip": "Show all data",
"aggregate":
{
"period": "week",
"method": "sum"
}
}
]
}'></canvas>
<div class="info-box">
<p>
Looking at failed authentication attempts across the system is helpful in spotting misconfigured systems that may be tying up authentication workers.
</p>
<p>
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
may be configured with a user account which is no longer active in GitHub and/or your company.
</p>
<p>
Therefore, you should try to reduce them.
</p>
</div>
</div>

<div class="chart-placeholder">
<table data-url="{{ site.dataURL }}/failed-auth-detailed.tsv" data-type="table"></table>
</div>
19 changes: 19 additions & 0 deletions updater/reports/ReportFailedAuth.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
from .ReportDaily import *

# Report how many failed authentication attempts
class ReportFailedAuth(ReportDaily):
def name(self):
return "failed-auth"

def updateDailyData(self):
self.detailedHeader, newData = self.parseData(
self.executeScript(self.scriptPath("failed-auth.sh")))
self.header = ["date", "failed authentication"]
self.data.append(
[
str(self.yesterday()),
sum(map(lambda x: int(x[4] if len(x) > 3 else 0), newData)),
])
self.detailedData = newData[:25]
self.truncateData(self.timeRangeTotal())
self.sortDataByDate()
21 changes: 21 additions & 0 deletions updater/scripts/failed-auth.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

#
# List failed authentication attempts
#

echo -e "user\tcount"

zcat -f /var/log/github/auth.log.1* |
grep -hF 'at=failure' |
grep -vF 'raw_login=nil' |
grep -oP ' login=.+?(?=raw_login)' |
grep -v 'https' |
grep -vF 'login=nil' |
grep -vF 'login=api' |
grep -vF 'login=git' |
perl -lape 's/login=//' |
sort |
uniq -ic |
sort -rn |
awk '{printf("%s\t%s\n",$2,$1)}'
2 changes: 2 additions & 0 deletions updater/update-stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from reports.ReportAPIRequestsByUser import *
from reports.ReportContributorsByOrg import *
from reports.ReportContributorsByRepo import *
from reports.ReportFailedAuth import *
from reports.ReportFailedWebhooks import *
from reports.ReportForksToOrgs import *
from reports.ReportGitDownload import *
Expand Down Expand Up @@ -81,6 +82,7 @@ def main():
ReportAPIRequestsByUser(configuration, dataDirectory, metaStats).update()
ReportContributorsByOrg(configuration, dataDirectory, metaStats).update()
ReportContributorsByRepo(configuration, dataDirectory, metaStats).update()
ReportFailedAuth(configuration, dataDirectory, metaStats).update()
ReportFailedWebhooks(configuration, dataDirectory, metaStats).update()
ReportForksToOrgs(configuration, dataDirectory, metaStats).update()
ReportGitDownload(configuration, dataDirectory, metaStats).update()
Expand Down