Commit 92b015c2 authored by Jørn Åne de Jong's avatar Jørn Åne de Jong

Initial commit

parents
FROM centos:centos7
RUN yum -y update
RUN yum -y install epel-release
RUN yum -y install composer lighttpd lighttpd-fastcgi php-cgi
COPY composer.json /var/www/
WORKDIR /var/www/
RUN composer install --no-dev
COPY www /var/www/www/
COPY dist /var/www/dist/
CMD /usr/sbin/lighttpd -D -f /var/www/dist/lighttpd.conf
EXPOSE 80
# DKIM validator
Simple webpage to validate DKIM signatures.
## Running
docker build . -t dkim-validator && docker run -p 8080:80 dkim-validator
{
"name": "uninett/dkim-validator",
"type": "project",
"license": "BSD-3-Clause",
"require": {
"angrychimp/php-dkim": "dev-master"
},
"authors": [
{
"name": "Jørn Åne",
"email": "jorn.dejong@uninett.no"
}
],
"minimum-stability": "dev"
}
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"content-hash": "97aab829baf7e48317eb7c80279c0351",
"packages": [
{
"name": "angrychimp/php-dkim",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/angrychimp/php-dkim.git",
"reference": "88b42e5af05f77511924ffe71f7219b24764c2e0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/angrychimp/php-dkim/zipball/88b42e5af05f77511924ffe71f7219b24764c2e0",
"reference": "88b42e5af05f77511924ffe71f7219b24764c2e0",
"shasum": ""
},
"require": {
"ext-hash": "*",
"ext-openssl": "*",
"phpseclib/phpseclib": ">=0.3.6"
},
"type": "library",
"autoload": {
"psr-0": {
"DKIM": "./"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Randall Kahler",
"email": "rk@angrychimp.net"
}
],
"description": "Finally, a PHP5 class for not just signing, but _verifying_ DKIM signatures.",
"keywords": [
"dkim",
"signature",
"verify"
],
"time": "2017-06-19T20:03:36+00:00"
},
{
"name": "paragonie/constant_time_encoding",
"version": "v1.x-dev",
"source": {
"type": "git",
"url": "https://github.com/paragonie/constant_time_encoding.git",
"reference": "129f4cf4f2a9e75f7d03ded5031f9864b07b2eb6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/paragonie/constant_time_encoding/zipball/129f4cf4f2a9e75f7d03ded5031f9864b07b2eb6",
"reference": "129f4cf4f2a9e75f7d03ded5031f9864b07b2eb6",
"shasum": ""
},
"require": {
"php": "^5.3|^7"
},
"require-dev": {
"paragonie/random_compat": "^1.4|^2",
"phpunit/phpunit": "4.*|5.*",
"vimeo/psalm": "^0.3|^1"
},
"type": "library",
"autoload": {
"psr-4": {
"ParagonIE\\ConstantTime\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Paragon Initiative Enterprises",
"email": "security@paragonie.com",
"homepage": "https://paragonie.com",
"role": "Maintainer"
},
{
"name": "Steve 'Sc00bz' Thomas",
"email": "steve@tobtu.com",
"homepage": "https://www.tobtu.com",
"role": "Original Developer"
}
],
"description": "Constant-time Implementations of RFC 4648 Encoding (Base-64, Base-32, Base-16)",
"keywords": [
"base16",
"base32",
"base32_decode",
"base32_encode",
"base64",
"base64_decode",
"base64_encode",
"bin2hex",
"encoding",
"hex",
"hex2bin",
"rfc4648"
],
"time": "2018-01-06T18:40:23+00:00"
},
{
"name": "paragonie/random_compat",
"version": "v2.0.11",
"source": {
"type": "git",
"url": "https://github.com/paragonie/random_compat.git",
"reference": "5da4d3c796c275c55f057af5a643ae297d96b4d8"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/paragonie/random_compat/zipball/5da4d3c796c275c55f057af5a643ae297d96b4d8",
"reference": "5da4d3c796c275c55f057af5a643ae297d96b4d8",
"shasum": ""
},
"require": {
"php": ">=5.2.0"
},
"require-dev": {
"phpunit/phpunit": "4.*|5.*"
},
"suggest": {
"ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes."
},
"type": "library",
"autoload": {
"files": [
"lib/random.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Paragon Initiative Enterprises",
"email": "security@paragonie.com",
"homepage": "https://paragonie.com"
}
],
"description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7",
"keywords": [
"csprng",
"pseudorandom",
"random"
],
"time": "2017-09-27T21:40:39+00:00"
},
{
"name": "phpseclib/phpseclib",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/phpseclib/phpseclib.git",
"reference": "1669e242699a6f679a00679d0a7dd46bc6fea469"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/1669e242699a6f679a00679d0a7dd46bc6fea469",
"reference": "1669e242699a6f679a00679d0a7dd46bc6fea469",
"shasum": ""
},
"require": {
"paragonie/constant_time_encoding": "^1",
"paragonie/random_compat": "^1.4|^2.0",
"php": ">=5.6.1"
},
"require-dev": {
"phing/phing": "~2.7",
"phpunit/phpunit": "^4.8.35|^5.7|^6.0",
"sami/sami": "~2.0",
"squizlabs/php_codesniffer": "~2.0"
},
"suggest": {
"ext-gmp": "Install the GMP (GNU Multiple Precision) extension in order to speed up arbitrary precision integer arithmetic operations.",
"ext-libsodium": "SSH2/SFTP can make use of some algorithms provided by the libsodium-php extension.",
"ext-mcrypt": "Install the Mcrypt extension in order to speed up a few other cryptographic operations.",
"ext-openssl": "Install the OpenSSL extension in order to speed up a wide variety of cryptographic operations."
},
"type": "library",
"autoload": {
"files": [
"phpseclib/bootstrap.php"
],
"psr-4": {
"phpseclib\\": "phpseclib/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Jim Wigginton",
"email": "terrafrost@php.net",
"role": "Lead Developer"
},
{
"name": "Patrick Monnerat",
"email": "pm@datasphere.ch",
"role": "Developer"
},
{
"name": "Andreas Fischer",
"email": "bantu@phpbb.com",
"role": "Developer"
},
{
"name": "Hans-Jürgen Petrich",
"email": "petrich@tronic-media.com",
"role": "Developer"
},
{
"name": "Graham Campbell",
"email": "graham@alt-three.com",
"role": "Developer"
}
],
"description": "PHP Secure Communications Library - Pure-PHP implementations of RSA, AES, SSH2, SFTP, X.509 etc.",
"homepage": "http://phpseclib.sourceforge.net",
"keywords": [
"BigInteger",
"aes",
"asn.1",
"asn1",
"blowfish",
"crypto",
"cryptography",
"encryption",
"rsa",
"security",
"sftp",
"signature",
"signing",
"ssh",
"twofish",
"x.509",
"x509"
],
"time": "2018-02-19T04:29:37+00:00"
},
{
"name": "teon/dkim",
"version": "v0.2.1",
"source": {
"type": "git",
"url": "https://github.com/teonsystems/php-dkim.git",
"reference": "4348d25b67b5061d5f3dd3988b5db806d8a819e9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/teonsystems/php-dkim/zipball/4348d25b67b5061d5f3dd3988b5db806d8a819e9",
"reference": "4348d25b67b5061d5f3dd3988b5db806d8a819e9",
"shasum": ""
},
"require": {
"ext-hash": "*",
"ext-openssl": "*"
},
"suggest": {
"angrychimp/php-dkim": "Original, psr-0 compatible php-dkim package"
},
"type": "library",
"autoload": {
"psr-4": {
"Teon\\DKIM\\": "src/Teon/DKIM/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "angrychimp",
"email": "rk@angrychimp.net"
},
{
"name": "Teon d.o.o. - Bostjan Skufca",
"email": "bostjan@teon.si"
}
],
"description": "Update of angrychimp/php-dkim package.",
"time": "2015-10-19T08:14:01+00:00"
}
],
"packages-dev": [],
"aliases": [],
"minimum-stability": "dev",
"stability-flags": {
"angrychimp/php-dkim": 20
},
"prefer-stable": false,
"prefer-lowest": false,
"platform": [],
"platform-dev": []
}
server.port = 80
server.bind = "0.0.0.0"
server.pid-file = "/var/run/lighttpd.pid"
server.username = "lighttpd"
server.groupname = "lighttpd"
accesslog.filename = "/dev/stdout"
server.document-root = "/var/www/www"
server.errorfile-prefix = "/var/www/error/status-"
server.modules += ( "mod_fastcgi", "mod_accesslog", "mod_redirect", "mod_setenv" )
url.redirect = (
"(.*)/index\.html$" => "$1/",
"(.*)/index\.php$" => "$1/",
)
setenv.add-response-header += (
"Referrer-Policy" => "no-referrer",
"X-Content-Type-Options" => "nosniff",
)
include "/etc/lighttpd/conf.d/mime.conf"
static-file.exclude-extensions = ( ".fcgi", ".php", ".rb", "~", ".inc" )
static-file.disable-pathinfo = "enable"
index-file.names = ( "index.html", "index.php" )
fastcgi.server = ( ".php" =>
((
"socket" => "/var/run/lighttpd/php.socket",
"bin-path" => "/usr/bin/php-cgi",
"bin-environment" => (
"PHP_FCGI_CHILDREN" => "16",
"PHP_FCGI_MAX_REQUESTS" => "10000"
),
"min-procs" => 1,
"max-procs" => 1,
"idle-timeout" => 20
))
)
<?php
require dirname(__DIR__) . implode(DIRECTORY_SEPARATOR, ['', 'vendor', 'autoload.php']);
$msgContent = '';
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
if (!isset($_POST['mail']) || empty($_POST['mail'])) {
header('Location: /');
exit;
}
$msgContent = $_POST['mail'];
$dkimValidator = new DKIM_Verify($msgContent);
}
?><!DOCTYPE html>
<meta http-equiv="Content-Type" value="text/html;charset=utf-8">
<title>DKIM validator</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<style type="text/css">
html {
font-family: 'colfaxLight', 'Arial', sans-serif;
}
html,
body,
form {
margin: 0;
width: 100%;
height: 100%;
}
form {
display: table;
}
form > * {
display: table-row;
}
form > * > * {
display: table-cell;
padding: .2em 1em;
}
main {
height: 100%;
}
textarea {
width: 100%;
height: 100%;
box-sizing: border-box;
border: none;
box-shadow: none;
outline: none;
resize: none;
background: #fff;
padding: 0 1em;
}
textarea:invalid {
background: url('instruction.png') 50% 10% no-repeat;
}
nav {
display: table;
background: #f8f8f8;
border-bottom: 1px solid #e7e7e7;
}
footer > ol {
padding-left: 2em;
background: #f8f8f8;
border-top: 1px solid #e7e7e7;
}
nav > * {
display: table-cell;
}
nav #logo > img {
display: block;
}
nav h1 {
white-space: nowrap;
padding-left: 1em;
vertical-align: middle;
color: #6a5f58;
}
nav ul {
vertical-align: middle;
}
nav ul > li {
display: inline;
}
nav button,
nav a {
color: #666464;
background: none;
border: none;
font-size: 1em;
padding: 0 1em;
text-decoration: none;
cursor: pointer;
}
.permfail {
color: red;
}
.pass {
color: green;
}
</style>
<form method="post">
<header>
<nav>
<div id="logo">
<img src="https://eduroam.no/bower_components/uninett-theme/images/UNINETT_logo.svg" alt="UNINETT logo">
</div>
<h1>DKIM validator</h1>
<ul style="width: 100%">
<li><button type="submit">Validate</button></li>
<a href="/">Reset</a>
</ul>
</nav>
</header>
<main><textarea required autofocus name="mail"><?= htmlspecialchars($msgContent) ?></textarea></main>
<?php if (isset($dkimValidator)): ?>
<footer>
<ol>
<?php foreach($dkimValidator->validate() as $sig): ?>
<li><ul>
<?php foreach($sig as $result): ?>
<li class="<?= htmlspecialchars($result['status']) ?>"><?= htmlspecialchars($result['reason']) ?></li>
<?php endforeach; ?>
</ul></li>
<?php endforeach; ?>
</ol>
</footer>
<?php endif; ?>
</form>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment