web-dev-qa-db-ja.com

CUPSの管理ページへのリモートアクセスを有効にする方法

CUPS Webインターフェイスの管理ページにアクセスしたいと思っています。

ページにアクセスでき、サイトの大部分を閲覧できますが、残念ながら、管理ページはリモートソースからロックされています。

私は設定しましたAllow from allも試しましたAllow allどこにでもアクセスできますが、それでもページにアクセスできません。

何が欠けていますか?

設定ファイル

#
#
# Sample configuration file for the CUPS scheduler.  See "man cupsd.conf" for a
# complete description of this file.
#

# Log general information in error_log - change "warn" to "debug"
# for troubleshooting...
LogLevel warn

# Deactivate CUPS' internal logrotating, as we provide a better one, especially
# LogLevel debug2 gets usable now
MaxLogSize 0

# Allow connection from remote hosts
Port 631
Listen /var/run/cups/cups.sock

# Show shared printers on the local network.
Browsing On
BrowseOrder allow,deny
BrowseAllow all
BrowseLocalProtocols all

# Default authentication type, when authentication is required...
DefaultAuthType Basic

# Web interface setting...
WebInterface Yes

# Restrict access to the server...
<Location />
  Order allow,deny
  Allow from all
</Location>

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

# Restrict access to configuration files...
<Location /admin/conf>
  AuthType Default
  Order allow,deny
  Allow from all
</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 from all
  </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
    Allow from all
  </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
    Allow from all
  </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 @SYSTEM
    Order deny,allow
    Allow from all
  </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
    Allow from all
  </Limit>

  <Limit All>
    Order deny,allow
    Allow from all
  </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 Default
    Order deny,allow
    Allow from all
  </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
    Allow from all
  </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
    Allow from all
  </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 @SYSTEM
    Order deny,allow
    Allow from all
  </Limit>

  # Only the owner or an administrator can cancel or authenticate a job...
  <Limit Cancel-Job CUPS-Authenticate-Job>
    AuthType Default
    Require user @OWNER @SYSTEM
    Order deny,allow
    Allow from all
  </Limit>

  <Limit All>
    Order deny,allow
    Allow from all
  </Limit>
</Policy>

Dockerfile

#
#   Add a Printer user
#
RUN useradd \
    --groups=Sudo,lp,lpadmin \
    --create-home \
    --home-dir=/home/print \
    --Shell=/bin/bash \
    print

#
#   Set the password for the printer user
#
RUN echo print:sdsds | chpasswd
3
David Gatti

私がやろうとしていることは、次のブロックの下</Policy> 鬼ごっこ:

<Location />
    Order allow,deny
    Allow localhost
    Allow from 192.168.0.*
    Allow from 10.0.*.*
</Location>

Listen 0.0.0.0:631

特に管理者アクセスの場合、Vanilla設定には通常次のものが含まれます。

<Location /admin/conf>
  AuthType Default
  Require user @SYSTEM
  Order allow,deny
</Location>

適切なユーザーアカウントを作成するには、lpadminグループのメンバーであるユーザーを作成する必要があります(管理セクションには何らかの認証が必要です):Sudo useradd -g lpadmin cupsadmin、次にパスワードを設定します。

参照 https://askubuntu.com/questions/387217/cups-admin-user-and-password-saucy

更新:以下は、@ DavidGattiによって最初に発生した問題を修正するための起点としても機能するはずです-元の構成ほど完全ではない/細かいわけではありませんが、ポリシー構成を再度追加できます。

ただし、この構成では@SYSTEMユーザーを使用せず、代わりに「ローカル」の有効なユーザーを受け入れます。構成のユースケースはDockerコンテナーでCUPSを実行しているため、CUPSへの管理者アクセスを提供するために、パスワードを持つユーザー以外に「特別な」ものを要求することは避けるのが最善のように思われました。

# Disable cups internal logging - use logrotate instead
MaxLogSize 0

# Log general information in error_log - change "warn" to "debug"
# for troubleshooting...
LogLevel warn
#PageLogFormat

Listen /run/cups/cups.sock
Listen 0.0.0.0:631
Port 631

# Show shared printers on the local network.
Browsing On
BrowseLocalProtocols dnssd

# Default authentication type, when authentication is required...
DefaultAuthType Basic

# Web interface setting...
WebInterface Yes

# Restrict access to the server...
# This config allow anyone access to the WUI
<Location />
  Order allow,deny
  Allow all
</Location>

# Restrict access to the admin pages...
# Allows anyone to try and access admin pages.
# Any local user's credentials will be accepted
<Location /admin>
  AuthType Basic
  Require valid-user
  Allow all
  Order allow,deny
</Location>

# Restrict access to configuration files...
# Any local user's credentials will be accepted
<Location /admin/conf>
  AuthType Basic
  Require valid-user
  Allow all
  Order allow,deny
</Location>

# Restrict access to log files...
# Any local user's credentials will be accepted
<Location /admin/log>
  AuthType Basic
  Require valid-user
  Allow all
  Order allow,deny
</Location>

Browsing On

認証付きのリモート印刷とローカル印刷なしのカップを構成する方法は?

4

私はあらゆる種類のソリューションを試しましたが、cupsd.confファイルを次のように変更するまで、ブラウザは常に「接続が拒否されました」というメッセージを返しました。

0.0.0.0:631ポート631をリッスンします

1
mum

これをドッカーイメージで構成可能にしたので( https://hub.docker.com/r/drpsychick/airprint-bridge )、これは私が使用したものです:

Listen *:631 cupsd.conf内

そして:

cupsctl WebInterface=yes
cupsctl --remote-admin --remote-any
# or
cupsctl --no-remote-admin

cupds.confとカップに話しかけます。

0
DrPsychick