CUPS: различия между версиями
ALEX (обсуждение | вклад) |
ALEX (обсуждение | вклад) |
||
| Строка 47: | Строка 47: | ||
</pre>}} | </pre>}} | ||
Теперь рассмотрим вариант конфига CUPS'а | |||
{{file|/etc/cups/cupsd.conf| | |||
<pre> | |||
# Log general information in error_log - change "info" to "debug" for | |||
# troubleshooting... | |||
LogLevel info | |||
# Administrator user group... | |||
SystemGroup lpadmin | |||
ServerName 192.168.0.1 # hostname-or-ip-address; Specifies the fully-qualified hostname of the server. | |||
ServerAdmin alex@donik.org # user@domain.com; Specifies the email address of the server administrator. | |||
# Only listen for connections from the local machine. | |||
Listen *:631 | |||
Listen /var/run/cups/cups.sock | |||
MaxClients 100 | |||
# Show shared printers on the local network. | |||
Browsing On | |||
BrowseOrder deny,allow | |||
BrowseDeny none | |||
BrowseAllow 192.168.0.0/255.255.255.0 | |||
BrowseAddress 192.168.*.*:631 | |||
# Default authentication type, when authentication is required... | |||
DefaultAuthType Basic | |||
# Restrict access to the server... | |||
<Location /> | |||
Order deny,allow | |||
Deny From All | |||
Allow From 192.168.0.0/24 | |||
</Location> | |||
# Restrict access to the admin pages... | |||
<Location /admin> | |||
Encryption Required | |||
Order deny,allow | |||
Deny From All | |||
Allow From 192.168.0.0/24 | |||
</Location> | |||
# Restrict access to configuration files... | |||
<Location /admin/conf> | |||
AuthType Default | |||
Require user @SYSTEM | |||
Order deny,allow | |||
Deny From All | |||
Allow From 192.168.0.0/24 | |||
</Location> | |||
# Set the default printer/job policies... | |||
<Policy default> | |||
# Job-related operations must be done by the owner or an administrator... | |||
<Limit Send-Document Send-URI Hold-Job Release-Job Restart-Job Purge-Jobs Set-Job-Attributes | |||
Create-Job-Subscription Renew-Subscription Cancel-Subscription Get-Notifications Reprocess-Job | |||
Cancel-Current-Job Suspend-Current-Job Resume-Job CUPS-Move-Job> | |||
Require user @OWNER @SYSTEM | |||
Order deny,allow | |||
Deny From All | |||
Allow From 192.168.0.0/24 | |||
</Limit> | |||
# All administration operations require an administrator to authenticate... | |||
<Limit CUPS-Add-Modify-Printer CUPS-Delete-Printer CUPS-Add-Modify-Class CUPS-Delete-Class CUPS-Set-Default> | |||
AuthType Default | |||
Require user @SYSTEM | |||
Order deny,allow | |||
Deny From All | |||
Allow From 192.168.0.0/24 | |||
</Limit> | |||
# All printer operations require a printer operator to authenticate... | |||
<Limit Pause-Printer Resume-Printer Enable-Printer Disable-Printer Pause-Printer-After-Current-Job | |||
Hold-New-Jobs Release-Held-New-Jobs Deactivate-Printer Activate-Printer Restart-Printer Shutdown-Printer | |||
Startup-Printer Promote-Job Schedule-Job-After CUPS-Accept-Jobs CUPS-Reject-Jobs> | |||
AuthType Default | |||
Require user @SYSTEM | |||
Order deny,allow | |||
Deny From All | |||
Allow From 192.168.0.0/24 | |||
</Limit> | |||
# Only the owner or an administrator can cancel or authenticate a job... | |||
<Limit Cancel-Job CUPS-Authenticate-Job> | |||
Require user @OWNER @SYSTEM | |||
Order deny,allow | |||
Deny From All | |||
Allow From 192.168.0.0/24 | |||
</Limit> | |||
<Limit All> | |||
Order deny,allow | |||
Deny From All | |||
Allow From 192.168.0.0/24 | |||
</Limit> | |||
</Policy> | |||
# | |||
# End of "$Id: cupsd.conf.in 7199 2008-01-08 00:16:30Z mike $". | |||
#</pre>}} | |||
{{Warning|Строки типа '''<Limit''' в данном примере конфига я специально перенёс на несколько т.к. они выходят за поля монитора в браузере, что уменьшает читаемость и красоту хелпа, на самом деле в конфиге они все идут без символа переноса строки}} | |||
== Ссылки == | == Ссылки == | ||
Версия 16:55, 7 сентября 2009
CUPS (Common UNIX Printing System) — сервер печати для UNIX-подобных операционных систем. Компьютер с запущенным CUPS представляет собой сервер, который принимает задания от клиентов и выполняет их на соответствующем принтере.
CUPS in Gentoo Linux
Решил избавится у себя от лишней коробочки под столом, которая именовалась print setver от D-Link. Зачем использовать её, если крутится постоянно сервер под Генту? И так что мы имеем для этого. Сервер под упралвением ОС Gentoo Linux с ядром 2.6, принтер HP DeskJet 970Cxi. Перво наперво надо пересобрать ядро, включив туда поддержку USB и принтера USB. Для этого под рутом вводим:
и загрузив наш старый конфиг (надеюсь вы его сохранили после последней переборки ядра) правим вот это
| Linux Kernel Configuration: USB and USB Printer kernel config |
Device Drivers -->
USB Support -->
<*> Support for Host-side USB
(...)
--- USB Host Controller Drivers
<*> EHCI HCD (USB 2.0) support
<*> OHCI HCD support
<*> UHCI HCD (most Intel and VIA) support
(...)
<*> USB Printer support
|
Теперь ставим собственно саму CUPS. Для более подробного уточнее возможных USE флагов смотрим ссылку Gentoo Printing Guide (в разделе ссылки). Лично я поставил следующие: Use Flags: acl dbus jpeg png ppds python ssl tiff pam (?)
Для добавления флагов пишем
. Далее ставим обычным стандартным способом
.
Теперь для нормальной печати из Windows надо поправить 2 файла (это вносит возможность печати через Windows PCL Drivers, который посылает данные в виде Raw принт серверу, то есть нам надо активировать возможность Raw печати через СUPS):
application/octet-stream
и
application/octet-stream application/vnd.cups-raw 0 -
Теперь рассмотрим вариант конфига CUPS'а
# Log general information in error_log - change "info" to "debug" for
# troubleshooting...
LogLevel info
# Administrator user group...
SystemGroup lpadmin
ServerName 192.168.0.1 # hostname-or-ip-address; Specifies the fully-qualified hostname of the server.
ServerAdmin alex@donik.org # user@domain.com; Specifies the email address of the server administrator.
# Only listen for connections from the local machine.
Listen *:631
Listen /var/run/cups/cups.sock
MaxClients 100
# Show shared printers on the local network.
Browsing On
BrowseOrder deny,allow
BrowseDeny none
BrowseAllow 192.168.0.0/255.255.255.0
BrowseAddress 192.168.*.*:631
# Default authentication type, when authentication is required...
DefaultAuthType Basic
# Restrict access to the server...
<Location />
Order deny,allow
Deny From All
Allow From 192.168.0.0/24
</Location>
# Restrict access to the admin pages...
<Location /admin>
Encryption Required
Order deny,allow
Deny From All
Allow From 192.168.0.0/24
</Location>
# Restrict access to configuration files...
<Location /admin/conf>
AuthType Default
Require user @SYSTEM
Order deny,allow
Deny From All
Allow From 192.168.0.0/24
</Location>
# Set the default printer/job policies...
<Policy default>
# Job-related operations must be done by the owner or an administrator...
<Limit Send-Document Send-URI Hold-Job Release-Job Restart-Job Purge-Jobs Set-Job-Attributes
Create-Job-Subscription Renew-Subscription Cancel-Subscription Get-Notifications Reprocess-Job
Cancel-Current-Job Suspend-Current-Job Resume-Job CUPS-Move-Job>
Require user @OWNER @SYSTEM
Order deny,allow
Deny From All
Allow From 192.168.0.0/24
</Limit>
# All administration operations require an administrator to authenticate...
<Limit CUPS-Add-Modify-Printer CUPS-Delete-Printer CUPS-Add-Modify-Class CUPS-Delete-Class CUPS-Set-Default>
AuthType Default
Require user @SYSTEM
Order deny,allow
Deny From All
Allow From 192.168.0.0/24
</Limit>
# All printer operations require a printer operator to authenticate...
<Limit Pause-Printer Resume-Printer Enable-Printer Disable-Printer Pause-Printer-After-Current-Job
Hold-New-Jobs Release-Held-New-Jobs Deactivate-Printer Activate-Printer Restart-Printer Shutdown-Printer
Startup-Printer Promote-Job Schedule-Job-After CUPS-Accept-Jobs CUPS-Reject-Jobs>
AuthType Default
Require user @SYSTEM
Order deny,allow
Deny From All
Allow From 192.168.0.0/24
</Limit>
# Only the owner or an administrator can cancel or authenticate a job...
<Limit Cancel-Job CUPS-Authenticate-Job>
Require user @OWNER @SYSTEM
Order deny,allow
Deny From All
Allow From 192.168.0.0/24
</Limit>
<Limit All>
Order deny,allow
Deny From All
Allow From 192.168.0.0/24
</Limit>
</Policy>
#
# End of "$Id: cupsd.conf.in 7199 2008-01-08 00:16:30Z mike $".
#