forked from yarda/printrun-webmon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README
107 lines (76 loc) · 2.96 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
Introduction
============
This is an KISS (Keep It Simple and Stupid) web monitor for
printrun / pronterface written in PHP.
For webcam access it requires streamer from the following package:
- xawtv
and v4l2 support in linux kernel.
For printrun querying it requires:
- httpd
- php
- php-xmlrpc
These can be installed on Fedora using:
# dnf install xawtv httpd php php-xmlrpc
It can handle unlimited number of pronterface instances and webcams.
If you run webserver on different user than root (which you really
should), you may need to allow it access to V4L devices. In case
you run Apache as apache user, just adding apache to the video
group should do the trick:
# gpasswd -a apache video
# service httpd restart
SELinux
=======
In case you use SELinux it will require more tweaking. At first
you need to allow Apache processes to use network sockets:
# setsebool -P httpd_can_network_connect 1
Next you need to make folder for images writeable by Apache.
Supposing that the images from the webcameras are stored in the
'img' folder (which is the default), the following commands will
create the folder and allow write operations on it:
# cd /var/www/html
# mkdir img data
# chgrp apache img
# chmod g+w img
# semanage fcontext -a -t httpd_sys_rw_content_t "/var/www/html/data(/.*)?"
# semanage fcontext -a -t httpd_sys_rw_content_t "/var/www/html/img(/.*)?"
# restorecon -Rv /var/www/html/*
Finally you need to create and enable SELinux module which will
allow Apache processes access to V4L devices. On Fedora the
following commands will do it:
# dnf install selinux-policy-devel
# mkdir apache_v4l
# cd apache_v4l
# cat > apache_v4l.te <<:EOF
module apache_v4l 1.0;
require {
class chr_file { open read getattr write ioctl map };
type httpd_t;
type v4l_device_t;
};
# Enable v4l devices access by apache
allow httpd_t v4l_device_t:chr_file { open read getattr write ioctl map };
:EOF
# make -f /usr/share/selinux/devel/Makefile
# semodule -i apache_v4l.pp
Development
===========
The most of the development is done on GitHub:
https://github.com/yarda/printrun-webmon
In case you are not familiar with GitHub you can also sent
patches directly to: jskarvad AT redhat.com
License
=======
Copyright (C) 2016-2018 Jaroslav Škarvada <jskarvad AT redhat.com>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 3
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA.
Full text of the license is enclosed in COPYING file.