![Windows マシンでの認証と SSL 接続の問題を伴う CUPS 共有プリンター](https://rvso.com/image/1601182/Windows%20%E3%83%9E%E3%82%B7%E3%83%B3%E3%81%A7%E3%81%AE%E8%AA%8D%E8%A8%BC%E3%81%A8%20SSL%20%E6%8E%A5%E7%B6%9A%E3%81%AE%E5%95%8F%E9%A1%8C%E3%82%92%E4%BC%B4%E3%81%86%20CUPS%20%E5%85%B1%E6%9C%89%E3%83%97%E3%83%AA%E3%83%B3%E3%82%BF%E3%83%BC.png)
Windows 10 または 7 でプリンターを接続する際に問題が発生しています。Debian では、基本認証タイプでも HTTPS でも、すべて正常に動作します。cups_print ユーザーを作成し、passwd コマンドでパスワードを割り当てました。認証と TLS/SSL を無効にしてみましたが、それらなしでも Windows ステーションは、CUPS が動作している Raspi に接続されている HP P1006 に接続できます。また、Require valid-user も試しましたが、このオプションを使用すると、ユーザー名: "aa"、パスワード: "randompassword" など、任意の資格情報で印刷できます。SSL 接続時にポート 631 で listen しようとしましたが、Windows では成功しませんでしたが、Linux ではすべてのオプションで正常に動作します。
私は次の方法で Windows で IPP URL を設定しようとしました:
https://192.168.X.132:632/プリンター/HP_LaserJet_P1006
https://cups_print:[メールアドレス]:632/プリンター/HP_LaserJet_P1006
https://[メールアドレス]:632/プリンター/HP_LaserJet_P1006
http://[メールアドレス]:631/プリンター/HP_LaserJet_P1006
http://192.168.X.132:631/プリンタ/HP_LaserJet_P1006
http://cups_print:[メールアドレス]:631/プリンター/HP_LaserJet_P1006
また、cupsd.conf が認証なしで構成されているときにプリンタを追加しようとしました。その後、オプションをオンにして再起動し、ポート編集を介して Windows に資格情報を提供しました。これも成功しませんでした。Web インターフェイスを介して、任意の Windows ステーションの cups 構成にアクセスできます。Windows の問題のようですが、そうでない場合は、解決策を提案してください。ホーム ネットワークですべてを保護したいと考えています。
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
答え1
この問題に1週間悩んだ後、回避策を見つけました。
Windows 10 1903 アップデートでは、認証付きプリンターの追加に問題があります。プリンターを追加する前に、まずポートを設定する必要があります。その後は問題なく追加できます。編集して実行できる便利なスクリプトはここにあります。
または、レジスターを構成することで手動で追加することもできます。2 番目のリンクを参照してください。ポートとプリンターの追加に成功したら (資格情報の入力を求められることはありません)、プリンター設定、ポート設定に進み、提供された資格情報を使用してポートを構成します。資格情報がないと、印刷できません。
次に、cupsd.conf の「/」や「/printers」も含め、すべての場所へのアクセスを認証なしで許可する必要があります。その後、ポリシー制限を作成し<Limit Get-Printer-Attributes>
、そこでは認証をまったく必要としません。次に、およびで認証を有効にし<Limit Cancel-Job CUPS-Authenticate-Job>
ます<Limit Create-Job Print-Job Print-URI Validate-Job>
。
自己署名証明書を使用する場合は、次のリンクに従ってください。 Windows に自己署名証明書を追加するこの証明書を「信頼されたルートサードパーティ証明書」に追加することを忘れないでください。
WindowsにIPPプリンターを追加するときに直面する問題のいくつかの原因 Cups 認証の問題 Windows Cups 認証の問題 Windows
私の cupsd.conf(匿名化)
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>
答え2
警告
cups 2.2.1 以降のバージョンでは、cupsd.conf で使用される ServerCertificate および ServerKey ディレクティブは廃止されました。
cups-files.conf で CreateSelfSignedCerts ディレクティブが "no" に設定されていない限り、cups は ${HOSTNAME}.crt と ${HOSTNAME}.key という名前を使用して独自の自己署名証明書を生成します。
証明書へのデフォルトのパスは cups_root + ssl ディレクトリのままですが、cups-files.conf の ServerKeyChain ディレクティブを使用して変更できます。
したがって、独自の証明書(自己署名または権限のある署名)がある場合は、それらを ${HOSTNAME}.crt および ${HOSTNAME}.key という名前で ssl ディレクトリにコピーする必要があります。そうしないと、ポート 631 の https 接続が失敗し、/var/log/cups/error.log に、証明書ファイルを読み取れないというエラーを示す多数の行が含まれます。