Skip to content
This repository has been archived by the owner on Jan 22, 2020. It is now read-only.

2019 #49

Open
wants to merge 22 commits into
base: master
Choose a base branch
from
Open

2019 #49

Show file tree
Hide file tree
Changes from all commits
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
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ See the example site: https://certificatemonitor.org/

## Requirements

- PHP 5.6+
- PHP 5.6+ (7.0 recommended)
- OpenSSL
- PHP must allow remote fopen.
- PHP mbstring

## Installation

Expand All @@ -19,15 +20,16 @@ Unpack, change some variables, setup a cronjob and go!
First get the code and unpack it to your webroot:

cd /var/www/html/
git clone https://github.com/RaymiiOrg/certificate-expiry-monitor.git
git clone https://github.com/RCDaddy/certificate-expiry-monitor.git

Create the database files, outside of your webroot. If you create these inside your webroot, everybody can read them.

touch /var/www/certificate-expiry-monitor-db/pre_checks.json
touch /var/www/certificate-expiry-monitor-db/checks.json
touch /var/www/certificate-expiry-monitor-db/deleted_checks.json
echo '{}' > /var/www/certificate-expiry-monitor-db/pre_checks.json
echo '{}' > /var/www/certificate-expiry-monitor-db/checks.json
echo '{}' > /var/www/certificate-expiry-monitor-db/deleted_checks.json
chown -R $wwwuser /var/www/certificate-expiry-monitor-db/*.json


These files are used by the tool as database for checks.


Expand Down
2 changes: 0 additions & 2 deletions confirm.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@
echo "</div>";
}

require('inc/faq.php');

require('inc/footer.php');

?>
193 changes: 0 additions & 193 deletions functions/email.php

This file was deleted.

26 changes: 26 additions & 0 deletions functions/get_checks.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php
// Copyright (C) 2015 Remy van Elst
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
function get_domain_checks() {
global $current_domain;
global $current_link;
global $check_file;
$file = file_get_contents($check_file);
if ($file === FALSE) {
return null;
}
$json_a = json_decode($file, true);
if ($json_a === null && json_last_error() !== JSON_ERROR_NONE) {
return null;
}
return $json_a;
}
6 changes: 5 additions & 1 deletion functions/variables.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,14 @@
$current_domain = "certificatemonitor.org";
$current_link = "certificatemonitor.org";

$showListOfDomains = false;
$showEmailsOnListOfDomains = false;
$showClickToUnsubscribeOnListOfDomains = false;

// set this to a location outside of your webroot so that it cannot be accessed via the internets.

$pre_check_file = '/home/certmon/domains/certificatemonitor.org/cert-monitor/pre_checks.json';
$check_file = '/home/certmon/domains/certificatemonitor.org/cert-monitor/checks.json';
$deleted_check_file = '/home/certmon/domains/certificatemonitor.org/cert-monitor/deleted_checks.json';

?>
?>
8 changes: 7 additions & 1 deletion inc/faq.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@

<hr>

<?php
if ($showListOfDomains) {
echo '<a href="/list.php">View list of domains</a>';
}
?>

<h1>FAQ</h1>

<h2>Is this service free?</h2>
Expand Down Expand Up @@ -66,4 +72,4 @@
<p>Yes. You can check out <a href="https://cipherli.st">Cipherli.st</a> for secure server settings and guides. You can also use the <a href="https://ssldecoder.org">SSL Decoder</a> to check your current setup.</p><br>

<h2></h2>
<p></p><br>
<p></p><br>
6 changes: 3 additions & 3 deletions inc/header.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
echo "<div class='container-fluid'>";
echo "<div class='row'>";

echo "<div class='col-md-10 col-md-offset-1'><div class='page-header'><h1>";
echo "<div class='col-md-10 col-md-offset-1'><a href='/' class='page-header'><h1>";
echo htmlspecialchars($title);
echo "</h1></div>";
echo "</h1></a>";

?>
?>
48 changes: 48 additions & 0 deletions list.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php
// Copyright (C) 2015 Remy van Elst

// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.

// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.

error_reporting(E_ALL & ~E_NOTICE);
foreach (glob("functions/*.php") as $filename) {
require($filename);
}

require('inc/header.php');

echo "<div class='content'><section id='result'>";

if ($showListOfDomains) {
$listOfChecks = get_domain_checks();

if ($listOfChecks == null) {
echo "<div class='alert alert-danger' role='alert'>";
echo "Unable to connect to DB.<br>";
echo "</div>";
} else {
echo '<div class="table-responsive"><table class="table-hover table"><thead><tr><th>Domain</th><th>Errors</th><th>Email</th>' . ($showClickToUnsubscribeOnListOfDomains ? '<th>Email</th>' : '') . '</tr></thead><tbody>';
foreach ($listOfChecks as $key => $value) {
echo '<tr class="' . ($listOfChecks[$key]["errors"] > 0 ? 'danger' : '') . '"><td>' . $listOfChecks[$key]["domain"] . '</td><td>' . $listOfChecks[$key]["errors"] . '</td><td>' . ($showEmailsOnListOfDomains ? $listOfChecks[$key]["email"] : '****') . ($showClickToUnsubscribeOnListOfDomains ? '<td><a href="/unsubscribe.php?id=' . $key . '" >Remove from checks</a></td>' : '') . '</td></tr>';
}
echo '</tbody></table></div>';
}
} else {
echo "<div class='alert alert-warning' role='alert'>";;
echo "Listing domains has been disabled on this server<br>";
echo "</div>";
}

require('inc/footer.php');

?>
8 changes: 2 additions & 6 deletions unsubscribe.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
if ( isset($_GET['cron']) && !empty($_GET['cron']) ) {
$cron = htmlspecialchars($_GET['cron']);
}
if ($cron = "auto") {
$userip = "Removed automatically because to many errors occured.";
if ($cron == "auto") {
$userip = "Removed automatically because too many errors occured.";
}
$uuid_pattern = "/([a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12})/";
if (preg_match($uuid_pattern, $id)) {
Expand Down Expand Up @@ -59,10 +59,6 @@
echo "</div>";
}

echo "<div class='content'><section id='faq'>";
require('inc/faq.php');
echo "</div>";

require('inc/footer.php');

?>