Giter Club home page Giter Club logo

pwx's Introduction

Build Status SensioLabsInsight Gitter

About

PWX allows you to set up your own password exchange service to share passwords via a temporary link.

For more information please check out my blog

Example

https://pwx.michaelthessel.com

Installation

Download the current stable release here or clone the repository.

Install dependencies:

# php composer.phar install

Create configuration file and adjust according to your environment:

# cp app/config.php.sample app/config.php

Create the database schema:

# app/console orm:schema-tool:create

Web server configuration

The Silex Documentation has example configurations for Apache, nginx, IIS & Lighttpd.

Update

Download the latest source code.

If you are updating to a newer version follow these steps.

Update dependencies:

# php composer.phar update

Update the database schema:

# app/console orm:schema-tool:update --force

Translations

Currently:

  • English (en)
  • Spanish (es)
  • Esperanto (eo)
  • and German (de)

are supported by PWX. Please set locale according to your requirements in the configuration. I'm happy to accept pull requests for additional translations.

You can use a GET parameter when linking to PWX. I.e.

https://example.com?locale=es

This allows for one instance of PWX dynamically being accessed in different languages.

Themes

PWX supports all Bootswatch themes. You can adjust the appearance of the application to your liking by a simple config switch.

Developers

PWX uses the Robo task runner. After making changes to the JS or CSS files run:

# vendor/bin/robo build

to minify and concatenate the files.

Alternatively you can run:

# vendor/bin/robo watch

while developing which will automatically generate the minified and concatenated assets when style or script files are changed.

To run the integrated test suite please run:

# vendor/bin/phpunit

API

PWX offers a simple API with the following endpoints:

Save an entry

Request Methoud: POST
End Point: https://example.com/api
Params:
    userName: string (default: "")
    password: string (reqired)
    comment: string (default: "")
    expires: int (time in s from when the entry will expire, min: 1h, max: 30days, default: 3600)
    oneTimeView: bool (whether or not the entry will be deleted after viewing it once, default: false)
Response:
    hash string (id of entry)

Retrieve an entry

Request Methoud: GET
End Point: https://example.com/api/[hash]
Params:
    n/a
Response:
    hash: string
    userName: string
    password: string
    comment: string

Delete an entry

Request Methoud: DELETE
End Point: https://example.com/api/[hash]
Params:
    n/a
Response:
    n/a

Warning

You will be responsible to secure your environment. The author of this software takes no responsiblity for any damage as a result of using this software.

pwx's People

Contributors

joseluis avatar michaelthessel avatar rabbl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

pwx's Issues

API - Save an Entry

I would like to save an entry through API, but I'm getting this:

            <h1>Sorry, the page you are looking for could not be found.</h1>

The way I'm trying is this:

curl -X POST -F "password=passwd" https://pwx.mycompany.com/api

php POST can't create the link folder and the temporary file for the password (nginx / php-fpm)

Hello,
I tried to install my own pwx instance for work purpose.
For testing purpose I disabled ssl mandatory from you app/config.php file.
I use nginx as a web server with the following conf (example.com is replaced by my organization domain):

server {
    listen 80;
    server_name pwx.example.com;

    access_log /var/log/nginx/access-pwx.log;
    error_log /var/log/nginx/error-pwx.log;

    root /var/www/pwx/web;
    index index.php;

    location ~* \.php$ {
        try_files $uri =404;
        include fastcgi.conf;
        fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
        fastcgi_index index.php;
    }
}

I assume that the POST is not working and failed to create the temporary file in link folder. I create the web/link folder, make my web server group the owner of this folder (and chmod 777 it to be sure for the test โ€ฆ). But I still have the same error:

NGINX LOG

==> access-pwx.log<==
[15/Mar/2016:14:51:49 +0100] "POST / HTTP/1.1" 302 320 "http://pwx.example.com/" "Mozilla/5.0" (X11; Fedora; Linux x86_64; rv:44.0) Gecko/20100101 Firefox/44.0"

==> error-pwx.log <==
2016/03/15 14:51:49 [error] 16266#0: *46 open() "/var/www/pwx/web/link/3662178eab" failed (2: No such file or directory), client: 1.2.3.4 server: pwx.example.com, request: "GET /link/3662178eab HTTP/1.1", host: "pwx.example.com", referrer: "http://pwx.example.com/"

==> access-pwx.log <==
[15/Mar/2016:14:51:49 +0100] "GET /link/3662178eab HTTP/1.1" 404 168 "http://pwx.example.com/" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:44.0) Gecko/20100101 Firefox/44.0"

