Impresora compartida CUPS con problema de autenticación y conexión SSL en máquinas con Windows

Impresora compartida CUPS con problema de autenticación y conexión SSL en máquinas con Windows

Tengo un problema al conectar la impresora en Windows 10 o 7. Todo funciona muy bien en mi Debian, ya sea el tipo de autenticación básica o HTTPS. Creé el usuario cups_print y le asigné una contraseña con el comando passwd. Intenté deshabilitar la autenticación y TLS/SSL y sin ellos las estaciones de Windows pueden conectarse a HP P1006, que está conectado a Raspi con CUPS en ejecución. También probé Requerir usuario válido, pero con esta opción puedo imprimir con cualquier credencial, por ejemplo, nombre de usuario: "aa" contraseña: "contraseña aleatoria". También intenté escuchar en el puerto 631 cuando realicé una conexión SSL sin éxito en Windows, Linux funciona bien con todas las opciones.

Intenté configurar la URL de ipp en Windows de estas maneras:
https://192.168.X.132:632/printers/HP_LaserJet_P1006
https://tazas_print:[correo electrónico protegido]:632/impresoras/HP_LaserJet_P1006
https://[correo electrónico protegido]:632/impresoras/HP_LaserJet_P1006
http://[correo electrónico protegido]:631/impresoras/HP_LaserJet_P1006
http://192.168.X.132:631/printers/HP_LaserJet_P1006
http://tazas_print:[correo electrónico protegido]:631/impresoras/HP_LaserJet_P1006

También intenté agregar una impresora, cuando cupsd.conf está configurado sin necesidad de autenticación y luego lo reinicié con la opción activada, luego proporcioné las credenciales a Windows a través de la edición de puerto. De nuevo sin ningún éxito. Puedo acceder a la configuración de tazas en cualquier estación de Windows a través de la interfaz web. Parece ser un problema con Windows, si no, ¿puede sugerir alguna solución? Me gustaría tener todo seguro en mi red doméstica.

Adjunto parte de mi archivo cupsd.conf

# Show troubleshooting information in error_log.
LogLevel debug
PageLogFormat
MaxLogSize 0
Port 631
Listen localhost:631
Listen /run/cups/cups.sock
Listen 192.168.X.X:631
Browsing On
BrowseLocalProtocols dnssd
BrowseAllow All
DefaultAuthType Basic
WebInterface Yes
DefaultEncryption Required
SSLPort 632
SSLListen *:632
<Location />
  Order allow,deny
  Allow 192.168.X.*
  Allow 192.168.X.*
  Allow localhost
  #Allow all
  Require user cups_print
  #Require user @SYSTEM cups_print  
</Location>
<Location /printers>
  Order allow,deny
  Allow 192.168.X.*
  Allow 192.168.X.*
 Allow localhost
  #Allow all
  AuthType Basic
  Require user cups_print
  #Require user @SYSTEM cups_print  

Respuesta1

Después de una semana de luchar con este problema, encontré una solución.

En la actualización de Windows 10 1903 hay un problema al agregar una impresora con autenticación. Primero debe configurar el puerto, incluso antes de agregar la impresora; después de eso, podrá agregarla sin ningún problema. Un buen script que puedes editar y ejecutar está aquí

Instrucciones para agregar https y autenticación de impresora

Script modificando registros y añadiendo puerto.

O puede agregarlo manualmente configurando registros, consulte el segundo enlace. Después de agregar exitosamente el puerto y la impresora (nada debería solicitarle credenciales), vaya a la configuración de la impresora, configuración del puerto y configure el puerto con la credencial proporcionada. Sin ellos, no podrá imprimir.

En segundo lugar, debe otorgar acceso a todas las ubicaciones sin autenticación, incluso a "/" y "/printers" en cupsd.conf. Después de eso, cree un límite de política <Limit Get-Printer-Attributes>y no requiera autenticación allí en absoluto. Luego habilite la autenticación en <Limit Cancel-Job CUPS-Authenticate-Job>y <Limit Create-Job Print-Job Print-URI Validate-Job>.

Si está intentando utilizar un certificado autofirmado, siga el enlace Agregar certificado autofirmado en Windows. No olvide agregar este certificado a "Certificados raíz de confianza de terceros"

Algunas fuentes más con problemas que debe enfrentar cuando agrega una impresora IPP a Windows Problema de autenticación de tazas Windows Problema de autenticación de tazas Windows

Mi cupsd.conf (anonimizado)

LogLevel debug
PageLogFormat
MaxLogSize 0

SSLPort 636
SSLListen *:636

