From e560cb136190566212982fa8d9b4f79abdd5456e Mon Sep 17 00:00:00 2001 From: rh363 <153909591+rh363@users.noreply.github.com> Date: Mon, 8 Jan 2024 10:01:34 +0100 Subject: [PATCH] Update README.md --- README.md | 137 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 136 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f1cdb44..e9a2024 100644 --- a/README.md +++ b/README.md @@ -1 +1,136 @@ -# apiansible \ No newline at end of file + +# APIANSIBLE + +This project is developed for rexpose an nfs volume from a secure network to an insecure netwok. \ +There are two way to rexpose this volume: +- 1 NFS +- 2 SMB + +## How it work? +This project for work use some ansible playbook who can be runned by an go api called "apiansible". \ +Using our "recipes" is possible install an nfs/smb server modify the access to this server and if is required delete all pacakge, configuration files and volume data directory with a simple http api request. + + +## Installation + +for install apiasible you have to claim this steps: + +- 1 install ansible +- 2 configure ansible +- 3 pull ansible playbook for configure your server + +Install this project is very easy and fast with this repo. \ +You only have to mannualy download ansible using the [official ansible doc](https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html). \ +I strongly reccomend you to install it on rhel like os for example almalinux or centos. \ +Next you only have to create or change the following file to the ones provided in this repo: +- /etc/ansible/ansible.cfg +- /etc/ansible/hosts +Now you can finnaly pull installation playbook: + +```bash + ansible-pull -U https://github.com/rh363/apiansible.git +``` +Can you see all operations performed by this pull in "local.yml" +Now you have the api running on service apiansible.service and listenning on port 4444. +## Requests +The http request implemented are separated in nfs and smb requests: +## NFS Request: + +The following requests are used for install and manage an nfs server. \ +The server mount an nfs volume and rexpose it via nfs. + +**INSTALL NFS SERVER:** + +for install nfs client this POST request is required. + +|POST Request | **Request body** | **Explain** | +| --- | --- | --- | +| \*server ip address\*:4444/apiansible/server/nfs | {
"src":"\*nfs volume ip to rexpose\*",
"dests":\[
"\*ip who can access to nfs volume\*"
\]
} | this request required two argoument:
src is the nfs ip address who our machine mount.
dests is a list of ip address who can access to the rexposed nfs volume | + +**ADD NFS ACCESS:** + +this POST request add another access to our nfs volume. + +| POST Request | Request body | Explain | +| --- | --- | --- | +| \*server ip address\*:4444/apiansible/server/nfs/access | {
"dests":\[
"\*new access\*"
\]
} | this request require only a list of ip address to add in /etc/exports file.
this list is called dests. | + +**REMOVE NFS ACCESS:** + +This PATCH request remove an nfs access to our rexposed volume. + +|PATCH Request | **Request body** | Explain | +| --- | --- | --- | +| \*server ip address\*:4444/apiansible/server/nfs/access/ | {
"dests": \[
"\*access to remove\*"
\]
} | this function require a list of ip to remove from /etc/exports.
this list is called dests. | + +**UNINSTALL NFS SERVER:** + +use this DELETE request for uninstall nfs server package and configuration from system. + +|DELETE Request | Explain | +| --- | --- | +| \*server ip address\*/apiansible/server/nfs | dont require any body.
use this request for clean server from nfs package and configuration. | + +## SMB Requests: + +The following requests are used for install and manage an smb server. \ +The server mount an nfs volume and rexpose it via smb. + +**INSTALL SMB SERVER:** + +This POST request is used for install an smb server. + +for use this request you must know our user type struct: + +``` json +"user" : { + "user" : "username","pass" : "password" +} + + ``` + +| POST Request | **Request body** | Explain | +| --- | --- | --- | +| \*server ip address\*:4444/apiansible/server/smb | {
"src": "nfs volume ip to rexpose",
"workgroup": "\*workgroup name\*",
"users":\[
{"user": "\*username\*","pass":"\*password\*"}
\]
} | this request require some argument:
the nfs ip address src.
the smb workgroup name.
a list of user who can access to the smb volume described using the above format.
this list is called users. | + +**ADD SMB ACCESS:** + +This POST Request is used to add some access to our smb server.\ +for use this request you must know our user type struct: + +``` json +"user" : { + "user" : "username","pass" : "password" +} + + ``` + +|POST Request | **Request body** | Explain | +| --- | --- | --- | +| \*server ip address\*:4444/apiansible/server/smb/access | {
"users":\[
{"user": "\*username\*","pass":"\*password\*"}
\]
} | this request require some argument:
a list of user who can access to the smb volume described using the above format.
this list is called users. | + +**REMOVE SMB ACCESS:** + +This PATCH request is used for remove and nfs access from the smb volume. + +|PATCH Request | **Request body** | Explain | +| --- | --- | --- | +| \*server ip address\*/apiansible/server/smb/access/ | {
"users":\[
"\*username\*"
\]
} | this request require some argument:
a list of user who can access to the smb volume, for define the user to remove only username is required.
this list is called users. | + +**UNINSTALL SMB SERVER:** + +use this DELETE request for uninstall smb server package and configuration from system. + +|DELETE Request | Explain | +| --- | --- | +| \*server ip address\*:4444/apiansible/server/smb/ | dont require any body.
use this request for clean server from smb package and configuration. | + + +## Used Projects + +- For api build: [gin-gonic](https://github.com/gin-gonic/gin) +- Ansible project: [Ansible](https://github.com/ansible/ansible) +## Authors + +- [Massaroni alex](https://www.github.com/rh363) +- [Vona Daniele](https://github.com/danielv99)