From cc24b3a21027431198f0f5e6c762516c2b0e00eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20B=C5=99ou=C5=A1ek?= <brousek@ics.muni.cz> Date: Sat, 24 Sep 2022 08:44:36 +0200 Subject: [PATCH] ci: common CI --- .flake8 | 3 + .gitignore | 718 ++++++++++++++++++++++++++++++++++++++++ .gitlab-ci.yml | 3 + .prettierignore | 725 +++++++++++++++++++++++++++++++++++++++++ .prettierrc.json | 1 + LICENSE | 19 +- README.md | 22 +- metadata_expiration.py | 6 +- nagios/README.md | 242 +++++++------- separate_oidc_logs.py | 22 +- separate_ssp_logs.py | 32 +- 11 files changed, 1640 insertions(+), 153 deletions(-) create mode 100644 .flake8 create mode 100644 .gitignore create mode 100644 .gitlab-ci.yml create mode 100644 .prettierignore create mode 100644 .prettierrc.json diff --git a/.flake8 b/.flake8 new file mode 100644 index 0000000..8dd399a --- /dev/null +++ b/.flake8 @@ -0,0 +1,3 @@ +[flake8] +max-line-length = 88 +extend-ignore = E203 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..25211b9 --- /dev/null +++ b/.gitignore @@ -0,0 +1,718 @@ +## Ansible + +*.retry + +## composer + +composer.phar +/vendor/ + +## Java + +# Compiled class file +*.class + +# Log file +*.log + +# BlueJ files +*.ctxt + +# Mobile Tools for Java (J2ME) +.mtj.tmp/ + +# Package Files # +*.jar +*.war +*.nar +*.ear +*.zip +*.tar.gz +*.rar + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* + +## JetBrains + +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/dictionaries +.idea/**/shelf + +# Generated files +.idea/**/contentModel.xml + +# Sensitive or high-churn files +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/dbnavigator.xml + +# Gradle +.idea/**/gradle.xml +.idea/**/libraries + +# Gradle and Maven with auto-import +.idea/modules.xml +.idea/*.iml +.idea/modules + +# CMake +cmake-build-*/ + +# Mongo Explorer plugin +.idea/**/mongoSettings.xml + +# File-based project format +*.iws + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +# Editor-based Rest Client +.idea/httpRequests + +# Android studio 3.1+ serialized cache file +.idea/caches/build_file_checksums.ser + +## macOS + +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +## maven + +target/ +pom.xml.tag +pom.xml.releaseBackup +pom.xml.versionsBackup +pom.xml.next +release.properties +dependency-reduced-pom.xml +buildNumber.properties +.mvn/timing.properties +.mvn/wrapper/maven-wrapper.jar + +## node + +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (https://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules/ +jspm_packages/ + +# TypeScript v1 declaration files +typings/ + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variables file +.env + +# parcel-bundler cache (https://parceljs.org/) +.cache + +# next.js build output +.next + +# nuxt.js build output +.nuxt + +# vuepress build output +.vuepress/dist + +# Serverless directories +.serverless/ + +# FuseBox cache +.fusebox/ + +#DynamoDB Local files +.dynamodb/ + +## Python + +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib64/ +parts/ +sdist/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +.hypothesis/ +.pytest_cache/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +.python-version + +# celery beat schedule file +celerybeat-schedule + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +## vim + +# Swap +[._]*.s[a-v][a-z] +[._]*.sw[a-p] +[._]s[a-rt-v][a-z] +[._]ss[a-gi-z] +[._]sw[a-p] + +# Session +Session.vim + +# Temporary +.netrwhist +*~ +# Auto-generated tag files +tags +# Persistent undo +[._]*.un~ + +## Visual Studio + +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUNIT +*.VisualState.xml +TestResult.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding add-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!*.[Cc]ache/ + +# Others +ClientBin/ +~ +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +bower_components/ +# ASP.NET Core default setup: bower directory is configured as wwwroot/lib/ and bower restore is true +**/wwwroot/lib/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# JetBrains Rider +.idea/ +*.sln.iml + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +## Windows + +# Windows thumbnail cache files +Thumbs.db +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..1576414 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,3 @@ +include: + - project: perun-proxy-aai/common + file: /templates/.gitlab-ci-template.yml diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..e63377a --- /dev/null +++ b/.prettierignore @@ -0,0 +1,725 @@ +## Ansible + +*.retry + +## composer + +composer.phar +/vendor/ + +## Java + +# Compiled class file +*.class + +# Log file +*.log + +# BlueJ files +*.ctxt + +# Mobile Tools for Java (J2ME) +.mtj.tmp/ + +# Package Files # +*.jar +*.war +*.nar +*.ear +*.zip +*.tar.gz +*.rar + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* + +## JetBrains + +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/dictionaries +.idea/**/shelf + +# Generated files +.idea/**/contentModel.xml + +# Sensitive or high-churn files +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/dbnavigator.xml + +# Gradle +.idea/**/gradle.xml +.idea/**/libraries + +# Gradle and Maven with auto-import +.idea/modules.xml +.idea/*.iml +.idea/modules + +# CMake +cmake-build-*/ + +# Mongo Explorer plugin +.idea/**/mongoSettings.xml + +# File-based project format +*.iws + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +# Editor-based Rest Client +.idea/httpRequests + +# Android studio 3.1+ serialized cache file +.idea/caches/build_file_checksums.ser + +## macOS + +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +## maven + +target/ +pom.xml.tag +pom.xml.releaseBackup +pom.xml.versionsBackup +pom.xml.next +release.properties +dependency-reduced-pom.xml +buildNumber.properties +.mvn/timing.properties +.mvn/wrapper/maven-wrapper.jar + +## node + +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (https://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules/ +jspm_packages/ + +# TypeScript v1 declaration files +typings/ + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variables file +.env + +# parcel-bundler cache (https://parceljs.org/) +.cache + +# next.js build output +.next + +# nuxt.js build output +.nuxt + +# vuepress build output +.vuepress/dist + +# Serverless directories +.serverless/ + +# FuseBox cache +.fusebox/ + +#DynamoDB Local files +.dynamodb/ + +## Python + +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib64/ +parts/ +sdist/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +.hypothesis/ +.pytest_cache/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +.python-version + +# celery beat schedule file +celerybeat-schedule + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +## vim + +# Swap +[._]*.s[a-v][a-z] +[._]*.sw[a-p] +[._]s[a-rt-v][a-z] +[._]ss[a-gi-z] +[._]sw[a-p] + +# Session +Session.vim + +# Temporary +.netrwhist +*~ +# Auto-generated tag files +tags +# Persistent undo +[._]*.un~ + +## Visual Studio + +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUNIT +*.VisualState.xml +TestResult.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding add-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!*.[Cc]ache/ + +# Others +ClientBin/ +~ +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +bower_components/ +# ASP.NET Core default setup: bower directory is configured as wwwroot/lib/ and bower restore is true +**/wwwroot/lib/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# JetBrains Rider +.idea/ +*.sln.iml + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +## Windows + +# Windows thumbnail cache files +Thumbs.db +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk + +package-lock.json +composer.lock +CHANGELOG.md +.git +*.min.css +*.min.js diff --git a/.prettierrc.json b/.prettierrc.json new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/.prettierrc.json @@ -0,0 +1 @@ +{} diff --git a/LICENSE b/LICENSE index 344c761..42bda4f 100644 --- a/LICENSE +++ b/LICENSE @@ -1,17 +1,20 @@ -BSD 2-Clause License +BSD 3-Clause License -Copyright (c) 2019, CESNET -All rights reserved. +Copyright (c) 2022, CESNET, z. s. p. o. and Institute of Computer Science, Masaryk University 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. +1. 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. +2. 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. + +3. Neither the name of the copyright holder 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 diff --git a/README.md b/README.md index 4087d0c..1acbb6b 100644 --- a/README.md +++ b/README.md @@ -5,19 +5,23 @@ All nagios scripts are located under `nagios` directory. ## List scripts ### separate_ssp_script.py -* Script for remove all logs from test accounts from SimpleSAMLlogs -* Params: - * 1 - The file name - +- Script for remove all logs from test accounts from SimpleSAMLlogs + +- Params: + - 1 - The file name + ### backup_database.sh -* Do mysqldump into `/opt/mariadb_backup` and remove all dump file older than 7 days + +- Do mysqldump into `/opt/mariadb_backup` and remove all dump file older than 7 days ### separate_oidc_logs.py -* Script for remove all logs from test accounts from OIDC logs + +- Script for remove all logs from test accounts from OIDC logs ### metadata_expiration.py -* This script checks whether there are some metadata close to expiration date -* Params: - * 1 - url to a page which prints a time when expires the metadata closest to expiration \ No newline at end of file +- This script checks whether there are some metadata close to expiration date + +- Params: + - 1 - url to a page which prints a time when expires the metadata closest to expiration diff --git a/metadata_expiration.py b/metadata_expiration.py index cd1b68d..ea08781 100644 --- a/metadata_expiration.py +++ b/metadata_expiration.py @@ -7,8 +7,8 @@ html = urlopen(url).read() closest_expiration = BeautifulSoup(html, "html.parser") if float(closest_expiration.text) >= 24: - print('0 metadata_expiration - OK (' + closest_expiration.text + ')') + print("0 metadata_expiration - OK (" + closest_expiration.text + ")") elif float(closest_expiration.text) >= 12: - print('1 metadata_expiration - WARNING (' + closest_expiration.text + ')') + print("1 metadata_expiration - WARNING (" + closest_expiration.text + ")") else: - print('2 metadata_expiration - CRITICAL (' + closest_expiration.text + ')') + print("2 metadata_expiration - CRITICAL (" + closest_expiration.text + ")") diff --git a/nagios/README.md b/nagios/README.md index 1b53462..4bdb27a 100644 --- a/nagios/README.md +++ b/nagios/README.md @@ -1,171 +1,193 @@ # ProxyIdP Nagios scripts ## List of Local scripts + Local scripts are located in /usr/lib/check_mk/local/ -### php_syntax_check.sh -* Attributes to be filled: +### php_syntax_check.sh + +- Attributes to be filled: <pre> + # List of paths to check separated by space + paths="" + </pre> -### git_pull_check.sh -* Attributes to be filled: +### git_pull_check.sh + +- Attributes to be filled: <pre> + # The root directory to check + dir="" + </pre> ### services_running_check.sh -* Attributes to be filled: + +- Attributes to be filled: <pre> + # List of service names separated by space + services="" + </pre> ### Proxy idp authentication test - local + There are two main scripts (one of them uses SAML, the other uses OIDC) checking the login to SP via the host from which the scripts run and some helper scripts located in folder `proxy_idp_auth_test_script/` The main script gradually try to sign in via AAI Playground IdP, MUNI IdP and CESNET IdP. These scripts are able to cache their last result. -* Params: - * 1 - if this param contains '-f', script does not use its cache and is forced to do whole login process - -* Main scripts: - * proxy_idp_auth_test_saml.sh - * proxy_idp_auth_test_oidc.sh -* Helper scripts: - * proxy_idp_auth_test_script/saml_auth_test_aai.sh - * proxy_idp_auth_test_script/saml_auth_test_cesnet.sh - * proxy_idp_auth_test_script/saml_auth_test_muni.sh - * proxy_idp_auth_test_script/oidc_auth_test_aai.sh - * proxy_idp_auth_test_script/oidc_auth_test_cesnet.sh - * proxy_idp_auth_test_script/oidc_auth_test_muni.sh -* Requirements: - * library *bc* +- Params: + + - 1 - if this param contains '-f', script does not use its cache and is forced to do whole login process + +- Main scripts: + - proxy_idp_auth_test_saml.sh + - proxy_idp_auth_test_oidc.sh +- Helper scripts: + - proxy_idp_auth_test_script/saml_auth_test_aai.sh + - proxy_idp_auth_test_script/saml_auth_test_cesnet.sh + - proxy_idp_auth_test_script/saml_auth_test_muni.sh + - proxy_idp_auth_test_script/oidc_auth_test_aai.sh + - proxy_idp_auth_test_script/oidc_auth_test_cesnet.sh + - proxy_idp_auth_test_script/oidc_auth_test_muni.sh +- Requirements: + + - library _bc_ + <pre> + apt-get install bc + </pre> + - Configuration file proxy_idp_auth_test_config.sh in the same folder as script + + - Attributes to be filled: <pre> - apt-get install bc + # The urls of tested SP + # For example: https://aai-playground.ics.muni.cz/simplesaml/nagios_check.php?proxy_idp=cesnet&authentication=muni + AAI_SAML_TEST_SITE="" # Needed only for SAML + MUNI_SAML_TEST_SITE="" # Needed only for SAML + CESNET_SAML_TEST_SITE="" # Needed only for SAML + AAI_OIDC_TEST_SITE="" # Needed only for OIDC + MUNI_OIDC_TEST_SITE="" # Needed only for OIDC + CESNET_OIDC_TEST_SITE="" # Needed only for OIDC + + # The url of logins form of used IdP + # For example: https://idp2.ics.muni.cz/idp/Authn/UserPassword + AAI_LOGIN_SITE="" + MUNI_LOGIN_SITE="" + CESNET_LOGIN_SITE="" + + # Fill in logins + AAI_LOGIN="" + MUNI_LOGIN="" + CESNET_LOGIN="" + + # Fill in passwords as string + MUNI_PASSWORD="" + CESNET_PASSWORD="" + + # Fill in the instance name + # Instance name must not contain a space + INSTANCE_NAME="" + + # Fill in the global domain name of ProxyIdP + # For example: login.cesnet.cz + PROXY_DOMAIN_NAME="" + + # How long is normal for total roundtrip (seconds) + SAML_WARNING_TIME=10 # Needed only for SAML + OIDC_WARNING_TIME=15 # Needed only for OIDC + + # Timeout time + TIMEOUT_TIME=40 + + # Cache time + CACHE_TIME=60 </pre> - * Configuration file proxy_idp_auth_test_config.sh in the same folder as script - * Attributes to be filled: - <pre> - # The urls of tested SP - # For example: https://aai-playground.ics.muni.cz/simplesaml/nagios_check.php?proxy_idp=cesnet&authentication=muni - AAI_SAML_TEST_SITE="" # Needed only for SAML - MUNI_SAML_TEST_SITE="" # Needed only for SAML - CESNET_SAML_TEST_SITE="" # Needed only for SAML - AAI_OIDC_TEST_SITE="" # Needed only for OIDC - MUNI_OIDC_TEST_SITE="" # Needed only for OIDC - CESNET_OIDC_TEST_SITE="" # Needed only for OIDC - - # The url of logins form of used IdP - # For example: https://idp2.ics.muni.cz/idp/Authn/UserPassword - AAI_LOGIN_SITE="" - MUNI_LOGIN_SITE="" - CESNET_LOGIN_SITE="" - - # Fill in logins - AAI_LOGIN="" - MUNI_LOGIN="" - CESNET_LOGIN="" - - # Fill in passwords as string - MUNI_PASSWORD="" - CESNET_PASSWORD="" - - # Fill in the instance name - # Instance name must not contain a space - INSTANCE_NAME="" - - # Fill in the global domain name of ProxyIdP - # For example: login.cesnet.cz - PROXY_DOMAIN_NAME="" - - # How long is normal for total roundtrip (seconds) - SAML_WARNING_TIME=10 # Needed only for SAML - OIDC_WARNING_TIME=15 # Needed only for OIDC - - # Timeout time - TIMEOUT_TIME=40 - - # Cache time - CACHE_TIME=60 - </pre> ### ldap_status.sh + This script checks if the LDAP servers are accessible -* Requirements: - * library *ldap-utils* - <pre> - apt-get install ldap-utils - </pre> -* Attributes to be filled: +- Requirements: + - library _ldap-utils_ + <pre> + apt-get install ldap-utils + </pre> +- Attributes to be filled: <pre> # LDAP username user="" - + # LDAP password password="" - + # Base dn of LDAP tree basedn="" - + # eduPersonPrincipalName which will be searched searchedIdentity="" - + # List of LDPA hostnames separated by space # Included ldap:// or ldaps:// hostnames="" </pre> ## List of plugins + Plugins are located in /usr/lib/check_mk/plugins/ ## Nagios active scripts + Active scripts are located in Nagios machine ### Proxy idp authentication test - active + There are two main scripts (one uses SAML, the other uses OIDC) checking the login via active ProxyIdP machine and some helper scripts located in folder `proxy_idp_auth_test_script/` The main script gradually try to sign in via AAI Playground IdP, MUNI IdP and CESNET IdP. -* Main scripts: - * proxy_idp_auth_test_active_saml.sh - * proxy_idp_auth_test_active_oidc.sh -* Helper scripts: - * proxy_idp_auth_test_script/saml_auth_test_cesnet_active.sh - * proxy_idp_auth_test_script/saml_auth_test_muni_active.sh - * proxy_idp_auth_test_script/oidc_auth_test_cesnet_active.sh - * proxy_idp_auth_test_script/oidc_auth_test_muni_active.sh -* How to run these scripts: - * Params: - * 1 - The url of tested SP via MU account - * 2 - The url of login form of MU IdP - * 3 - MU Login - * 4 - MU Password - * 5 - The url of tested SP via CESNET account - * 6 - The url of login form of CESNET IdP - * 7 - CESNET Login - * 8 - CESNET Password - * 9 - Roundtrip time (in seconds) - The standard login time. After this time the return value can be changed to WARNING state - * 10 - Timeout time (in seconds) - After this time the helper script timeouts - * Examples: - <pre> - ./proxy_idp_auth_test_active_saml.sh "https://aai-playground.ics.muni.cz/simplesaml/nagios_check.php?proxy_idp=cesnet&authenticate=muni" "https://idp2.ics.muni.cz/idp/Authn/UserPassword" "login" "passwd" "https://aai-playground.ics.muni.cz/simplesaml/nagios_check.php?proxy_idp=cesnet&authenticate=cesnet" "https://idp2.ics.muni.cz/idp/Authn/UserPassword" "login" "passwd" 10 40 - ./proxy_idp_auth_test_active_oidc.sh "https://aai-playground.ics.muni.cz/simplesaml/nagios_check.php?proxy_idp=cesnet&authenticate=muni" "https://idp2.ics.muni.cz/idp/Authn/UserPassword" "login" "passwd" "https://aai-playground.ics.muni.cz/simplesaml/nagios_check.php?proxy_idp=cesnet&authenticate=cesnet" "https://idp2.ics.muni.cz/idp/Authn/UserPassword" "login" "passwd" 15 40 - </pre> +- Main scripts: + - proxy_idp_auth_test_active_saml.sh + - proxy_idp_auth_test_active_oidc.sh +- Helper scripts: + - proxy_idp_auth_test_script/saml_auth_test_cesnet_active.sh + - proxy_idp_auth_test_script/saml_auth_test_muni_active.sh + - proxy_idp_auth_test_script/oidc_auth_test_cesnet_active.sh + - proxy_idp_auth_test_script/oidc_auth_test_muni_active.sh +- How to run these scripts: + - Params: + - 1 - The url of tested SP via MU account + - 2 - The url of login form of MU IdP + - 3 - MU Login + - 4 - MU Password + - 5 - The url of tested SP via CESNET account + - 6 - The url of login form of CESNET IdP + - 7 - CESNET Login + - 8 - CESNET Password + - 9 - Roundtrip time (in seconds) - The standard login time. After this time the return value can be changed to WARNING state + - 10 - Timeout time (in seconds) - After this time the helper script timeouts + - Examples: + <pre> + ./proxy_idp_auth_test_active_saml.sh "https://aai-playground.ics.muni.cz/simplesaml/nagios_check.php?proxy_idp=cesnet&authenticate=muni" "https://idp2.ics.muni.cz/idp/Authn/UserPassword" "login" "passwd" "https://aai-playground.ics.muni.cz/simplesaml/nagios_check.php?proxy_idp=cesnet&authenticate=cesnet" "https://idp2.ics.muni.cz/idp/Authn/UserPassword" "login" "passwd" 10 40 + ./proxy_idp_auth_test_active_oidc.sh "https://aai-playground.ics.muni.cz/simplesaml/nagios_check.php?proxy_idp=cesnet&authenticate=muni" "https://idp2.ics.muni.cz/idp/Authn/UserPassword" "login" "passwd" "https://aai-playground.ics.muni.cz/simplesaml/nagios_check.php?proxy_idp=cesnet&authenticate=cesnet" "https://idp2.ics.muni.cz/idp/Authn/UserPassword" "login" "passwd" 15 40 + </pre> ### mariadb_replication_check.sh + This script checks the database replication -* How to run this script: - * Params: - * 1 - Login used for connection to the database - * 2 - Password used for connection to the database (the password has to be in quotes) - * 3 - List of addresses separated by space (the list has to be in quotes) - * Example: - <pre> - ./mariadb_replication_check.sh "USER" "PASSWORD" "Address1 Address2 Address3" - </pre> +- How to run this script: + - Params: + - 1 - Login used for connection to the database + - 2 - Password used for connection to the database (the password has to be in quotes) + - 3 - List of addresses separated by space (the list has to be in quotes) + - Example: + <pre> + ./mariadb_replication_check.sh "USER" "PASSWORD" "Address1 Address2 Address3" + </pre> diff --git a/separate_oidc_logs.py b/separate_oidc_logs.py index 87645a3..4e0c27c 100644 --- a/separate_oidc_logs.py +++ b/separate_oidc_logs.py @@ -7,23 +7,23 @@ import sys from os import mkdir, path, rename, remove, system if len(sys.argv) <= 1: - print('One argument is expected!') + print("One argument is expected!") exit(-1) absolute_file_name = sys.argv[1] if not path.exists(absolute_file_name): - print('File with name ' + absolute_file_name + ' doesn\'t exists!') + print("File with name " + absolute_file_name + " doesn't exists!") exit(-1) file_name = path.basename(absolute_file_name) dir_name = path.dirname(absolute_file_name) if len(dir_name) != 0: - dir_name += '/' + dir_name += "/" -full_log_dir_name = dir_name + 'full_logs/' -full_log_file_name = 'full_' + file_name +full_log_dir_name = dir_name + "full_logs/" +full_log_file_name = "full_" + file_name full_log_absolute_name = full_log_dir_name + full_log_file_name if not path.exists(full_log_dir_name): @@ -32,20 +32,20 @@ if not path.exists(full_log_dir_name): rename(absolute_file_name, full_log_absolute_name) session_ids = set() -regex_session_id = '(?<=\s\[)\w+(?=\]\s+\S+\s+:)' +regex_session_id = "(?<=\s\[)\w+(?=\]\s+\S+\s+:)" file = open(full_log_absolute_name, "r") for line in file: - res = re.search('proxyidptester@cesnet.cz|9006464@muni.cz', line) + res = re.search("proxyidptester@cesnet.cz|9006464@muni.cz", line) if res is not None: session_id = re.search(regex_session_id, line) if session_id is not None: session_ids.add(session_id.group(0)) file.close() -file = open(full_log_absolute_name, 'r') +file = open(full_log_absolute_name, "r") -final_log_file = open(absolute_file_name, 'w') +final_log_file = open(absolute_file_name, "w") last_session_id = "" for line in file: session_id = re.search(regex_session_id, line) @@ -59,7 +59,9 @@ file.close() final_log_file.close() # Zip old log file -with open(full_log_absolute_name, 'rb') as f_in, gzip.open(full_log_absolute_name + '.gz', 'wb') as f_out: +with open(full_log_absolute_name, "rb") as f_in, gzip.open( + full_log_absolute_name + ".gz", "wb" +) as f_out: shutil.copyfileobj(f_in, f_out) # Remove unzip file diff --git a/separate_ssp_logs.py b/separate_ssp_logs.py index 083669b..d085137 100755 --- a/separate_ssp_logs.py +++ b/separate_ssp_logs.py @@ -7,23 +7,23 @@ import sys from os import mkdir, path, rename, remove, system if len(sys.argv) <= 1: - print('One argument is expected!') + print("One argument is expected!") exit(-1) absolute_file_name = sys.argv[1] if not path.exists(absolute_file_name): - print('File with name ' + absolute_file_name + ' doesn\'t exists!') + print("File with name " + absolute_file_name + " doesn't exists!") exit(-1) file_name = path.basename(absolute_file_name) dir_name = path.dirname(absolute_file_name) if len(dir_name) != 0: - dir_name += '/' + dir_name += "/" -full_log_dir_name = dir_name + 'full_logs/' -full_log_file_name = 'full_' + file_name +full_log_dir_name = dir_name + "full_logs/" +full_log_file_name = "full_" + file_name full_log_absolute_name = full_log_dir_name + full_log_file_name if not path.exists(full_log_dir_name): @@ -33,12 +33,12 @@ rename(absolute_file_name, full_log_absolute_name) session_ids = set() thread_ids = set() -regex_session_id = '^.*]:\s\d\s\[(.*?)\].*$' -regex_thread_id = '^.*\[(.*?)\]:.*$' +regex_session_id = "^.*]:\s\d\s\[(.*?)\].*$" +regex_thread_id = "^.*\[(.*?)\]:.*$" file = open(full_log_absolute_name, "r") for line in file: - res = re.search('proxyidptester@cesnet.cz|9006464@muni.cz', line) + res = re.search("proxyidptester@cesnet.cz|9006464@muni.cz", line) if res is not None: session_id = re.search(regex_session_id, line) if session_id is not None: @@ -48,24 +48,30 @@ for line in file: thread_ids.add(thread_id.group(1)) file.close() -file = open(full_log_absolute_name, 'r') +file = open(full_log_absolute_name, "r") -final_log_file = open(absolute_file_name, 'w') -last_session_id="" +final_log_file = open(absolute_file_name, "w") +last_session_id = "" for line in file: session_id = re.search(regex_session_id, line) if session_id is not None: last_session_id = session_id.group(1) if session_id is None or session_id.group(1) not in session_ids: thread_id = re.search(regex_thread_id, line) - if thread_id is None or thread_id.group(1) not in thread_ids or last_session_id not in session_ids: + if ( + thread_id is None + or thread_id.group(1) not in thread_ids + or last_session_id not in session_ids + ): final_log_file.write(line) file.close() final_log_file.close() # Zip old log file -with open(full_log_absolute_name, 'rb') as f_in, gzip.open(full_log_absolute_name + '.gz' , 'wb') as f_out: +with open(full_log_absolute_name, "rb") as f_in, gzip.open( + full_log_absolute_name + ".gz", "wb" +) as f_out: shutil.copyfileobj(f_in, f_out) # Remove unzip file -- GitLab