Handle SSL exceptions

This commit is contained in:
Davte 2020-04-17 21:39:36 +02:00
parent f21a7fdfb9
commit 22a20b98fc
2 changed files with 47 additions and 1 deletions

View File

@ -4,6 +4,10 @@ Share files via a bridge server using TCP over SSL and end-to-end encryption.
## Requirements ## Requirements
Python3.8+ is needed for this package. Python3.8+ is needed for this package.
You may find it [here](https://www.python.org/downloads/).
OpenSSL 1.1.1+ is required as well to handle SSL connection and end-to-end cryptography.
On Windows, installing [git for Windows](https://gitforwindows.org/) will install OpenSSL as well.
## Usage ## Usage
If you need a virtual environment, create it. If you need a virtual environment, create it.
@ -29,6 +33,7 @@ python -m filebridging.client --help
python -m filebridging.client r --host localhost --port 5000 --certificate ~/.ssh/server.crt --token 12345678 --password supersecretpasswordhere --path ~/Downloads python -m filebridging.client r --host localhost --port 5000 --certificate ~/.ssh/server.crt --token 12345678 --password supersecretpasswordhere --path ~/Downloads
``` ```
* Client-client example * Client-client example
```bash ```bash
# 2 distinct tabs # 2 distinct tabs
@ -37,6 +42,7 @@ python -m filebridging.client --help
``` ```
The receiver client may be standalone as well: just add the `--key` parameter (for SSL-secured sessions) and the `--standalone` flag. The receiver client may be standalone as well: just add the `--key` parameter (for SSL-secured sessions) and the `--standalone` flag.
* Configuration file example * Configuration file example
```python ```python
#!/bin/python #!/bin/python
@ -51,3 +57,43 @@ python -m filebridging.client --help
token = 'sessiontok' token = 'sessiontok'
file_path = '.' file_path = '.'
``` ```
## Generating SSL certificates
Store configuration in file `mycert.csr.cnf` and run the following command to generate a self-signed SSL certificate.
```bash
openssl req -newkey rsa:2048 -nodes -keyout ./mycert.key \
-x509 -days 365 -out ./mycert.crt \
-config <( cat mycert.csr.cnf )
```
**mycert.csr.cnf**
```text
[req]
default_bits = 2048
prompt = no
default_md = sha256
distinguished_name = dn
req_extensions = v3_req
subjectAltName = @alt_names
[ v3_req ]
basicConstraints = CA:FALSE
keyUsage = nonRepudiation, digitalSignature, keyEncipherment
subjectAltName = @alt_names
[dn]
C=US
ST=YourState
L=YourTown
O=FileBridging
OU=filebridging
emailAddress=filebridging@yourdomain.com
CN = yourdomain.com
[ alt_names ]
DNS.1 = yourdomain.com
DNS.2 = 1.111.111.11
```

View File

@ -13,6 +13,6 @@ __author__ = "Davide Testa"
__email__ = "davide@davte.it" __email__ = "davide@davte.it"
__credits__ = [] __credits__ = []
__license__ = "GNU General Public License v3.0" __license__ = "GNU General Public License v3.0"
__version__ = "0.0.5" __version__ = "0.0.6"
__maintainer__ = "Davide Testa" __maintainer__ = "Davide Testa"
__contact__ = "t.me/davte" __contact__ = "t.me/davte"