Browsing On
BrowseLocalProtocols dnssd
BrowseAllow All

DefaultAuthType Basic

WebInterface yes


DefaultEncryption required

ServerKey /etc/cups/ssl/server.key
ServerCertificate /etc/cups/ssl/server.crt

ServerAlias hostname.my_domain.net


# Restrict access to the server...
<Location />
  Order allow,deny
  Allow 192.168.X1.*
  Allow 192.168.X2.*
  Allow localhost 
</Location>

<Location /printers>
  Order allow,deny
  Allow 192.168.X1.*
  Allow 192.168.X2.*
  Allow localhost
</Location>


# Restrict access to the admin pages...
<Location /admin>
  Order allow,deny
  Allow localhost
  Deny all
</Location>

# Restrict access to configuration files...
<Location /admin/conf>
  AuthType Default
  Require user @SYSTEM
  Allow localhost
  Order allow,deny
</Location>

# Restrict access to log files...
<Location /admin/log>
  AuthType Default
  Require user @SYSTEM
  Order allow,deny
  Allow localhost
</Location>

# Set the default printer/job policies...
<Policy default>
  # Job/subscription privacy...
  JobPrivateAccess default
  JobPrivateValues default
  SubscriptionPrivateAccess default
  SubscriptionPrivateValues default

  # Job-related operations must be done by the owner or an administrator...
  <Limit Create-Job Print-Job Print-URI Validate-Job>
    Order deny,allow
    Allow all
    AuthType Basic
    Require user @SYSTEM cups_print
  </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>

  # 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 CUPS-Get-Devices>
    AuthType Default
    Require user @SYSTEM
    Order deny,allow
  </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 Cancel-Jobs CUPS-Accept-Jobs CUPS-Reject-Jobs>
    AuthType Default
    Require user @CUPS_DEFAULT_PRINTOPERATOR_AUTH@
    Order deny,allow
  </Limit>

  # Only the owner or an administrator can cancel or authenticate a job...
  <Limit Cancel-Job CUPS-Authenticate-Job>
    Require user @OWNER @CUPS_DEFAULT_PRINTOPERATOR_AUTH@ cups_print
    AuthType Basic
    Order deny,allow
  </Limit>

  <Limit Get-Printer-Attributes>
    Order allow,deny
    Allow all
  </Limit>

  <Limit All>
    Order deny,allow
  </Limit>
</Policy>

# Set the authenticated printer/job policies...
<Policy authenticated>
  # Job/subscription privacy...
  JobPrivateAccess default
  JobPrivateValues default
  SubscriptionPrivateAccess default
  SubscriptionPrivateValues default

  # Job-related operations must be done by the owner or an administrator...
  <Limit Create-Job Print-Job Print-URI Validate-Job>
    AuthType Basic
    Require user @SYSTEM cups_print
    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>
    AuthType Default
    Require user @OWNER @SYSTEM
    Order deny,allow
  </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
  </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 Cancel-Jobs CUPS-Accept-Jobs CUPS-Reject-Jobs>
    AuthType Default
    Require user @CUPS_DEFAULT_PRINTOPERATOR_AUTH@
    Order deny,allow
  </Limit>

  # Only the owner or an administrator can cancel or authenticate a job...
  <Limit Cancel-Job CUPS-Authenticate-Job>
    AuthType Basic
    Require user @OWNER @CUPS_DEFAULT_PRINTOPERATOR_AUTH@ cups_print
    Order deny,allow
  </Limit>

  <Limit Get-Printer-Attributes>
    Order allow,deny
    Allow all
   </Limit>


  <Limit All>
    Order deny,allow
  </Limit>
</Policy>

Respuesta2

ADVERTENCIA

Para la versión de cups 2.2.1 y superiores, se eliminaron las directivas ServerCertificate y ServerKey utilizadas en cupsd.conf.

A menos que la directiva CreateSelfSignedCerts esté configurada en "no" en cups-files.conf, cups genera sus propios certificados autofirmados usando los nombres ${HOSTNAME}.crt y ${HOSTNAME}.key

La ruta predeterminada a los certificados sigue siendo el directorio cups_root + ssl, pero esto se puede cambiar usando la directiva ServerKeyChain en cups-files.conf.

Por lo tanto, si tiene sus propios certificados (autofirmados o firmados con autoridad), debe copiarlos al directorio SSL con los nombres ${HOSTNAME}.crt y ${HOSTNAME}.key; de lo contrario, la conexión https en el puerto 631 fallará y el allí /var/log/cups/error.log contiene numerosas líneas quejándose de no poder leer el archivo del certificado.

información relacionada