Added package imspector
authorSteven Barth <cyrus@openwrt.org>
Mon, 3 Nov 2008 19:27:06 +0000 (19:27 +0000)
committerSteven Barth <cyrus@openwrt.org>
Mon, 3 Nov 2008 19:27:06 +0000 (19:27 +0000)
SVN-Revision: 13107

net/imspector/Makefile [new file with mode: 0644]
net/imspector/files/imspector.config [new file with mode: 0644]
net/imspector/files/imspector.init [new file with mode: 0644]

diff --git a/net/imspector/Makefile b/net/imspector/Makefile
new file mode 100644 (file)
index 0000000..577febe
--- /dev/null
@@ -0,0 +1,85 @@
+# Copyright (C) 2007-2008 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+# $Id:$
+#
+# Author: Carlos Cesario
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=imspector
+PKG_VERSION:=0.7
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.imspector.org/downloads
+PKG_MD5SUM:=08f983f5cd54094dac51ab39fe1ae839
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/imspector
+       SECTION:=net
+       CATEGORY:=Network
+       TITLE:=IMSpector is an Instant Messenger proxy
+       URL:=http://www.imspector.org
+       DEPENDS:=+libopenssl +libstdcpp +libmysqlclient +libsqlite3 +libpq
+endef
+
+define Package/imspector/description
+       IMSpector is an Instant Messenger proxy with monitoring and blocking, and content-filtering capabilities.
+endef
+
+
+define Package/imspector/conffiles
+/etc/config/imspector
+endef
+
+define Build/Configure
+       (cd $(PKG_BUILD_DIR); \
+               sed -ie 's/#ADD_PLUGINS/ADD_PLUGINS/' Makefile \
+       );
+endef
+
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+           DESTDIR="$(PKG_INSTALL_DIR)" \
+           $(TARGET_CONFIGURE_OPTS) \
+           SSL_DIR="$(STAGING_DIR)/usr" \
+           SSL_LIBS="-L$(STAGING_DIR)/usr/lib -lssl -lcrypto" \
+           SSL_FLAGS="-I$(STAGING_DIR)/usr/include -DHAVE_SSL" \
+           SSL_OBJS=sslstate.o \
+           PREFIX="$(STAGING_DIR)/usr" \
+           CXX=$(TARGET_CXX) \
+           CXXFLAGS="$(TARGET_CXXFLAGS) $(TARGET_CFLAGS) $(FPIC) -I$(STAGING_DIR)/usr/include \
+                       -L$(STAGING_DIR)/usr/lib -DHAVE_SSL" \
+           all
+endef
+
+
+define Build/Install
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+           DESTDIR="$(PKG_INSTALL_DIR)" \
+           install
+endef
+
+define Package/imspector/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/imspector  $(1)/usr/sbin/imspector
+       $(INSTALL_DIR) $(1)/usr/lib/$(PKG_NAME)
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libimspector.so $(1)/usr/lib/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/$(PKG_NAME)/*.so $(1)/usr/lib/$(PKG_NAME)
+       $(INSTALL_DIR) $(1)/etc/$(PKG_NAME)
+       $(INSTALL_DIR) $(1)/etc/config
+       $(CP) ./files/imspector.config $(1)/etc/config/imspector 
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(CP) ./files/imspector.init $(1)/etc/init.d/imspector
+       $(CP) $(PKG_INSTALL_DIR)/usr/etc/$(PKG_NAME)/badwords.txt $(1)/etc/$(PKG_NAME)/
+       $(CP) $(PKG_INSTALL_DIR)/usr/etc/$(PKG_NAME)/acl.txt $(1)/etc/$(PKG_NAME)/
+       $(INSTALL_DIR) $(1)/var/log/$(PKG_NAME)
+       $(INSTALL_DIR) $(1)/var/lib/$(PKG_NAME)
+endef
+
+$(eval $(call BuildPackage,imspector))
diff --git a/net/imspector/files/imspector.config b/net/imspector/files/imspector.config
new file mode 100644 (file)
index 0000000..fe3835a
--- /dev/null
@@ -0,0 +1,100 @@
+config imspector
+       # Enable the proxy
+       option enable 1
+
+       # The listening ip address  for redirected connections
+       option listenaddr 0.0.0.0
+
+       # The listening port for redirected connections
+       option port 16667
+
+       # The HTTP CONNECT proxy port
+       option http_port 18080
+
+       #Sets the PID filename. The PID file is created before optionally dropping privs.
+       option pidfilename /var/run/imspector.pid
+
+       # This is the default location of protocol and logging plugins.
+       option plugin_dir /usr/lib/imspector/
+
+       # For dropping privs - you probably want to do this.
+       option user root
+       option group root
+
+       # SSL support?
+       # Create SSL Certs with the following command
+       # openssl req -new -newkey rsa:1024 -days 365 -nodes -x509 \
+       #       -keyout /etc/imspector/serverkey.pem \
+       #       -out /etc/imspector/servercert.pem
+
+       #option ssl on
+       #option ssl_key "/etc/imspector/serverkey.pem"
+
+       # Fixed cert?
+       #option ssl_cert "/etc/imspector/servercert.pem"
+
+       # Or certs created on-the-fly and signed against a CA
+       #option ssl_ca_key "/etc/imspector/cakey.pem"
+       #option ssl_ca_cert "/etc/imspector/cacert.pem"
+
+       # And finally a directory to store the created certs
+       #option ssl_cert_dir "/usr/lib/imspector"
+
+       # Directory of CA certs for IM server cert validation
+       #option ssl_verify_dir "/usr/lib/ssl/certs"
+
+       # Drop connection when the IM server has a bad cert
+       #option ssl_verify "block"
+
+       # Will load enabled plugins in plugin_dir
+       option icq_protocol on
+       option irc_protocol on
+       option msn_protocol on
+       option yahoo_protocol on
+       option gg_protocol on
+       option jabber_protocol on
+
+       # MSN via HTTP proxy needs https
+       option https_protocol on
+
+       # Log typing events?
+       option log_typing_events off
+
+       # Location where the file logging plugin will start from.
+       option file_logging_dir "/var/log/imspector"
+
+       # MySQL logging plugin stuff
+       #option mysql_server "localhost"
+       #option mysql_database "imspector"
+       #option mysql_username "imspector"
+       #option mysql_password "password"
+
+       # SQLite logging plugin stuff
+       #option sqlite_file "/etc/imspector/sqlitedb"
+
+       # PostgreSQL logging plugin stuff
+       #option pgsql_connect "host=localhost dbname=imspector user=dbuser password=Password"
+
+       # Bad words filtering
+       option badwords_filename "/etc/imspector/badwords.txt"
+       option badwords_replace_character "*"
+       option badwords_block_count 1
+
+       # ACL
+       option acl_filename "/etc/imspector/acl.txt"
+
+       # SQLite-backed filter
+       #option db_filter_filename "/etc/imspector/sqlitedb_filter"
+
+       # Block all non whitelisted events?
+       option block_unlisted off
+
+       # Block all filetransfers?
+       option block_files off
+
+       # Block webcams?
+       option block_webcams off
+
+       # Socket-API for filtering
+       #option censord off
+
diff --git a/net/imspector/files/imspector.init b/net/imspector/files/imspector.init
new file mode 100644 (file)
index 0000000..f9d069e
--- /dev/null
@@ -0,0 +1,59 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2008 OpenWrt.org
+START=50
+
+DAEMON=/usr/sbin/imspector
+CFGFILE=/var/etc/imspector.conf
+
+start() {
+       config_load imspector
+       config_foreach start_imspector imspector
+}
+
+stop() {
+       start-stop-daemon -q -x "$DAEMON" -K
+       rm -f $CFGFILE
+}
+
+restart() {
+       stop
+       sleep 2
+       start
+}
+
+start_imspector() {
+       config_get_bool enable "$1" enable
+       [ "$enable" -eq "1" ] || return 0
+
+       echo '### AUTOGENERATED CONFIGURATION' > $CFGFILE
+       echo '### DO NOT EDIT' >> $CFGFILE
+       echo '### SEE /etc/config/imspector INSTEAD' >> $CFGFILE
+       echo '' >> $CFGFILE
+
+       imspector_options='listenaddr port http_port pidfilename plugin_dir
+               user group ssl ssl_key ssl_cert icq_protocol irc_protocol 
+               msn_protocol yahoo_protocol gg_protocol jabber_protocol 
+               https_protocol log_typing_events  file_logging_dir 
+               badwords_filename badwords_replace_character badwords_block_count 
+               acl_filename db_filter_filename block_unlisted block_files block_webcams
+               mysql_server mysql_database mysql_username mysql_password
+               sqlite_file pgsql_connect censord'
+
+       
+       for option in $imspector_options; do
+               imspector_atom "$1" "$option" '"' >> $CFGFILE
+       done
+
+
+       start-stop-daemon -S -q -x "$DAEMON" -- -c "$CFGFILE"
+}
+
+imspector_atom() {
+       local SECTION=$1
+       local OPTION=$2
+
+       config_get _value "$SECTION" "$OPTION"
+       [ -n "$_value" -o "$EMPTY_DISABLED" -eq "1" ] && {
+               echo "$OPTION=${_value}"
+       }
+}