Ajout de la config de partage d'imprimantes cups

This commit is contained in:
Gabriel Detraz 2015-07-07 19:20:07 +02:00
parent 999e6190bb
commit dc7616a09b
3 changed files with 80 additions and 104 deletions

View file

@ -1,5 +1,6 @@
<Bundle name="cups-service"> <Bundle name="cups-service">
<Python name="/etc/cups/cupsd.conf"/> <Python name="/etc/cups/cupsd.conf"/>
<Python name="/etc/cups/cups-browsed.conf"/>
<Service name="cups" /> <Service name="cups" />
<Package name="cups"/> <Package name="cups"/>
</Bundle> </Bundle>

View file

@ -0,0 +1,79 @@
# -*- coding: utf-8 -*-
info["owner"] = "root"
info["group"] = "lp"
info["mode"] = 0644
include("ldap_conn")
comment_start = "#"
header("Configuration de partage cups pour le serveur cups et l'intranet")
out("""# Which protocols will we use to discover printers on the network?
# Can use DNSSD and/or CUPS, or 'none' for neither.
BrowseRemoteProtocols dnssd cups
# Upgraded from cups:
# Defaults from 1.0.41: dnssd cups
# Which protocols will we use to broadcast shared local printers to the network?
# Can use DNSSD and/or CUPS, or 'none' for neither.
# Only CUPS is actually supported, as DNSSD is done by CUPS itself (we ignore
# DNSSD in this directive).
# BrowseLocalProtocols none
# Settings of this directive apply to both BrowseRemoteProtocols and
# BrowseLocalProtocols.
# Can use DNSSD and/or CUPS, or 'none' for neither.
BrowseProtocols CUPS
# Only browse remote printers from selected servers
# BrowseAllow all
# BrowseAllow cups.example.com
# BrowseAllow 192.168.1.12
# BrowseAllow 192.168.1.0/24
# BrowseAllow 192.168.1.0/255.255.255.0
BrowseAllow 10.231.136.0/24
# Use BrowsePoll to poll a particular CUPS server
# BrowsePoll cups.example.com
# BrowsePoll cups.example.com:631
# BrowsePoll cups.example.com:631/version=1.1""")
if has ("cups-service-client"):
out("""
BrowsePoll cups.adm.crans.org:631""")
out("""
# CreateIPPPrinterQueues Yes
# The AutoShutdown directive specifies whether cups-browsed should
# automatically terminate when it has no local raw queues set up
# pointing to any discovered remote printers (auto shutdown
# mode). Setting it to "On" activates the auto-shutdown mode, setting
# it to "Off" deactiivates it (the default). The special mode "avahi"
# turns auto shutdown off while avahi-daemon is running and on when
# avahi-daemon stops. This allows running cups-browsed on-demand when
# avahi-daemon is run on-demand.
# AutoShutdown Off
# AutoShutdown On
# AutoShutdown avahi
# The AutoShutdownTimeout directive specifies after how many seconds
# without local raw queues set up pointing to any discovered remote
# printers cups-browsed should actually shut down in auto shutdown
# mode. Default is 30 seconds, 0 means immediate shutdown.
# AutoShutdownTimeout 30
# Unknown directives are ignored, also unknown values.
# Please check and edit the following lines, especially if you have Linux
# machines with CUPS 1.5.x and older in your network.
# If you edit anything in this file, please remember to restart cups-browsed
# (or reboot the system) afterwards.
# Please remove the "#" in the beginning of the following line to make the
# local printers available to clients running CUPS 1.5.x or older.
#BrowseLocalProtocols cups""")

View file

@ -1,104 +0,0 @@
# -*- coding: utf-8 -*-
info["owner"] = "root"
info["group"] = "lp"
info["mode"] = 0644
include("ldap_conn")
comment_start = "#"
header("Configuration pour cups entre le serveur cups et l'intranet")
def ipv4(serveur):
return str(conn.search(u'host=%s.adm.crans.org' % serveur)[0]['ipHostNumber'][0])
out("""LogLevel info
MaxLogSize 0
# Allow remote access""")
out("""Listen """ + ipv4('o2'))
out("""Listen /var/run/cups/cups.sock
# Share local printers on the local network.
Browsing On
BrowseLocalProtocols dnssd
DefaultAuthType Basic
<Location />
# Allow shared printing...
Order allow,deny
Allow @LOCAL
</Location>
<Location /admin>
Order allow,deny
Allow @LOCAL
</Location>
<Location /admin/conf>
AuthType Default
Require user @SYSTEM
Order allow,deny
</Location>
<Policy default>
JobPrivateAccess default
JobPrivateValues default
SubscriptionPrivateAccess default
SubscriptionPrivateValues default
<Limit Create-Job Print-Job Print-URI Validate-Job>
Order deny,allow
</Limit>
<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 Cancel-My-Jobs Close-Job CUPS-Move-Job CUPS-Get-Document>
Require user @OWNER @SYSTEM
Order deny,allow
</Limit>
<Limit CUPS-Add-Modify-Printer CUPS-Delete-Printer CUPS-Add-Modify-Class CUPS-Delete-Class CUPS-Set-Default CUPS-Get-Devices>
AuthType Default
Require user @SYSTEM
Order deny,allow
</Limit>
<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 Cancel-Jobs CUPS-Accept-Jobs CUPS-Reject-Jobs>
AuthType Default
Require user @SYSTEM
Order deny,allow
</Limit>
<Limit Cancel-Job CUPS-Authenticate-Job>
Require user @OWNER @SYSTEM
Order deny,allow
</Limit>
<Limit All>
Order deny,allow
</Limit>
</Policy>
<Policy authenticated>
JobPrivateAccess default
JobPrivateValues default
SubscriptionPrivateAccess default
SubscriptionPrivateValues default
<Limit Create-Job Print-Job Print-URI Validate-Job>
AuthType Default
Order deny,allow
</Limit>
</Limit>
<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 Cancel-My-Jobs Close-Job CUPS-Move-Job CUPS-Get-Document>
AuthType Default
Require user @OWNER @SYSTEM
Order deny,allow
</Limit>
<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
</Limit>
<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 Cancel-Jobs CUPS-Accept-Jobs CUPS-Reject-Jobs>
AuthType Default
Require user @SYSTEM
Order deny,allow
</Limit>
<Limit Cancel-Job CUPS-Authenticate-Job>
AuthType Default
Require user @OWNER @SYSTEM
Order deny,allow
</Limit>
<Limit All>
Order deny,allow
</Limit>
</Policy>""")