48 lines
1.4 KiB
Markdown
48 lines
1.4 KiB
Markdown
# Python, web and SSH sandbox
|
||
For educational purpose.
|
||
This repo got several parts :
|
||
|
||
## A python script
|
||
It run with wsgi, see the dockerfile CMD line).
|
||
Used to execute any python script in the `module` directory given a certain URL :
|
||
- /m1/f1 -> execute the f1 function from modules/m1.py
|
||
- /path/to/m2/f2 -> execute the f2 function from modules/path/to/m2.py
|
||
|
||
## SSH server
|
||
Allow student to connect via SSH or SFTP to add python files.
|
||
create a file named `users.txt`, then passwords and accounts will be generated by `entrypoint.sh`
|
||
TODO:
|
||
- install and configure the server
|
||
- configure chroot
|
||
- create the homes in modules directory
|
||
|
||
|
||
|
||
# Instructions
|
||
## Build the docker image
|
||
```
|
||
docker build . -t pythonsandbox
|
||
```
|
||
|
||
## Run the docker image
|
||
```
|
||
docker run -it --rm -p 8880:80 --name pythonsandbox pythonsandbox
|
||
```
|
||
Or if you want to save student work outside of the container:
|
||
```
|
||
docker run -it --rm -p 8880:80 --name pythonsandbox -v "$(pwd)"/app/modules:/usr/share/app/modules pythonsandbox
|
||
```
|
||
And with user list file
|
||
```
|
||
docker run -it --rm -p 8880:80 --name pythonsandbox -v "$(pwd)"/app/modules:/usr/share/app/modules -v "$(pwd)"/app/users.txt:/usr/share/app/users.txt pythonsandbox
|
||
```
|
||
|
||
|
||
|
||
## Example
|
||
With the files under `./app/modules` you can get the following URLs :
|
||
- http://localhost:8880/mod1/func1_1
|
||
- http://localhost:8880/mod1/func1_2
|
||
- http://localhost:8880/myriem/mod2/func2_1
|
||
|