LOG/APP.LOG
[2016-03-15 14:51:43.172076] pwx.INFO: Matched route "GET_". {"route_parameters":{"controller":"app.default_controller:indexAction","route":"GET"},"request_uri":"http://pwx.example.com/"} {"clientIp":"1.2.3.4","token":"56e8136f279c4"}
[2016-03-15 14:51:43.172647] pwx.INFO: > GET / [] {"clientIp":"1.2.3.4","token":"56e8136f279c4"}
[2016-03-15 14:51:43.295656] pwx.INFO: < 200 [] {"clientIp":"1.2.3.4","token":"56e8136f279c4"}
[2016-03-15 14:51:43.296611] pwx.DEBUG: Script executed in 169.605ms. {"msExecTime":169.605,"method":"GET","path":"/"} {"clientIp":"1.2.3.4","token":"56e8136f279c4"} [2016-03-15 14:51:49.264898] pwx.INFO: Matched route "POST
". {"route_parameters": {"_controller":"app.default_controller:indexPostAction","route":"POST"},"request_uri":"http://pwx.example.com/"} {"clientIp":"1.2.3.4","token":"56e813753f255"}
[2016-03-15 14:51:49.265250] pwx.INFO: > POST / [] {"clientIp":"1.2.3.4","token":"56e813753f255"}
[2016-03-15 14:51:49.379064] pwx.INFO: < 302 /link/3662178eab [] {"clientIp":"1.2.3.4","token":"56e813753f255"}
[2016-03-15 14:51:49.379964] pwx.DEBUG: Script executed in 143.301ms. {"msExecTime":143.301,"method":"POST","path":"/"} {"clientIp":"1.2.3.4","token":"56e813753f255"}

Do you have any clue ?

Bests regards.

Unable to retreive password - shows blank

Hi Michael,

Not sure if this is the correct way to bring this up or even if you will provide support in this manner. But I figured it was worth a shot. I have deployed pwx successfully multiple times in the past and have now hit a wall. (Great tool btw)

I have the tool running at https://pwx.clearconcepts.ca/
nginx, mariadb, ubuntu server
composer.phar has been fully updated.
nginx is configured exactly how Silex documentation asks for.

It lets you create an entry, it creates a link, it adds information into the database but when viewing the entry it is either empty or shows encrypted type characters.

I am not seeing any errors in my nginx error or access logs.

Any ideas on where I can look to troubleshoot?

Thank you.
-James

Add credential-Entity for better testing, encapsulation and persistence stuff

It would be fine to have an entity-Object for the credential stuff. Brings the following benefits:

  • Encapsulation of User and Password-Data
  • Better testing experience
  • TypeHinting in services
  • Database and schema-creation by doctrine and possibility to user other DBs like postgres, mongo, sqlite, etc.

I think there are many other benefits.

The properties could be:

  • hash
  • usernamePlainText
  • username
  • passwordPlaintext
  • password
  • commentPlainText
  • comment
  • email (#28)
  • expiresAt

Where the plaintext properties won't be persisted.
Then you can pipe this entity easy through encrypting and decrypting services.

Here is an old and informative example with the use of annotations and CLI:
http://ahoj.io/silex-doctrine2-orm

CredentialService: Separate persistance and crypto

The credentialService has two main functionalities at the moment which are persistance and crypto. For a better unit-testing experience I propose to separate this functionalities to a crypto-service and a persistance-service, connected by a factory or something similar.

The other way could be that the persistance execution moves to the controller and the persistance query moves to en entity-Repository.
Create an entity (with properties for encrypted and plain-information) would be a nice improvement too.

Add Tag 1.1

Hi Michael,

could you please tag the current version in master with e.g. 1.1? I need the PHP 7 support, but don't want to leave my installation on your master branch. The reason is that I made the installation via Puppet and it would download automatically every pull request you accept.

Thanks in advance!

Cheers
Dennis

Add base url config setting

When having relative paths for css+js breaks for pages like the view password page. Adding a base URL config setting and including resources based on that should solve that problem.

Opening pages of deleted entries throws error

in Base.php line 940
at ErrorHandler->handleError('2', 'mdecrypt_generic(): An empty string was passed', '/src/pwx/vendor/phpseclib/phpseclib/phpseclib/Crypt/Base.php', '940', array('ciphertext' => '', 'block_size' => '16', 'this' => object(Crypt_AES)))
at mdecrypt_generic(resource, '') in Base.php line 940
at Crypt_Base->decrypt(null) in CredentialService.php line 52
at CredentialService->get('c4691c0570') in DefaultController.php line 83
at DefaultController->viewPasswordAction('c4691c0570')
at call_user_func_array(array(object(DefaultController), 'viewPasswordAction'), array('c4691c0570')) in HttpKernel.php line 145
at HttpKernel->handleRaw(object(Request), '1') in HttpKernel.php line 66
at HttpKernel->handle(object(Request), '1', true) in Application.php line 543
at Application->handle(object(Request)) in Application.php line 520
at Application->run() in index.php line 5

Resources fail to load when pwx is installed in a directory

When pwx is installed in a subdomain all loads fine, but when it's installed in a subfolder then the js / css files are not loaded because the app tries to load them from the root folder:

/css/style.css
/js/hideShowPassword.min.js
/js/jquery.zclip.min.js
/js/script.js

Make it translation ready

It would be very useful to be able to load different translations from po files depending on the locale of the browser.

"Delete Record" function shows countdown

If you use "Delete record after it has been viewed" and open the link, it still shows "This listing will be removed in" and a countdown of one hour. It should say something like "This record was already deleted, you cannot reload the page or reuse the link".

Add predefined email communication functionality

This would need to be a config option. If an email address is supplied then the credentials are sent there.

I've come across the expectation several times that people assume I will notified immediately of the credentials, and they forget to send an email with the link.

It would be handy for support services.

It may probably be a good idea to display a default message warning about it too. E.g. "A link to this credentials will be automatically sent to [email protected]".

This would be related to #19 but depending not on the user but on the particular server installation.

I'm thinking that an alternative soution could be if this config option would fill the default value of the new email field proposed in #19. It's not the same thing at all but they are not incompatible either. It would be perfect to have both.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.