WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: cups printer and bonjour alternatives?  (Read 6990 times)

aus9

  • Guest
cups printer and bonjour alternatives?
« on: March 16, 2013, 08:47:59 PM »
Hi

Rather than pester one of the mods with my progress or lack thereof for upgrading cups, I shall put feelers out here

new cups has a feature called cups-browsed, that may depend on bonjour

we have avahi already.

so in looking at it, what do you think about this app?
http://0pointer.de/lennart/projects/nss-mdns/

and we already have it..... nss-mdns.tcz

from upstream we have

Quote
nss-mdns is a plugin for the GNU Name Service Switch (NSS) functionality of the GNU C Library (glibc) providing host name resolution via Multicast DNS (aka Zeroconf, aka Apple Rendezvous, aka Apple Bonjour), effectively allowing name resolution by common Unix/Linux programs in the ad-hoc mDNS domain .local.

nss-mdns provides client functionality only, which means that you have to run a mDNS responder daemon seperately from nss-mdns if you want to register the local host name via mDNS. I recommend Avahi.

Why am I interested?

new cups-filters (when it lands) has cups-browsed executable that claims
Quote
cups-browsed: Added CUPS Broadcasting for sharing local printers   to remote CUPS clients

(in an older release we can see)
cups-browsed: Added daemon to browse the Bonjour broadcasts of shared remote CUPS printers and automatically add local raw queues pointing to them, to resemble the behavior of the former CUPS  broadcasting/browsing which was dropped in CUPS 1.6. Now remote   printers appear as local print queues as before, but with the  standardized Bonjour broadcasting.

Is there sufficient information here to suggest we can have this broadcast discovery feature without submitting bonjour?

2) If not, does anyone think we need this bonjour package?

Here is cups-filters readme section on bonjour matters in a code box for display purposes only

