File Pushes
To enable file uploads (File Pushes) in your instance of Password Pusher, there are a few requirements:
- you must have logins enabled (see above)
- specify a place to store uploaded files
- If you use cloud storage, configure the CORS configuration in your buckets (detailed below)
The following settings enable/disable the feature and specify where to store uploaded files.
This feature can store uploads on local disk (not valid for Docker containers), Amazon S3, Google Cloud Storage or Azure Storage.
Configuration
Note: Remember that instead of environment variables, which can get hard to maintain, Password Pusher also supports configuration by YAML file.
Environment Variable | Description | Value(s) |
---|---|---|
PWP__ENABLE_FILE_PUSHES | On/Off switch for File Pushes. | false |
PWP__FILES__STORAGE | Chooses the storage area for uploaded files. | local , amazon , google or microsoft |
PWP__FILES__ENABLE_BLUR | Enables or disables the ‘blur’ effect when showing a text payload to the user. | true |
PWP__FILES__ENABLE_DELETABLE_PUSHES | Can passwords be deleted by viewers? When true, passwords will have a link to optionally delete the password being viewed | false |
PWP__FILES__DELETABLE_PUSHES_DEFAULT | When the above is true , this sets the default value for the option. |
true |
PWP__FILES__ENABLE_RETRIEVAL_STEP | When true , adds an option to have a preliminary step to retrieve passwords. |
true |
PWP__FILES__RETRIEVAL_STEP_DEFAULT | Sets the default value for the retrieval step for newly created passwords. | false |
PWP__FILES__MAX_FILE_UPLOADS | Sets the maximum number of files that can be added to a single push. | 10 |
Expiration Settings
Environment Variable | Description | Default Value |
---|---|---|
PWP__FILES__EXPIRE_AFTER_DAYS_DEFAULT | Controls the “Expire After Days” default value in Password#new | 7 |
PWP__FILES__EXPIRE_AFTER_DAYS_MIN | Controls the “Expire After Days” minimum value in Password#new | 1 |
PWP__FILES__EXPIRE_AFTER_DAYS_MAX | Controls the “Expire After Days” maximum value in Password#new | 90 |
PWP__FILES__EXPIRE_AFTER_VIEWS_DEFAULT | Controls the “Expire After Views” default value in Password#new | 5 |
PWP__FILES__EXPIRE_AFTER_VIEWS_MIN | Controls the “Expire After Views” minimum value in Password#new | 1 |
PWP__FILES__EXPIRE_AFTER_VIEWS_MAX | Controls the “Expire After Views” maximum value in Password#new | 100 |
Choosing a Backend Storage Mechanism
When files are attached to a push and uploaded to Password Pusher, they have to be stored somewhere publicly accessible. The four options are:
- Local Disk
- Amazon S3
- Google Cloud
- Microsoft Azure
The following sections explain how to configure each. Only one configuration can be active at any time.
Local Storage
PWP__FILES__STORAGE=local
The default location for local storage is ./storage
.
If using containers and you prefer local storage, you can add a volume mount to the container at the path /opt/PasswordPusher/storage
:
docker run -d -p "5100:5100" -v /var/lib/pwpush/files:/opt/PasswordPusher/storage pglombardo/pwpush:latest
Note: Please make sure that the directory is writeable by the docker container.
Note: A CORS configuration is not required for local storage.
Amazon S3
To configure the application to store files in an Amazon S3 bucket, you have to:
- set the required environment variables detailed below (or the equivalent values in
settings.yml
) - apply a CORS configuration to your S3 bucket (see next section)
Environment Variable | Description | Value(s) |
---|---|---|
PWP__FILES__STORAGE | Storage Provider Selection | amazon |
PWP__FILES__S3__ENDPOINT | S3 Endpoint | None |
PWP__FILES__S3__ACCESS_KEY_ID | Access Key ID | None |
PWP__FILES__S3__SECRET_ACCESS_KEY | Secret Access Key | None |
PWP__FILES__S3__REGION | S3 Region | None |
PWP__FILES__S3__BUCKET | The S3 bucket name | None |
CORS Configuration
The application performs direct uploads from the browser to your Amazon S3 bucket. This provides better performance and reduces load on the application itself.
For this to work, you have to add a CORS configuration to your bucket.
This direct upload functionality is done using a library called ActiveStorage. For the full documentation on configuring CORS for ActiveStorage, see here.
[
{
"AllowedHeaders": [
"Content-Type",
"Content-MD5",
"Content-Disposition"
],
"AllowedMethods": [
"PUT"
],
"AllowedOrigins": [
"https://www.example.com" << Change to your URL
],
"MaxAgeSeconds": 3600
}
]
Google Cloud Storage
To configure the application to store files in Google Cloud Storage, you have to:
- set the required environment variables detailed below (or the equivalent values in
settings.yml
) - apply a CORS configuration (see next section)
Environment Variable | Description | Value(s) |
---|---|---|
PWP__FILES__STORAGE | Storage Provider Selection | google |
PWP__FILES__GCS__PROJECT | GCS Project | None |
PWP__FILES__GCS__CREDENTIALS | GCS Credentials | None |
PWP__FILES__GCS__BUCKET | The GCS bucket name | None |
CORS Configuration
The application performs direct uploads from the browser to Google Cloud Storage. This provides better performance and reduces load on the application itself.
For this to work, you have to add a CORS configuration.
This direct upload functionality is done using a library called ActiveStorage. For the full documentation on configuring CORS for ActiveStorage, see here.
[
{
"origin": ["https://www.example.com"],
"method": ["PUT"],
"responseHeader": ["Content-Type", "Content-MD5", "Content-Disposition"],
"maxAgeSeconds": 3600
}
]
Azure Storage
To configure the application to store files in Azure Storage, you have to:
- set the required environment variables detailed below (or the equivalent values in
settings.yml
) - apply a CORS configuration (see next section)
Environment Variable | Description | Value(s) |
---|---|---|
PWP__FILES__STORAGE | Storage Provider Selection | microsoft |
PWP__FILES__AS__STORAGE_ACCOUNT_NAME | Azure Storage Account Name | None |
PWP__FILES__AS__STORAGE_ACCESS_KEY | Azure Storage Account Key | None |
PWP__FILES__AS__CONTAINER | Azure Storage Container Name | None |
CORS Configuration
The application performs direct uploads from the browser to Azure Storage. This provides better performance and reduces load on the application itself.
For this to work, you have to add a CORS configuration.
This direct upload functionality is done using a library called ActiveStorage. For the full documentation on configuring CORS for ActiveStorage, see here.
<Cors>
<CorsRule>
<AllowedOrigins>https://www.example.com</AllowedOrigins>
<AllowedMethods>PUT</AllowedMethods>
<AllowedHeaders>Content-Type, Content-MD5, x-ms-blob-content-disposition, x-ms-blob-type</AllowedHeaders>
<MaxAgeInSeconds>3600</MaxAgeInSeconds>
</CorsRule>
</Cors>