Skip to content

Commit

Permalink
Merge pull request #63 from AdamMiltonBarker/master
Browse files Browse the repository at this point in the history
HIAS v3
  • Loading branch information
AdamMiltonBarker authored Sep 12, 2021
2 parents 87ed469 + a042707 commit 2f71ecc
Show file tree
Hide file tree
Showing 3,843 changed files with 1,281,100 additions and 41 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
41 changes: 0 additions & 41 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,47 +115,6 @@ It is the contributor's responsibility to ensure that the documentation is up to

We use [MKDocs](https://www.mkdocs.org/) along with [Read the Docs](https://docs.readthedocs.io/en/stable/index.html). Use the [Getting Started with MkDocs](https://docs.readthedocs.io/en/stable/intro/getting-started-with-mkdocs.html) guide to find out how to update/create documentation for the project.

### Repository structure

Repository structures for HIAS **must be followed exactly** for all contributions. Pull Requests that do not follow this structure will be rejected and closed with no further discussion.

```
- Project Root (Directory)
- assets (Directory)
- images (Directory)
- project-banner.jpg (Image)
- bug-report.jpg (Image)
- feature-proposal.jpg (Image)
- feature-request.jpg (Image)
- fork.jpg (Image)
- repo-issues.jpg (Image)
- configuration (Directory)
- config.json (File)
- credentials.json (File)
- docs (Directory)
- img (Directory)
- project-banner.jpg (image)
- installation (Directory)
- ubuntu.md (File)
- usage (Directory)
- ubuntu.md (File)
- index.md (File)
- logs (Directory)
- HIAS logs
- modules (Directory)
- helpers.py (File)
- scripts
- install.sh (File)
- services.sh (File)
- CODE-OF-CONDUCT.md (File)
- CONTRIBUTING.md (File)
- LICENSE (File)
- mkdocs.yml (File)
- README.md (File)
```

**Directories and files may be added to the above structure as required, but none must be removed.**

### Installation Scripts

The default installation script is [install.sh](scripts/install.sh) found in the [scripts](scripts) directory.
Expand Down
8 changes: 8 additions & 0 deletions docs/usage/ubuntu.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ The following guides will take you through using your [HIAS Core](https://github

 

# Password Reset

If you get locked out of the UI or you forget your password, you can reset your password by using the `Password.php` file in the `HTML` directory.

**MAKE SURE YOU REMOVE THIS FILE UNLESS YOU ARE USING IT! IF YOU LEAVE THS FILE IN PLACE ANYONE THAT FINDS IT WILL BE ABLE TO RESET YOUR PASSWORD AND ACCESS YOUR NETWORK**

 

# Contributing
The Asociación de Investigacion en Inteligencia Artificial Para la Leucemia Peter Moss encourages and welcomes code contributions, bug fixes and enhancements from the Github community.

Expand Down
262 changes: 262 additions & 0 deletions src/etc/nginx/sites-available/default
Original file line number Diff line number Diff line change
@@ -0,0 +1,262 @@
upstream php-handler {
server unix:/var/run/php/php7.4-fpm.sock;
}

server {

root /hias/var/www/html;
server_name YourHiasDomainName;
client_max_body_size 512M;

proxy_connect_timeout 600;
proxy_send_timeout 600;
proxy_read_timeout 600;
send_timeout 600;

add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block";
add_header X-Robots-Tag none;
add_header X-Download-Options noopen;
add_header X-Permitted-Cross-Domain-Policies none;
add_header Referrer-Policy no-referrer;

# Remove X-Powered-By, which is an information leak
fastcgi_hide_header X-Powered-By;

location /phpldapadmin {
alias /usr/share/phpldapadmin/htdocs;
index index.php index.html index.htm;

location ~ ^/phpldapadmin/(.+\.php)$ {
try_files $uri =404;
root /usr/share/;

if ($request_filename !~* htdocs) {
rewrite ^/phpldapadmin(/.*)?$ /phpldapadmin/htdocs$1;
}

fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
}
}

# HIASBCH Core Component

location /hiasbch/api/ {
auth_basic "Restricted";
auth_basic_user_file /etc/nginx/security/htpasswd;
proxy_pass http://YourHiasServerIp:8545/;
}

# HIASCDI Core Component

location /hiascdi/v1/ {
auth_basic "Restricted";
auth_basic_user_file /etc/nginx/security/htpasswd;
proxy_pass http://YourHiasServerIp:3524/;
}

location /hiascdi/v1/entities {
auth_basic "Restricted";
auth_basic_user_file /etc/nginx/security/htpasswd;
proxy_pass http://YourHiasServerIp:3524/entities;
}

location /hiascdi/v1/entities/(.*)$ {
auth_basic "Restricted";
auth_basic_user_file /etc/nginx/security/htpasswd;
proxy_pass http://YourHiasServerIp:3524/entities/$1$is_args$args;
}

location /hiascdi/v1/entities/(.*)/attrs/(.*)/value$ {
auth_basic "Restricted";
auth_basic_user_file /etc/nginx/security/htpasswd;
proxy_pass http://YourHiasServerIp:3524/entities/$1/attrs/$2/value$is_args$args;
}

location /hiascdi/v1/entities/(.*)/attrs/(.*)$ {
auth_basic "Restricted";
auth_basic_user_file /etc/nginx/security/htpasswd;
proxy_pass http://YourHiasServerIp:3524/entities/$1/attrs/$2$is_args$args;
}

location /hiascdi/v1/entities/(.*)/attrs$ {
auth_basic "Restricted";
auth_basic_user_file /etc/nginx/security/htpasswd;
proxy_pass http://YourHiasServerIp:3524/entities/$1/attrs$is_args$args;
}

location /hiascdi/v1/types/(.*)$ {
auth_basic "Restricted";
auth_basic_user_file /etc/nginx/security/htpasswd;
proxy_pass http://YourHiasServerIp:3524/types/$1$is_args$args;
}

location /hiascdi/v1/subscriptions/(.*)$ {
auth_basic "Restricted";
auth_basic_user_file /etc/nginx/security/htpasswd;
proxy_pass http://YourHiasServerIp:3524/subscriptions/$1$is_args$args;
}

location /hiascdi/v1/comands/(.*)$ {
auth_basic "Restricted";
auth_basic_user_file /etc/nginx/security/htpasswd;
proxy_pass http://YourHiasServerIp:3524/commands/$1$is_args$args;
}

# HIASHDI Core Component

location /hiashdi/v1/ {
auth_basic "Restricted";
auth_basic_user_file /etc/nginx/security/htpasswd;
proxy_pass http://YourHiasServerIp:3525/;
}

location /hiashdi/v1/data/(.*)$ {
auth_basic "Restricted";
auth_basic_user_file /etc/nginx/security/htpasswd;
proxy_pass http://YourHiasServerIp:3525/data/$1$is_args$args;
}

location /hiashdi/v1/data/(.*)/attrs/(.*)/value$ {
auth_basic "Restricted";
auth_basic_user_file /etc/nginx/security/htpasswd;
proxy_pass http://YourHiasServerIp:3525/data/$1/attrs/$2/value$is_args$args;
}

location /hiashdi/v1/data/(.*)/attrs/(.*)$ {
auth_basic "Restricted";
auth_basic_user_file /etc/nginx/security/htpasswd;
proxy_pass http://YourHiasServerIp:3525/data/$1/attrs/$2$is_args$args;
}

location /hiashdi/v1/data/(.*)/attrs$ {
auth_basic "Restricted";
auth_basic_user_file /etc/nginx/security/htpasswd;
proxy_pass http://YourHiasServerIp:3525/data/$1/attrs$is_args$args;
}

# HIAS IoT Agents

# End HIAS IoT Agents

# HIAS AI Agents

# End HIAS AI Agents

# HIAS Robotics

# End HIAS Robotics

location ~ \.php$ {
include fastcgi_params;
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
fastcgi_read_timeout 86400;
}

location @extensionless-php {
rewrite ^(.*)$ $1.php last;
}

location ~ /\.ht {
deny all;
}

location / {

# HIASBCH (Blockchain)
rewrite ^/HIASBCH/Contracts/Create$ /HIASBCH/Create.php last;
rewrite ^/HIASBCH/Contracts/Contract/([A-Za-z0-9-]+)/([0-9]+)$ /HIASBCH/Contract.php?contract=$1&index=$2 last;
rewrite ^/HIASBCH/Explorer/Address/([A-Za-z0-9-]+)$ /HIASBCH/Address.php?address=$1 last;
rewrite ^/HIASBCH/Explorer/Block/([A-Za-z0-9-]+)$ /HIASBCH/Block.php?block=$1 last;
rewrite ^/HIASBCH/Explorer/Transaction/([A-Za-z0-9-]+)$ /HIASBCH/Transaction.php?transaction=$1 last;

# iotJumpWay Zones
rewrite ^/iotJumpWay/Zones/Create$ /iotJumpWay/CreateZone.php last;
rewrite ^/iotJumpWay/([A-Za-z0-9-]+)/Zones/([A-Za-z0-9-]+)$ /iotJumpWay/Zone.php?location=$1&zone=$2 last;

# iotJumpWay Agents
rewrite ^/iotJumpWay/Agents/Create$ /iotJumpWay/AgentCreate.php last;
rewrite ^/iotJumpWay/Agents/Agent/([A-Za-z0-9-]+)$ /iotJumpWay/Agent.php?agent=$1 last;
rewrite ^/iotJumpWay/Agents/Agent/([A-Za-z0-9-]+)/Configuration$ /iotJumpWay/AgentConfiguration.php?agent=$1 last;
rewrite ^/iotJumpWay/Agents/([0-9]+)/Transaction/([0-9]+)$ /iotJumpWay/AgentTransaction.php?agent=$1&transaction=$2 last;

# iotJumpWay Applications
rewrite ^/iotJumpWay/Applications/Create$ /iotJumpWay/CreateApp.php last;
rewrite ^/iotJumpWay/([A-Za-z0-9-]+)/Applications/([A-Za-z0-9-]+)/Transaction/([0-9]+)$ /iotJumpWay/ApplicationTransaction.php?location=$1&application=$2&transaction=$3 last;
rewrite ^/iotJumpWay/([A-Za-z0-9-]+)/Applications/([A-Za-z0-9-]+)$ /iotJumpWay/Application.php?location=$1&application=$2 last;
rewrite ^/iotJumpWay/([A-Za-z0-9-]+)/Applications/([A-Za-z0-9-]+)/Credentials$ /iotJumpWay/ApplicationCredentials.php?location=$1&application=$2 last;

# iotJumpWay Devices
rewrite ^/iotJumpWay/Devices/Create$ /iotJumpWay/CreateDevice.php last;
rewrite ^/iotJumpWay/([A-Za-z0-9-]+)/Zones/([A-Za-z0-9-]+)/Devices/([A-Za-z0-9-]+)/Transaction/([0-9]+)$ /iotJumpWay/DeviceTransaction.php?location=$1&zone=$2&device=$3&transaction=$4 last;
rewrite ^/iotJumpWay/([A-Za-z0-9-]+)/Zones/([A-Za-z0-9-]+)/Devices/([A-Za-z0-9-]+)$ /iotJumpWay/Device.php?location=$1&zone=$2&device=$3 last;
rewrite ^/iotJumpWay/([A-Za-z0-9-]+)/Zones/([A-Za-z0-9-]+)/Devices/([A-Za-z0-9-]+)/Configuration$ /iotJumpWay/DeviceConfiguration.php?location=$1&zone=$2&device=$3 last;

# iotJumpWay Things

rewrite ^/iotJumpWay/Things/Update$ /iotJumpWay/ThingUpdate.php last;
rewrite ^/iotJumpWay/Things/Upload$ /iotJumpWay/ThingUpload.php last;
rewrite ^/iotJumpWay/Things/Create$ /iotJumpWay/CreateThing.php last;
rewrite ^/iotJumpWay/Things/([A-Za-z0-9-]+)$ /iotJumpWay/Thing.php?thing=$1 last;


# iotJumpWay Data
rewrite ^/iotJumpWay/Data/Statuses$ /iotJumpWay/DataStatuses.php last;
rewrite ^/iotJumpWay/Data/Life$ /iotJumpWay/DataLife.php last;
rewrite ^/iotJumpWay/Data/Sensors$ /iotJumpWay/DataSensors.php last;
rewrite ^/iotJumpWay/Data/Actuators$ /iotJumpWay/DataActuators.php last;
rewrite ^/iotJumpWay/Data/Commands$ /iotJumpWay/DataCommands.php last;

# HIASAI (AI)

rewrite ^/AI/Agents/Create$ /AI/AgentCreate.php last;
rewrite ^/AI/Agents/([A-Za-z0-9-]+)$ /AI/Agent.php?agent=$1 last;
rewrite ^/AI/Agents/([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/Inference$ /AI/$2.php?agent=$1 last;
rewrite ^/AI/Agents/([A-Za-z0-9-]+)/Inference$ /AI/Inference.php?agent=$1 last;
rewrite ^/AI/Agents/([A-Za-z0-9-]+)/Credentials$ /AI/AgentCredentials.php?agent=$1 last;
rewrite ^/AI/Model/([A-Za-z0-9-]+)$ /AI/Model.php?model=$1 last;

# API

rewrite ^/API/Android/Zone/NLU/([A-Za-z]+)$ /API/Android/Zone/NLU/index.php?params=$1 last;

# Users

rewrite ^/Users/Staff/Cancelled$ /Users/Staff/Cancelled.php last;
rewrite ^/Users/Staff/Create$ /Users/Staff/Create.php last;
rewrite ^/Users/Staff/([A-Za-z0-9-]+)$ /Users/Staff/Staff.php?staff=$1 last;

# Robotics
rewrite ^/Robotics/EMAR-Mini/Unit/([A-Za-z0-9-]+)/Credentials$ /Robotics/EMAR-Mini-Credentials.php?unit=$1 last;
rewrite ^/Robotics/EMAR-Mini/Unit/([A-Za-z0-9-]+)$ /Robotics/EMAR-Mini.php?unit=$1 last;

try_files $uri $uri.html $uri/ @extensionless-php;
index index.php index.html index.htm index.nginx-debian.html;
}

listen [::]:443 ssl ipv6only=on; # managed by Certbot
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/YourHiasDomainName/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/YourHiasDomainName/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}

server {

if ($host = YourHiasDomainName){
return 301 https://$host$request_uri;
} # managed by Certbot


listen 80 default_server;
listen [::]:80 default_server;

server_name YourHiasDomainName;
return 404; # managed by Certbot
}

Loading

0 comments on commit 2f71ecc

Please sign in to comment.