[Hackathon Demo] A simple way to sign packages/plugins/themes/modules
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
cli
doc
lib
test-environment-wordpress
wordpress-plugin
.gitattributes
.gitignore
README.md
composer.json

README.md

Signed Autoupdate

Description

Project was created on cloudfest hackathon for prototyping a signed transfer of plugin packages from developer to users. The project constists of:

For testing purposes the WordPress Plugin: simple-cocomments was enhanced with .well-known/* information needed for the demonstration of signature / public key signed packing.

Libs

CLI

The CLI helps you to generate a keypair, to sign a package and to verify you signed package.

Commands

generator:generate

To generate a new keypair run:

$ signer.phar generator:generate [<path>]

to get the complete list of parameters use:

$ signer.phar generator:generate --help
signer:sign

To sign a package, navigate to the package folder and run:

$ signer.phar signer:sign [options] [--] <path> <key>

to get the complete list of parameters use:

$ signer.phar signer:sign --help
signer:sign

To verify a signed package, run:

$ signer.phar verifier:verify [<signature>] [<key>] [<list>]

to get the complete list of parameters use:

$ signer.phar verifier:verify --help

Build phar package

To build a new .phar package, you have to install box and run

$ box build -v

in the root of the cli folder.

Screens

Package List View

Client Implementation

Installation via Composer

composer require signed-autoupdate/signed-autoupdate

Client Implementation is straightforward you need only your download package in zip format as well as your pre-installed Public Key.

Usage example:

include_once __DIR__ . '/vendor/autoload.php';

$public_key = hex2bin('<Public Key>');
$update = new Update('https://example.com/update.zip',__DIR__.'/update-deploy',$public_key);

If the signature fails, the number of files in the update package is off or the file hashes don't match the update will not be processed and the zip file will be discarded.

WordPress Plugin

Description

Plugin will inject via add_filter into the download process of a plugin and checks for existence of some files. If signatures existing it will try to verify the files signatures. The plugin also allows deletion and editing of public keys.

So:

  • will check for existence of: .well-known/signature.txt, .well-known/publickey.txt, .well-known/list.json
  • if existing:
    • and public key is new, stores to trusted store
    • and public key is old, checks against public key the same
    • will block update if not the same keys
    • will verify with signature, public key and the list.json if the package is valid
  • the SAU Signatures shows already known signatures for editing / deletion

Screens

Package List View New Key Add During First Install Reject Installation on Error

WordPress Test Environment

Description

The WordPress Test Environment was the idea for a one liner setup of the whole demonstration. Just execute ./do-it.sh , it will clone latest WordPress github, this repository, setup an apache with php7.2, a mysql container for the database. Uses wp-cli for setting up the wordpress with test123/test123 username on http://localhost:8091 .

For more info look into webserver/Dockerfile, docker-compose.yml and do-it.sh shell script.