-
Notifications
You must be signed in to change notification settings - Fork 6
/
README
155 lines (112 loc) · 4.15 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# Wt-RPM
## Compilation
### Dependencies
#### Ping support
If you are interested in supporting ping, you will have to install liboping.
#### Raspberry Pi backend
To compile the Raspberry Pi backend, please make sure you have installed libwiringPi.
### Compilation
To compile the project, please execute the following steps:
If you plan on using Wt's internal http server:
CONNECTOR="-DUSE_CON_HTTP=ON"
otherwise
CONNECTOR="-DUSE_CON_HTTP=OFF"
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=/usr $CONNECTOR
Review the summary, fix as needed. Then do:
make
sudo make install
## Configuration
Wt_rpm's configuration must be stored in one of the following location:
- ./wt-rpm.json
- ../wt-rpm.json
- ~/.wt-rpm.json
- /etc/wt-rpm.json
The file must follow the JSON format and must contain the backend attribute.
At the moment, there are only two acceptable attribute: rasprpm and dummy_rpm.
Here is a sample configuration file:
{
"backend": "rasprpm",
"configuration": {
"computers": [
{
"name": "pc1",
"ip_address": "192.168.0.42",
"read_acl": ["all"],
"write_acl": [],
"power_led_gpio": {
"pin": 6,
"inverted": "true"
},
"power_switch_gpio": {
"pin": 8,
"inverted": "false"
},
"atx_switch_gpio": {
"pin": 10,
"inverted": "false"
}
},
{
"name": "pc2",
"ip_address": "192.168.0.43",
"read_acl": ["toto", "john"],
"write_acl": ["toto"],
"power_led_gpio": {
"pin": 1,
"inverted": "true"
},
"power_switch_gpio": {
"pin": 0,
"inverted": "false"
},
"atx_switch_gpio": {
"pin": 7,
"inverted": "false"
}
}
]
}
}
## Authentication
If you want to authenticate users before allowing them to list and control
computers, you will need to use an http server such as nginx. Here is an example:
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
keepalive_timeout 65;
gzip on;
server {
listen 443 ssl;
server_name localhost;
ssl_certificate /etc/nginx/ssl/nginx.crt;
ssl_certificate_key /etc/nginx/ssl/nginx.key;
# Wt
location /resources/ {
root /usr/share/Wt/;
index index.html index.htm;
}
location / {
root /usr/share/nginx/html;
index index.html index.htm;
auth_basic "WtRPM";
auth_basic_user_file /etc/nginx/htpasswd;
proxy_pass http://127.0.0.1:9090/;
}
}
}
Don't forget to use SSL otherwise, the passwords will be sent through the network
in plain text!
## Post-Install
After installing Wt-RPM, the program needs some special capabilities to run as
a normal user. Please run the following:
setcap "CAP_NET_RAW=+ep CAP_SYS_RAWIO=+ep" /usr/bin/wt_rpm
Please also make sure that the user has the right to write to /dev/mem.
### Systemd
If you are able to execute wt_rpm properly, you can use the shipped systemd
unit (configured for the user wtrpm).