CUPS WEB管理 配置

suzhouclark發表於2011-08-29
http://www.cublog.cn/u1/49474/showart_2035539.html[@more@]CUPS(以前Common Unix Printing System,UNIX通用列印系統 的縮寫)是一個類Unix作業系統的組合式印刷系統,允許一臺電腦作為列印伺服器。CUPS接受一個客戶端的電腦程式,並送到相應的印表機。

CUPS提供web-based管理介面和GNOME CUPS Manager兩種管理介面,Web-based管理介面執行在631埠可以同遠端瀏覽器進行管理,GNOME CUPS Manager提供在本地圖形化管理介面。

一、CUPS RPM安裝包

Redhat AS 5.3標準安裝以及內建了cups服務,具體的rpm如下:
rpm -qa |grep cup
cups-libs-1.2.4-11.5.el5
cups-1.2.4-11.5.el5
hal-cups-utils-0.6.2-5
libgnomecups-0.2.2-8

二、配置所有ip監聽631埠

Redhat AS 5.3的CUPS的web-based管理介面預設只能在本機執行與管理,如果在遠端開啟會出現無法開啟伺服器錯誤如下圖:

CUPS WEB管理 配置

出現無法顯示網頁的錯誤,是因為CUPS預設只監聽localhost,需要修改/etc/cups/cupsd.conf檔案,
Listen localhost:631 修改為 Listen *:631
然後重新啟動cups服務 service cups restart Stopping cups: [ OK ]
Starting cups: [ OK ]
執行 netstat -an |grep 631 命令驗證是否監聽所有ip的631
tcp 0 0 0.0.0.0:631 0.0.0.0:* LISTEN
tcp 0 0 210.34.80.51:631 210.34.80.188:4968 TIME_WAIT
tcp 0 0 210.34.80.51:631 210.34.80.188:4967 TIME_WAIT
tcp 0 0 :::631 :::* LISTEN
udp 0 0 0.0.0.0:631 0.0.0.0:*
有出現這一行“
udp 0 0 0.0.0.0:631 0.0.0.0:* ” 說明可以監聽所有ip地址了

三、配置允許遠端管理cups

在配置監聽所有ip的631埠,試圖再web管理cups時還會出現http 403 forbidden 禁止訪問的錯誤,錯誤如下圖:
CUPS WEB管理 配置

出現這個錯誤是因為cups模式不允許遠端管理,需要修改/etc/cups/cupsd.conf檔案,
找到/etc/cups/cupsd.conf配置檔案:

Order allow,deny
Allow localhost

# Restrict access to the admin pages...

Encryption Required
Order allow,deny
Allow localhost

# Restrict access to configuration files...

AuthType Basic
Require user @SYSTEM
Order allow,deny
Allow localhost

改成如下配置檔案:


Order allow,deny
Allow all

# Restrict access to the admin pages...

Encryption Required
Order allow,deny
Allow all

# Restrict access to configuration files...

AuthType Basic
Require user @SYSTEM
Order allow,deny
Allow all

然後重新啟動cups服務 service cups restart Stopping cups: [ OK ]
Starting cups: [ OK ]

接下來就可以開啟cups遠端管理介面:
CUPS WEB管理 配置

CUPS WEB管理 配置

四、cups的allow 語法

本文采用是開放式的配置,允許任何IP cups服務,如果想要安全加固cups的服務,只需要更改allow all的配置,allow允許的配置命令如下:


...
Allow from All
Allow from None
Allow from *.domain.com
Allow from .domain.com
Allow from host.domain.com
Allow from nnn.*
Allow from nnn.nnn.*
Allow from nnn.nnn.nnn.*
Allow from nnn.nnn.nnn.nnn
Allow from nnn.nnn.nnn.nnn/mm
Allow from nnn.nnn.nnn.nnn/mmm.mmm.mmm.mmm
Allow from xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx
Allow from @LOCAL
Allow from @IF(name)

=========================================================

=========================================================

CUPS: 426 – Upgrade Required

web 介面預設執行管理作業時會導到 ssl 頁面,如果不想用 ssl 只要帳號、密碼認證的話可以修改 /etc/cups/cupsd.conf,加入以下這行

DefaultEncryption IfRequested

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/9697/viewspace-1054521/,如需轉載,請註明出處,否則將追究法律責任。

相關文章