Code: [Select]
HELPER DAEMON FOR BROWSING REMOTE CUPS PRINTERS

    From version 1.6.0 on in CUPS the CUPS broadcasting/browsing
    facility was dropped, in favour of Bonjour-based broadcasting of
    shared printers. This is done as Bonjour broadcasting of shared
    printers is a standard, established by the PWG (Printing Working
    Group, http://www.pwg.org/), and most other network services
    (shared file systems, shared media files/streams, remote desktop
    services, ...) are also broadcasted via Bonjour.

    Problem is that CUPS only broadcasts its shared printers but does
    not browse broadcasts of other CUPS servers to make the shared
    remote printers available locally without any configuration
    efforts. This is a regression compared to the old CUPS
    broadcasting/browsing. The intention of CUPS upstream is that the
    application's print dialogs browse the Bonjour broadcasts as an
    AirPrint-capable iPhone does, but it will take its time until all
    toolkit developers add the needed functionality, and programs
    using old toolkits or no toolkits at all, or the command line stay
    uncovered.

    The solution is cups-browsed, a helper daemon running in parallel
    to the CUPS daemon which listens to Bonjour broadcasts of shared
    CUPS printers on remote machines in the local network via Avahi,
    and can also listen for (and send) CUPS Browsing broadcasts. For
    each reported remote printer it creates a local raw queue pointing
    to the remote printer so that the printer appears in local print
    dialogs and is also available for printing via the command
    line. As with the former CUPS broadcasting/browsing with this
    queue the driver on the server is used and the local print dialogs
    give access to all options of the server-side printer driver.

    Also high availability with redundant print servers is
    supported. If there is more than one server providing a shared
    print queue with the same name, cups-browsed uses the first queue
    which appeared and if this queue disappears, cups-browsed
    seamlessly switches to the queue of another server. Unfortunately,
    load-balancing (what CUPS did via implicit classes) is not
    possible with cups-browsed.

    For maximum security cups-browsed uses IPPS (encrypted IPP)
    whenever possible.

    The "make install" process installs init scripts which make the daemon
    automatically started during boot. You can also manually start it with
    (as root):

    /usr/sbin/cups-browsed &

    or in debug mode with

    /usr/sbin/cups-browsed --debug

    Shut it down by sending signal 2 (SIGINT) or 15 (SIGTERM) to it. The
    queues which it has created get removed then.

    Here is some info on how cups-browsed works internally:

    - Daemon start
      o Wait for CUPS daemon if it is not running
      o Read out all CUPS queues created by this daemon (in former sessions)
      o Mark them unconfirmed and set timeout 10 sec from now
    - Main loop (use avahi_simple_poll_iterate() to do queue list maintenance
                 regularly)
      o Event: New printer shows up
        + Queue for printer is already created by this daemon -> Mark list
          entry confirmed, if discovered printer is ipps but existing queue ipp,
  upgrade existing queue by setting URI to ipps. Set status to
  to-be-created and timeout to now-1 sec to make the CUPS queue be
  updated.
        + Queue does not yet exist -> Mark as to-be-created and set
  timeout to now-1 sec.
      o Event: A printer disappears
        + If we have listed a queue for it, mark the entry as disappeared, set
          timeout to now-1 sec
      o On any of the above events and every 2 sec
        + Check through list of our listed queues
          - If queue is unconfirmed and timeout has passed, mark it as
            disappeared, set timeout to now-1 sec
          - If queue is marked disappered and timeout has passed, check whether
    there are still jobs in it, if yes, set timeout to 10 sec from now,
    if no, remove the CUPS queue and the queue entry in our list. If
    removal fails, set timeout to 10 sec.
  - If queue is to-be-created, create it, if succeeded set to
    confirmed, if not, set timeout to 10 sec fron now. printer-is-shared
    must be set to false.
    - Daemon shutdown
      o Remove all CUPS queues in our list, as long as they do not have jobs.

    Do not overwrite existing queues which are not created by us If
    the simple <remote_printer> name is already taken, try to create a
    <remote_printer>@<server> name, if this is also taken, ignore the
    remote printer. Do not retry, to avoid polling CUPS all the time.

    Do not remove queues which are not created by us. We do this by
    listing only our queues and remove only listed queues.

    Queue names: Use the name of the remote queue. If a queue with the
    same name from another server already exists, mark the new queue
    as duplicate and when a queue disappears, check whether it has
    duplicates and change the URI of the disappeared queue to the URI
    of the first duplicate, mark the queue as to-be-created with
    timeout now-1 sec (to update the URI of the CUPS queue) and mark
    the duplicate ddisappeared with timeout now-1 sec. In terms of
    high availability we replace the old load balancing of the
    implicit class by a failover solution. Alternatively (not
    implemented), if queue with same name but from other server
    appears, create new queue as <original name>@<server name without
    .local>. When queue with simple name is removed, replace the first
    of the others by one with simple name (mark old queue disappeared
    with timeout now-1 sec and create new queue with simple name).

    Fill description of the created CUPS queue with the Bonjour
    service name (= original description) and location with the server
    name without .local.

    stderr messages only in debug mode (command line options:
    "--debug" or "-d" or "-v").

    Queue identified as from this daemon by doing the equivalent of
    "lpadmin -p printer -o cups-browsed-default", this generates a
    "cups-browsed" attribute in printers.conf with value "true".

    The configuration file for cups-browsed is
    /etc/cups/cups-browsed.conf.  This file can include limited forms
    of the original CUPS BrowseRemoteProtocols, BrowseLocalProtocols,
    BrowsePoll, and BrowseAllow directives.

thanks for reading
« Last Edit: April 30, 2013, 08:28:15 AM by aus9 »

aus9

  • Guest
so I will look at re-enabling avahi in the build for cups-filters

and have avahi as a running dependency and I notice nss-mdns is a dependency of avahi already.

aus9

  • Guest
Re: [project cancelled] cups printer and bonjour alternatives?
« Reply #2 on: April 25, 2013, 08:03:00 AM »
I am keeping subject still cancelled as when I loaded cups and cups-filters I could not get past the root login screen with a verified root passwd I checked in a console, and it was already a saved passwd.

So I jumped back to cups-filters that supplies the cups-browsed daemon. I have rebuilt it just then, stripping it away from the main cups-filters package.
So potentially final products will be
cups
libcups

cups-filters
libcups-filters
cups-browsed.

Altho I can't test for a real detected network, I have had the daemons fall over so its probably wise to have this separate package as it may well need a rebuild or twenty.

Trivia......cups-filters allows make check......and it passes
cups does not allow make check by root....and I suspect it won't pass.

cups now splits its own daemon config file.........cupsd.conf into cupsd.conf and cups-files.conf
and a number of old keywords or config phrases now fail............so users will have to adopt the new configs and then change them on upgrade IMHO

I have had a lot of fun (not) reading debug log to see why Basic Authentication like old cups is not working for me ATM

thanks for reading

Online Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14823
Re: [project cancelled] cups printer and bonjour alternatives?
« Reply #3 on: April 25, 2013, 09:29:18 AM »
Out of curiosity, what files would you put in libcups-filters?

Unless it has a use with cups-browsed, I understood that cups-files.conf was only used by libcups (used in the absence of the full cups installation) to find and print to a cups server?

aus9

  • Guest
Re: [project cancelled] cups printer and bonjour alternatives?
« Reply #4 on: April 25, 2013, 09:41:29 AM »
EEK just realized I put the daemon into bin instead of sbin, rebuild required

Quote
Out of curiosity, what files would you put in libcups-filters?

Code: [Select]
usr/local/lib/libcupsfilters.so
usr/local/lib/libcupsfilters.so.1
usr/local/lib/libcupsfilters.so.1.0.0
usr/local/lib/libfontembed.so
usr/local/lib/libfontembed.so.1
usr/local/lib/libfontembed.so.1.0.0
usr/local/share/doc/libcups-filters/AUTHORS
usr/local/share/doc/libcups-filters/COPYING

Let me know if you need to know anything else, but I will jump back and look at cups again over the next few days
unless something else strikes me.
« Last Edit: April 30, 2013, 08:28:50 AM by aus9 »

aus9

  • Guest
Re: [project cancelled] cups printer and bonjour alternatives?
« Reply #5 on: April 25, 2013, 09:52:05 AM »
Quote
cups-files.conf

standard config is in code box for no font reduction display purposes only
This is pre-compile and is affected by your .configure such as
--with-cups-user =user   --with-cups-group=group  --with-system-groups=group2

I am still playing with them after initially using tc,staff,root but my login still failing with root

Code: [Select]
#
# "$Id: cups-files.conf.in 10765 2012-12-13 20:36:17Z mike $"
#
# Sample file/directory/user/group configuration file for the CUPS scheduler.
# See "man cups-files.conf" for a complete description of this file.
#

# List of events that are considered fatal errors for the scheduler...
#FatalErrors @CUPS_FATAL_ERRORS@

# Default user and group for filters/backends/helper programs; this cannot be
# any user or group that resolves to ID 0 for security reasons...
#User @CUPS_USER@
#Group @CUPS_GROUP@

# Administrator user group, used to match @SYSTEM in cupsd.conf policy rules...
SystemGroup @CUPS_SYSTEM_GROUPS@
@CUPS_SYSTEM_AUTHKEY@

# User that is substituted for unauthenticated (remote) root accesses...
#RemoteRoot remroot

# Do we allow file: device URIs other than to /dev/null?
#FileDevice No

# Permissions for configuration and log files...
#ConfigFilePerm 0@CUPS_CONFIG_FILE_PERM@
#LogFilePerm 0@CUPS_LOG_FILE_PERM@

# Location of the file logging all access to the scheduler; may be the name
# "syslog". If not an absolute path, the value of ServerRoot is used as the
# root directory.  Also see the "AccessLogLevel" directive in cupsd.conf.
AccessLog @CUPS_LOGDIR@/access_log

# Location of cache files used by the scheduler...
#CacheDir @CUPS_CACHEDIR@

# Location of data files used by the scheduler...
#DataDir @CUPS_DATADIR@

# Location of the static web content served by the scheduler...
#DocumentRoot @CUPS_DOCROOT@

# Location of the file logging all messages produced by the scheduler and any
# helper programs; may be the name "syslog". If not an absolute path, the value
# of ServerRoot is used as the root directory.  Also see the "LogLevel"
# directive in cupsd.conf.
ErrorLog @CUPS_LOGDIR@/error_log

# Location of fonts used by older print filters...
#FontPath @CUPS_FONTPATH@

# Location of LPD configuration
#LPDConfigFile @CUPS_DEFAULT_LPD_CONFIG_FILE@

# Location of the file logging all pages printed by the scheduler and any
# helper programs; may be the name "syslog". If not an absolute path, the value
# of ServerRoot is used as the root directory.  Also see the "PageLogFormat"
# directive in cupsd.conf.
PageLog @CUPS_LOGDIR@/page_log

# Location of the file listing all of the local printers...
#Printcap @CUPS_DEFAULT_PRINTCAP@

# Format of the Printcap file...
#PrintcapFormat bsd
#PrintcapFormat plist
#PrintcapFormat solaris

# Location of all spool files...
#RequestRoot @CUPS_REQUESTS@

# Location of helper programs...
#ServerBin @CUPS_SERVERBIN@

# SSL/TLS certificate for the scheduler...
#ServerCertificate @CUPS_SERVERCERT@

# SSL/TLS private key for the scheduler...
#ServerKey @CUPS_SERVERKEY@

# Location of other configuration files...
#ServerRoot @CUPS_SERVERROOT@

# Location of Samba configuration file...
#SMBConfigFile @CUPS_DEFAULT_SMB_CONFIG_FILE@

# Location of scheduler state files...
#StateDir @CUPS_STATEDIR@

# Location of scheduler/helper temporary files. This directory is emptied on
# scheduler startup and cannot be one of the standard (public) temporary
# directory locations for security reasons...
#TempDir @CUPS_REQUESTS@/tmp

#
# End of "$Id: cups-files.conf.in 10765 2012-12-13 20:36:17Z mike $".
#

I am not so sure about
Quote
only used by libcups (used in the absence of the full cups installation) to find and print to a cups server

aus9

  • Guest
Re: [project cancelled] cups printer and bonjour alternatives?
« Reply #6 on: April 25, 2013, 11:15:18 AM »
online notes to myself

TCB has lp group

load existing cups and groups command returns.....staff and audio

/etc/pam.d looks interesting, I compiled ssl / openssl support into new build but maybe its PAM I need to look at?

aus9

  • Guest
Re: [project cancelled] cups printer and bonjour alternatives?
« Reply #7 on: April 25, 2013, 08:06:52 PM »
and untested, but me thinks that the daemons fall over when there is a lot in the order like

cups -> avahi  -> (optional) bluez = bluetooth  -> cups-browsed
so will test much later more sleeps in init unless you can spot a mistake?

procps will become an extra dep this way, to provide pkill

Code: [Select]
start() { 
if ps | awk '{print $3}' | grep -e "avahi-daemon" >/dev/null; then
    /usr/local/sbin/avahi-dnsconfd -D && sleep 2
/usr/local/sbin/cups-browsed &
sleep 2
else 
          /usr/local/sbin/avahi-daemon -D && sleep 2       
        /usr/local/sbin/avahi-dnsconfd -D && sleep 2
/usr/local/sbin/cups-browsed &
sleep 2
        fi 

 
stop() { 
      pkill cups-browsed && pkill avahi-dnsconfd
    sleep 2

 
status() {
       if ps | awk '{print $3}' | grep -e "cups-browsed" >/dev/null; then
            echo -e "\ncups-browsed is running.\n"
            exit 0 
       else 
            echo -e "\ncups-browsed is not running.\n"
            exit 1 
       fi 
}

blah blah

aus9

  • Guest
Re: [project cancelled] cups printer and bonjour alternatives?
« Reply #8 on: April 30, 2013, 04:42:00 AM »
well I just rebuilt cups to give it locale tcz and now I am hitting the cups versus avahi daemon issue

It seems that if start dbus, it does not fall over

start cups
start avahi

If I try restart cups ---- avahi falls over

and now I can't get back into a localhost.........grrrr