author | weiher |
Mon, 04 Jun 2018 13:54:51 +0200 | |
changeset 17 | 02a3741242b2 |
parent 15 | 523ca1dfd077 |
child 18 | 57431f642e82 |
permissions | -rw-r--r-- |
13 | 1 |
Printing via CUPS and attaching files to labfolder logbooks |
2 |
=========================================================== |
|
3 |
||
15 | 4 |
Follow this guide to set up CUPS virtual printers to be able to print webpages and pictures/files (PDF, PNG, JPG, PS) to one of labfolder's logbooks, thus, creating a new entry with an attachment. If you are an admin of the labfolder VM read the section :ref:`section_cups_admin`. Users of labfolder read the section :ref:`section_cups_user`. |
5 |
||
6 |
||
7 |
.. _section_cups_admin: |
|
8 |
||
9 |
Set up CUPS as labfolder admin |
|
10 |
------------------------------ |
|
11 |
||
12 |
First, you need to install CUPS on the virtual machine that runs labfolder:: |
|
13 | 13 |
|
14 |
sudo apt-get install cups cups-client cups-bsd |
|
15 |
||
15 | 16 |
Next, configure ``/etc/cups/cupsd.conf``:: |
13 | 17 |
|
18 |
# Sample configuration file for the CUPS scheduler. See "man cupsd.conf" for a |
|
19 |
# complete description of this file. |
|
20 |
||
21 |
# Log general information in error_log - change "warn" to "debug" |
|
22 |
# for troubleshooting... |
|
23 |
LogLevel debug |
|
24 |
||
25 |
# Deactivate CUPS' internal logrotating, as we provide a better one, especially |
|
26 |
# LogLevel debug2 gets usable now |
|
27 |
MaxLogSize 0 |
|
28 |
||
29 |
# Administrator user group... |
|
30 |
SystemGroup lpadmin |
|
15 | 31 |
ServerAdmin <name>@fhi-berlin.mpg.de |
13 | 32 |
|
33 |
HostNameLookups On |
|
34 |
ServerAlias * |
|
35 |
||
36 |
# Only listen for connections from the local machine. |
|
37 |
Listen lftest.rz-berlin.mpg.de:631 |
|
38 |
Listen /var/run/cups/cups.sock |
|
39 |
||
40 |
# Show shared printers on the local network. |
|
41 |
Browsing Off |
|
42 |
BrowseOrder allow,deny |
|
43 |
BrowseAllow all |
|
44 |
BrowseLocalProtocols CUPS dnssd |
|
45 |
BrowseAddress @LOCAL |
|
46 |
||
47 |
# Default authentication type, when authentication is required... |
|
48 |
DefaultAuthType Basic |
|
49 |
||
50 |
# Web interface setting... |
|
51 |
WebInterface Yes |
|
52 |
||
53 |
# Restrict access to the server... |
|
54 |
<Location /> |
|
55 |
Satisfy All |
|
56 |
Allow localhost |
|
57 |
Allow 141.14.* |
|
58 |
Allow 172.16.* |
|
59 |
Allow 192.* |
|
60 |
Allow all |
|
61 |
# Allow shared printing and remote administration... |
|
62 |
Order allow,deny |
|
63 |
Allow all |
|
64 |
</Location> |
|
65 |
||
66 |
# Restrict access to the admin pages... |
|
67 |
<Location /admin> |
|
68 |
Order deny,allow |
|
69 |
Satisfy All |
|
70 |
AuthType Basic |
|
71 |
Require user @SYSTEM |
|
72 |
Deny All |
|
73 |
Allow localhost |
|
74 |
Allow 141.14.* |
|
75 |
Allow 172.16.* |
|
76 |
</Location> |
|
77 |
||
78 |
# Restrict access to configuration files... |
|
79 |
<Location /admin/conf> |
|
80 |
Order deny,allow |
|
81 |
AuthType Default |
|
82 |
Require user @SYSTEM |
|
83 |
Satisfy All |
|
84 |
Require user root |
|
85 |
Deny All |
|
86 |
Allow 127.0.0.1 |
|
87 |
Allow 141.14.* |
|
88 |
Allow 172.16.* |
|
89 |
</Location> |
|
90 |
||
91 |
# Set the default printer/job policies... |
|
92 |
<Policy default> |
|
93 |
... # probably as in the original |
|
94 |
</Policy> |
|
95 |
||
17
02a3741242b2
Kleine ?nderung: jetzt gibt es das PW des Printer-Users im Klartext.
weiher
parents:
15
diff
changeset
|
96 |
Change the *Server Admin*'s e-mail address and the server that shall be listened to (see the ``Listen`` statement). Set ``FileDevice Yes`` in ``/etc/cups/cups-files.conf``. Now, create a directory where all printers will go, e.g. ``/usr/local/labfolder/printers``. |
13 | 97 |
|
15 | 98 |
Get the package for creating new printers from git:: |
13 | 99 |
|
15 | 100 |
labfolder@lftest:~$ git clone https://github.molgen.mpg.de/weiher/cupsPrinters |
101 |
labfolder@lftest:~$ ls |
|
102 |
cupsPrinters labfolder |
|
13 | 103 |
|
15 | 104 |
The only file you need to adapt is ``newPrinter.sh``. It is not a must but it is suggested to name the printers like the projects. For example, the FEL projects *operating* and *installation* could be placed at ``.../printers/FEL/operating`` and ``.../printers/FEL/installation``. Execute the script with sudo rights:: |
13 | 105 |
|
15 | 106 |
labfolder@lftest:~/cupsPrinters$ sudo ./newPrinter.sh |
13 | 107 |
|
15 | 108 |
To prevent ``DENIED`` errors from apparmor install and set the following and restart the CUPS server:: |
13 | 109 |
|
15 | 110 |
$ sudo apt-get install apparmor-utils apparmor-profiles |
111 |
$ sudo aa-complain cupsd |
|
112 |
$ sudo service cups restart |
|
13 | 113 |
|
15 | 114 |
In case you need to debug some logfiles can be found here: */var/log/syslog*, */var/log/cups/error_log* and */var/log/cups/acces_log* |
115 |
||
116 |
One last change is that you need to once add a user named *Printer Print* (firstname lastname) to the labfolder database. This can be done manually inside the DB by this command:: |
|
13 | 117 |
|
15 | 118 |
$ mysql -u root -p |
119 |
Enter password: |
|
120 |
... |
|
121 |
mysql> use labfolder; |
|
122 |
mysql> INSERT INTO user (email, password, firstname, lastname, signupTimestamp, maxStorage) VALUES ('printer@fhi-berlin.mpg.de', '91a13f2aba4a35b00c35dfacadd1d75f4a5171dfa7a465fca9c40e6b007ce982', 'Printer', 'Print', '2018-03-21 10:54:00', '10000000'); |
|
13 | 123 |
|
15 | 124 |
|
125 |
.. _section_cups_user: |
|
13 | 126 |
|
15 | 127 |
Printing to labfolder projects |
128 |
------------------------------ |
|
13 | 129 |
|
130 |
The last thing you need to do is to set up a printer *operating* on your local machine. In Ubuntu Gnome hit Alt+F2 keys and enter ``system-config-printer``. In this printer config interface add a new printer *operating* as follows: |
|
131 |
||
132 |
.. image:: _static/create_local_printer01.png |
|
133 |
:width: 70 % |
|
134 |
:align: center |
|
135 |
||
136 |
||
15 | 137 |
.. image:: _static/create_local_printer02.png |
138 |
:width: 70 % |
|
139 |
:align: center |
|
13 | 140 |
|
141 |
||
15 | 142 |
.. image:: _static/create_local_printer03.png |
143 |
:width: 70 % |
|
144 |
:align: center |
|
145 |
||
146 |
||
147 |
.. image:: _static/create_local_printer04.png |
|
148 |
:width: 70 % |
|
149 |
:align: center |
|
150 |
||
13 | 151 |
|
15 | 152 |
.. image:: _static/create_local_printer05.png |
153 |
:width: 70 % |
|
154 |
:align: center |
|
13 | 155 |
|
156 |
||
15 | 157 |
.. image:: _static/create_local_printer06.png |
158 |
:width: 70 % |
|
159 |
:align: center |
|
160 |
||
161 |
||
162 |
.. image:: _static/create_local_printer07.png |
|
163 |
:width: 70 % |
|
164 |
:align: center |
|
165 |