CUPS WEB管理 配置

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默认只监听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模式不允许远程管理,需要修改/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的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

请使用浏览器的分享功能分享到微信等