Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [code]# uname -a
- FreeBSD database_server 9.2-RELEASE FreeBSD 9.2-RELEASE #1: Tue Oct 22 11:11:35 EEST 2013 wagner@database_server:/usr/obj/usr/src/sys/DATABASE amd64
- # pkg_info
- ap22-mod_perl2-2.0.8,3 Embeds a Perl interpreter in the Apache2 server
- apache22-2.2.25 Version 2.2.x of Apache web server with prefork MPM.
- apr-1.4.8.1.5.2 Apache Portability Library
- aspell-0.60.6.1_2 Spelling checker with better suggestion logic than ispell
- autoconf-2.69 Automatically configure source code on many Un*x platforms
- autoconf-wrapper-20130530 Wrapper script for GNU autoconf
- bsdpan-Bit-Vector-7.3 Unknown perl module
- bsdpan-Carp-Clan-6.04 Unknown perl module
- bsdpan-DBI-1.628 DBI - Database independent interface for Perl
- bsdpan-Encode-Locale-1.03 Encode::Locale - Determine the locale encoding
- bsdpan-FCGI-0.74 Unknown perl module
- bsdpan-File-Listing-6.04 File::Listing - parse directory listing
- bsdpan-HTML-Parser-3.71 HTML::Parser - HTML parser class
- bsdpan-HTML-Tagset-3.20 HTML::Tagset - data tables useful in parsing HTML
- bsdpan-HTTP-Cookies-6.01 HTTP::Cookies - HTTP cookie jars
- bsdpan-HTTP-Daemon-6.01 HTTP::Daemon - a simple http server class
- bsdpan-HTTP-Date-6.02 HTTP::Date - date conversion routines
- bsdpan-HTTP-Message-6.06 HTTP::Message - HTTP style message (base class)
- bsdpan-HTTP-Negotiate-6.01 HTTP::Negotiate - choose a variant to serve
- bsdpan-IO-HTML-1.00 IO::HTML - Open an HTML file with automatic charset detecti
- bsdpan-IO-Interactive-0.0.6 IO::Interactive - Utilities for interactive I/O
- bsdpan-IO-stringy-2.110 IO-stringy - I/O on in-core objects like strings and arrays
- bsdpan-JSON-2.61 JSON - JSON (JavaScript Object Notation) encoder/decoder
- bsdpan-LWP-MediaTypes-6.02 LWP::MediaTypes - guess media type for a file or a URL
- bsdpan-Net-DNS-0.72 Net::DNS - Perl interface to the Domain Name System
- bsdpan-Net-HTTP-6.06 Net::HTTP - Low-level HTTP connection (client)
- bsdpan-Sub-Uplevel-0.24 Sub::Uplevel - apparently run a function in a higher stack
- bsdpan-TimeDate-2.30 Date::Parse - Parse date strings into time values
- bsdpan-URI-1.60 URI - Uniform Resource Identifiers (absolute and relative)
- bsdpan-WWW-RobotRules-6.02 WWW::RobotRules - database of robots.txt-derived permission
- bsdpan-libwww-perl-6.05 LWP - The World-Wide Web library for Perl
- cmake-2.8.11.2 Cross-platform Makefile generator
- fontconfig-2.10.95,1 XML-based font configuration API for X Windows
- freetype2-2.5.0.1 Free and portable TrueType font rendering engine
- gdbm-1.10 GNU database manager
- gmake-3.82_1 GNU version of 'make' utility
- help2man-1.43.3 Automatically generating simple manual pages from program o
- jbigkit-1.6 Lossless compression for bi-level images such as scanned pa
- jpeg-8_4 IJG's jpeg compression utilities
- libgd-2.1.0_1,1 A graphics library for fast creation of images
- libsigsegv-2.10 Handling page faults in user mode
- libtool-2.4.2_2 Generic shared library support script
- m4-1.4.17,1 GNU m4
- mysql55-client-5.5.34 Multithreaded SQL database (client)
- mysql55-server-5.5.34 Multithreaded SQL database (server)
- nginx-1.4.3,1 Robust and small WWW server
- otrs-3.2.10 Open Ticket Request System
- p5-Algorithm-Diff-1.1902 Perl interface to compute differences between two objects
- p5-Authen-SASL-2.16 Perl5 module for SASL authentication
- p5-BSD-Resource-1.2907 Perl module to access BSD resource limit and priority funct
- p5-Bit-Vector-7.3 Library of advanced math functions that includes a Perl OO
- p5-CSS-Minifier-XS-0.08 XS based CSS minifier
- p5-Carp-Clan-6.04 Report errors from perspective of caller of a "clan" of mod
- p5-Convert-BinHex-1.123 Perl module to extract data from Macintosh BinHex files
- p5-Crypt-PasswdMD5-1.3_1 Perl module that provides interoperable MD5-based crypt() f
- p5-DBD-mysql-4.024 MySQL driver for the Perl5 Database Interface (DBI)
- p5-DBI-1.628 The perl5 Database Interface. Required for DBD::* modules
- p5-Date-Pcalc-6.1 Gregorian calendar date calculations
- p5-Digest-HMAC-1.03 Perl5 interface to HMAC Message-Digest Algorithms
- p5-Digest-SHA-5.85 Perl extension for SHA-1/224/256/384/512
- p5-Email-Valid-1.192 Check validity of Internet email addresses
- p5-Encode-Locale-1.03 Determine the locale encoding
- p5-FCGI-0.74 Modules for perl5, for enabling FastCGI support in CGI scri
- p5-Filter-1.49 Number of source filters for perl5 programs
- p5-Font-TTF-1.02 Perl module for TrueType font hacking
- p5-GD-2.50 Perl5 interface to Gd Graphics Library version2
- p5-GD-Graph-1.48 Graph plotting module for perl5
- p5-GD-TextUtil-0.86_4 Text utilities for use with GD drawing package
- p5-GSSAPI-0.28 Perl extension providing access to the GSSAPIv2 library
- p5-IO-Interactive-0.0.6_1,1 Utilities for interactive I/O
- p5-IO-Socket-IP-0.24 Drop-in replacement for IO::Socket::INET supporting IPv4 an
- p5-IO-Socket-SSL-1.953 Perl5 interface to SSL sockets
- p5-IO-String-1.08 Simplified Perl5 module to handle I/O on in-core strings
- p5-IO-stringy-2.110 Perl5 module for using IO handles with non-file objects
- p5-JSON-2.59 Perl extension to convert to JSON (JavaScript Object Notati
- p5-JSON-XS-2.34 JSON serialising/deserialising, done correctly and fast
- p5-JavaScript-Minifier-XS-0.09 XS based JavaScript minifier
- p5-Locale-gettext-1.05_3 Message handling functions
- p5-MIME-Tools-5.504,2 Set of perl5 modules for MIME
- p5-Mail-POP3Client-2.19 Perl5 module to talk to a POP3 (RFC1939) server
- p5-Mail-Tools-2.12 Perl5 modules for dealing with Internet e-mail messages
- p5-Net-DNS-0.72 Perl5 interface to the DNS resolver, and dynamic updates
- p5-Net-Domain-TLD-1.70 Look up and validate TLDs
- p5-Net-SMTP-SSL-1.01_1 SMTP client supporting SSL
- p5-Net-SMTP-TLS-0.12_1 An SMTP client supporting TLS and AUTH
- p5-Net-SSLeay-1.55 Perl5 interface to SSL
- p5-PDF-API2-2.020 'The Next Generation' of Text::PDF::API
- p5-Socket-2.012 Networking constants and support functions
- p5-Text-CSV-1.32 Composition and decomposition of comma-separated values
- p5-Text-CSV_XS-1.01 Comma-separated values manipulation routines
- p5-Text-Diff-1.41 Text::Diff - Perform diffs on files and record sets
- p5-TimeDate-2.30_1,1 Perl5 module containing a better/faster date parser for abs
- p5-XML-FeedPP-0.43 Get an RSS file and parse it
- p5-XML-Parser-2.41_1 Perl extension interface to James Clark's XML parser, expat
- p5-XML-TreePP-0.41 Pure Perl implementation for parsing/writing xml files
- p5-YAML-0.84 YAML implementation in Perl
- p5-YAML-LibYAML-0.41 Perl YAML Serialization using XS and libyaml
- p5-common-sense-3.6 Perl common defaults with lower memory usage
- p5-libwww-6.05 Perl5 library for WWW access
- pcre-8.33 Perl Compatible Regular Expressions library
- perl-5.18.1_1 Practical Extraction and Report Language
- pkgconf-0.9.3 Utility to help to configure compiler and linker flags
- png-1.5.17 Library for manipulating PNG images
- tiff-4.0.3 Tools and library routines for working with TIFF images
- # pwd
- /usr/local/otrs/bin
- # ./otrs.CheckModules.pl
- o CGI..............................ok (v3.63)
- o Crypt::PasswdMD5.................ok (v1.3)
- o Crypt::SSLeay....................Not installed! (optional - Required for Generic Interface SOAP SSL connections.)
- o CSS::Minifier::XS................ok (v0.08)
- o Date::Format.....................ok (v2.24)
- o Date::Pcalc......................ok (v6.1)
- o DBI..............................ok (v1.628)
- o DBD::mysql.......................Not installed! (optional - Required to connect to a MySQL database.)
- o DBD::ODBC........................Not installed! (optional - Required to connect to a MS-SQL database.)
- o DBD::Oracle......................Not installed! (optional - Required to connect to a Oracle database.)
- o DBD::Pg..........................Not installed! (optional - Required to connect to a PostgreSQL database.)
- o Digest::MD5......................ok (v2.52)
- o Digest::SHA......................ok (v5.85)
- o Digest::SHA......................ok (v5.85)
- o Encode::HanExtra.................Not installed! (optional - Required to handle mails with several Chinese character sets.)
- o Encode::Locale...................ok (v1.03)
- o GD...............................ok (v2.50)
- o GD::Text.......................ok (v0.86)
- o GD::Graph......................ok (v1.48)
- o IO::Scalar.......................ok (v2.110)
- o IO::Wrap.........................ok (v2.110)
- o JavaScript::Minifier::XS.........ok (v0.09)
- o JSON.............................ok (v2.61)
- o JSON::PP.......................ok (v2.27202)
- o JSON::XS.......................Not installed! (optional - Recommended for faster AJAX/JavaScript handling.)
- o Locale::Codes....................ok (v3.25)
- o LWP::UserAgent...................ok (v6.05)
- o Mail::Internet...................ok (v2.12)
- o Mail::POP3Client.................ok (v2.19)
- o IO::Socket::SSL................ok (v1.953)
- o Mail::IMAPClient.................Not installed! (optional - Required for IMAP TLS connections.)
- o IO::Socket::SSL................ok (v1.953)
- o MIME::Base64.....................ok (v3.13)
- o MIME::Tools......................ok (v5.504)
- o ModPerl::Util....................ok (v2.000008)
- o Apache::DBI....................Not installed! (optional - Improves performance on Apache webservers with mod_perl by establishing persistent database connections.)
- o Apache2::Reload................ok (v0.12)
- o Net::DNS.........................ok (v0.72)
- o Net::POP3........................ok (v2.29)
- o Net::IMAP::Simple................Not installed! (optional - Required for IMAP connections.)
- o IO::Socket::SSL................ok (v1.953)
- o Net::SMTP........................ok (v2.31)
- o Authen::SASL...................ok (v2.16)
- o Net::SMTP::SSL.................ok (v1.01)
- o Net::SMTP::TLS::ButMaintained..Not installed! (optional - Required for TLS/SMTP connections.)
- o Net::LDAP........................Not installed! (optional - Required for directory authentication.)
- o Net::SSL.........................Not installed! (optional - Required for Generic Interface SOAP SSL connections.)
- o PDF::API2........................ok (v2.020)
- o Compress::Zlib.................ok (v2.060)
- o Storable.........................ok (v2.41)
- o SOAP::Lite.......................Not installed! (optional - Required for the SOAP interface.)
- o version........................ok (v0.9902)
- o Class::Inspector...............Not installed! (optional - Required for SOAP::Lite.)
- o Text::CSV........................ok (v1.32)
- o Text::CSV_PP...................ok (v1.31)
- o Text::CSV_XS...................ok (v1.01)
- o Time::HiRes......................ok (v1.9725)
- o XML::Parser......................ok (v2.41)
- o HTTP::Message....................ok (v6.06)
- o HTTP::Headers..................ok (v6.05)
- o URI..............................ok (v1.60)
- o URI::Escape....................ok (v3.31)
- o Scalar::Util.....................ok (v1.27)
- o YAML::XS.........................ok (v0.41)
- [/code]
- конфиги nginx и FCGI:
- [code]# cat /usr/local/etc/nginx/nginx.conf
- user www;
- worker_processes 1;
- #error_log logs/error.log;
- #error_log logs/error.log notice;
- #error_log logs/error.log info;
- #pid logs/nginx.pid;
- events {
- worker_connections 1024;
- }
- http {
- include mime.types;
- default_type application/octet-stream;
- #log_format main '$remote_addr - $remote_user [$time_local] "$request" '
- # '$status $body_bytes_sent "$http_referer" '
- # '"$http_user_agent" "$http_x_forwarded_for"';
- #access_log logs/access.log main;
- sendfile on;
- #tcp_nopush on;
- #keepalive_timeout 0;
- keepalive_timeout 65;
- #gzip on;
- server {
- listen 80;
- root /usr/local/otrs/var/httpd/htdocs;
- access_log /var/log/nginx/otrs.nginx_access.log;
- index index.html;
- location /otrs-web {
- gzip on;
- alias /usr/local/otrs/var/httpd/htdocs;
- }
- location ~ ^/otrs/(.*.pl)(/.*)?$ {
- gzip off; #gzip makes scripts feel slower since they have to complete before getting gzipped
- # fastcgi_pass unix:/.$1.sock;
- fastcgi_pass unix:/var/run/perl-fcgi.sock;
- # fastcgi_pass 127.0.0.1:8999;
- fastcgi_index index.pl;
- fastcgi_param SCRIPT_FILENAME /usr/local/otrs/bin/fcgi-bin/$1;
- fastcgi_param QUERY_STRING $query_string;
- fastcgi_param REQUEST_METHOD $request_method;
- fastcgi_param CONTENT_TYPE $content_type;
- fastcgi_param CONTENT_LENGTH $content_length;
- fastcgi_param GATEWAY_INTERFACE CGI/1.1;
- fastcgi_param SERVER_SOFTWARE nginx;
- fastcgi_param SCRIPT_NAME $fastcgi_script_name;
- fastcgi_param REQUEST_URI $request_uri;
- fastcgi_param DOCUMENT_URI $document_uri;
- fastcgi_param DOCUMENT_ROOT $document_root;
- fastcgi_param SERVER_PROTOCOL $server_protocol;
- fastcgi_param REMOTE_ADDR $remote_addr;
- fastcgi_param REMOTE_PORT $remote_port;
- fastcgi_param SERVER_ADDR $server_addr;
- fastcgi_param SERVER_PORT $server_port;
- fastcgi_param SERVER_NAME $server_name;
- }
- }
- # another virtual host using mix of IP-, name-, and port-based configuration
- #
- #server {
- # listen 8000;
- # listen somename:8080;
- # server_name somename alias another.alias;
- # location / {
- # root html;
- # index index.html index.htm;
- # }
- #}
- # HTTPS server
- #
- #server {
- # listen 443;
- # server_name localhost;
- # ssl on;
- # ssl_certificate cert.pem;
- # ssl_certificate_key cert.key;
- # ssl_session_timeout 5m;
- # ssl_protocols SSLv2 SSLv3 TLSv1;
- # ssl_ciphers HIGH:!aNULL:!MD5;
- # ssl_prefer_server_ciphers on;
- # location / {
- # root html;
- # index index.html index.htm;
- # }
- #}
- }
- [/code]
- FCGI:
- [code]# cat /usr/local/etc/rc.d/perl-fcgi.rc
- #!/bin/sh
- ### Rozhuk Ivan 2009.05
- ### startup script file for perl-fcgi
- ###
- # PROVIDE: perl_fcgi
- # REQUIRE: DAEMON
- # BEFORE: LOGIN
- # KEYWORD: shutdown
- . /etc/rc.subr
- name="perl_fcgi"
- rcvar=`set_rcvar`
- load_rc_config $name
- : ${perl_fcgi_enable="NO"}
- : ${perl_fcgi_pidfile="/var/run/perl-fcgi.pid"}
- : ${perl_fcgi_user="www"}
- : ${perl_fcgi_group="www"}
- : ${perl_fcgi_chdir=""}
- : ${perl_fcgi_chroot=""}
- : ${perl_fcgi_socket="127.0.0.1:9001"}
- : ${perl_fcgi_socketbacklog="10"}
- : ${perl_fcgi_socketmode="0777"}
- : ${perl_fcgi_children="5"}
- : ${perl_fcgi_childrentimeout="30"}
- : ${perl_fcgi_max_requests="1000"}
- : ${perl_fcgi_path_env="/bin:/usr/bin"}
- command="/usr/local/etc/perl-fcgi.pl"
- command_args="-d ${perl_fcgi_chdir} -s ${perl_fcgi_socket} -sb ${perl_fcgi_socket} -M ${perl_fcgi_socketmode} -F ${perl_fcgi_children} -Ft ${perl_fcgi_childrentimeout} -Fm ${perl_fcgi_max_requests} -P ${perl_fcgi_pidfile} -e ${perl_fcgi_path_env}"
- procname="perl-fcgi-pm"
- pidfile="${perl_fcgi_chroot}${perl_fcgi_pidfile}"
- required_dirs=${perl_fcgi_chroot}
- start_precmd="${name}_start_precmd"
- stop_postcmd="${name}_stop_postcmd"
- perl_fcgi_start_precmd()
- {
- touch ${perl_fcgi_chroot}${pidfile}
- chown ${perl_fcgi_user}:${perl_fcgi_group} ${perl_fcgi_chroot}${pidfile}
- }
- perl_fcgi_stop_postcmd()
- {
- rm -f ${pidfile}
- }
- run_rc_command "$1"
- # cat /etc/rc.conf
- hostname="database_server"
- #ifconfig_re0="DHCP"
- ifconfig_re0=" inet 172.20.1.253 netmask 255.255.255.0"
- defaultrouter="172.20.1.254"
- sshd_enable="YES"
- ntpd_enable="YES"
- #powerd_enable="YES"
- # Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable
- dumpdev="NO"
- mysql_enable="YES"
- jail_enable="YES"
- jail_list="test"
- jail_test_rootdir="/home/jails/jail_database/" # jail's root directory
- jail_test_hostname="database_jail" # jail's hostname
- jail_test_ip="172.20.1.252" # jail's IP address
- jail_interface="lo0"
- perl_fcgi_enable="YES"
- perl_fcgi_pidfile="/var/run/perl-fcgi.pid"
- perl_fcgi_user="www"
- perl_fcgi_group="www"
- perl_fcgi_chdir="/usr/local/otrs/bin/fcgi-bin/"
- perl_fcgi_chroot=""
- perl_fcgi_socket="/tmp/perl-fcgi.sock"
- perl_fcgi_socketbacklog="100"
- perl_fcgi_socketmode="0777"
- perl_fcgi_children="2"
- perl_fcgi_childrentimeout="10"
- perl_fcgi_max_requests="10000"
- perl_fcgi_path_env="/bin:/usr/bin"
- # cat /usr/local/etc/perl-fcgi.pl
- #!/usr/bin/perl -w
- use strict;
- use warnings;
- use FCGI; # /usr/ports/www/p5-FastCGI
- use FCGI::ProcManager qw(pm_manage pm_pre_dispatch pm_post_dispatch); # /usr/ports/www/p5-FCGI-ProcManager
- use Socket;
- use POSIX qw(setsid setuid);
- use Getopt::Long;
- require 'sys/syscall.ph';
- # settings
- my ($CURRENT_DIR,$SOCKET_ADDRESS,$SOCKET_BACKLOG,$SOCKET_MODE,$CHILDRENS_COUNT,$CHILDRENS_TIMEOUT,$CHILDRENS_MAX_REQ,$PIDFILE,$PATHENV);
- # global variables
- &startpoint();
- #this keeps the program alive or something after exec'ing perl scripts
- END() { }
- BEGIN() { }
- {no warnings; *CORE::GLOBAL::exit = sub { die "fakeexit\nrc=".shift()."\n"; }; };
- eval q{exit};
- if ($@) { exit unless $@ =~ /^fakeexit/; };
- sub startpoint()
- {
- if ($#ARGV!=-1)
- {
- $CURRENT_DIR ='/';
- #$SOCKET_ADDRESS ='';
- $SOCKET_BACKLOG =10;
- $SOCKET_MODE =0777;
- $CHILDRENS_COUNT =2;
- $CHILDRENS_TIMEOUT =30;
- $CHILDRENS_MAX_REQ =100;
- #$PIDFILE ='';
- #$PATHENV ='/bin:/usr/bin';
- GetOptions( 'd:s' => \$CURRENT_DIR,
- 's=s' => \$SOCKET_ADDRESS,
- 'sb:i' => \$SOCKET_BACKLOG,
- 'M:i' => \$SOCKET_MODE,
- 'F:i' => \$CHILDRENS_COUNT,
- 'Ft:i' => \$CHILDRENS_TIMEOUT,
- 'Fm:i' => \$CHILDRENS_MAX_REQ,
- 'P:s' => \$PIDFILE,
- 'e:s' => \$PATHENV,
- );
- if (!defined($SOCKET_ADDRESS)) {usage();}
- # untainte input
- if ($SOCKET_ADDRESS =~ /^(.*)$/) {$SOCKET_ADDRESS = $1;}
- if (defined($PIDFILE)) {if ($PIDFILE =~ /^(.*)$/) {$PIDFILE = $1;}}
- if (defined($PATHENV))
- {
- if ($PIDFILE =~ /^(.*)$/) {$PIDFILE = $1;}
- }else{
- $PATHENV='/bin:/usr/bin';
- }
- #print "SOCKET_ADDRESS: $SOCKET_ADDRESS SOCKET_BACKLOG: $SOCKET_BACKLOG CHILDRENS_COUNT: $CHILDRENS_COUNT CHILDRENS_TIMEOUT: $CHILDRENS_TIMEOUT PIDFILE: $PIDFILE\n";
- daemonize();
- }else{
- usage();
- }
- }
- sub usage
- {
- print "Usage: perl-fcgi [options]\n\n";
- print " -d <directory> chdir to directory before spawning (default /)\n";
- print " -s <address/path> unix socket or tcp address:port\n";
- print " -sb <size> socket backlog size (default 10)\n";
- print " -M <mode> change Unix domain socket mode (default 0777)\n";
- print " -F <children> number of children to fork (default 2)\n";
- print " -Ft <timeout> children process timeout (default 30)\n";
- print " -Fm <num> children process max requests (default 100)\n";
- print " -P <path> name of PID-file for spawned process\n";
- print " -e <path> set new PATH environment (default /bin:/usr/bin)\n";
- #print "(root only)\n";
- #print " -c <directory> chroot to directory (default /)\n";
- #print " -S create socket before chroot() (default is to create the socket in the chroot)\n";
- #print " -u <user> change to user-id\n";
- #print " -g <group> change to group-id (default: primary group of user if -u is given)\n";
- #print " -U <user> change Unix domain socket owner to user-id\n";
- #print " -G <group> change Unix domain socket group to group-id\n";
- exit;
- }
- sub daemonize()
- {
- delete @ENV{qw(IFS CDPATH ENV BASH_ENV)}; # Make %ENV safer
- $ENV{'PATH'} = $PATHENV; # set new path environment
- chdir $CURRENT_DIR or die "Can't chdir to $CURRENT_DIR: $!\n";
- #setuid(65534) or die "Can't set uid: $!\n"; # nobody
- open(STDIN, "+>/dev/null") or die "Can't open STDIN: $!\n";
- open(STDOUT, "+>&STDIN") or die "Can't open STDOUT: $!\n";
- open(STDERR, "+>&STDIN") or die "Can't open STDERR: $!\n";
- defined(my $tm = fork) or die "Can't fork: $!\n";
- exit if $tm;
- setsid or die "Can't start a new session: $!\n";
- umask 0;
- main();
- }
- sub main
- {
- my ($ListenSocket);
- my ($proc_manager,$request,%req_params);
- $ListenSocket = FCGI::OpenSocket( $SOCKET_ADDRESS, $SOCKET_BACKLOG );
- if (defined($ListenSocket))
- {
- if (defined($PIDFILE))
- {
- open FILE, "> $PIDFILE" or die $!;
- print FILE "$$\n";
- close FILE;
- }
- if (substr($SOCKET_ADDRESS,0,1) eq '/')
- {
- print "chmod($SOCKET_MODE,$SOCKET_ADDRESS)\n";
- chmod(oct($SOCKET_MODE),$SOCKET_ADDRESS);
- }
- $proc_manager = FCGI::ProcManager->new({ n_processes => $CHILDRENS_COUNT, die_timeout => $CHILDRENS_TIMEOUT });
- $request = FCGI::Request( \*STDIN, \*STDOUT, \*STDERR, \%req_params, $ListenSocket, &FCGI::FAIL_ACCEPT_ON_INTR );
- $proc_manager->pm_manage();
- if ($request) { request_loop(\$proc_manager,\$request,\%req_params) };
- FCGI::CloseSocket( $ListenSocket );
- if (substr($SOCKET_ADDRESS,0,1) eq '/') {unlink($SOCKET_ADDRESS);}
- if (defined($PIDFILE)) {unlink($PIDFILE);}
- }
- }
- sub request_loop()
- {
- my ($proc_manager_ref)=$_[0];
- my ($request_ref)=$_[1];
- my ($req_params_ref)=$_[2];
- my ($stdin_passthrough,$req_len,$key,$pid_child,$req_count);
- $req_count=1;
- while( $$request_ref->Accept() >= 0 )
- {
- $$proc_manager_ref->pm_pre_dispatch();
- #processing any STDIN input from WebServer (for CGI-POST actions)
- $stdin_passthrough ='';
- { no warnings; $req_len = 0 + $$req_params_ref{'CONTENT_LENGTH'}; };
- if (($$req_params_ref{'REQUEST_METHOD'} eq 'POST') && ($req_len != 0) )
- {
- my $bytes_read = 0;
- while ($bytes_read < $req_len)
- {
- my $data = '';
- my $bytes = read(STDIN, $data, ($req_len - $bytes_read));
- last if ($bytes == 0 || !defined($bytes));
- $stdin_passthrough .= $data;
- $bytes_read += $bytes;
- }
- }
- #running the cgi app
- if ( (-x $$req_params_ref{SCRIPT_FILENAME}) && #can I execute this?
- (-s $$req_params_ref{SCRIPT_FILENAME}) && #Is this file empty?
- (-r $$req_params_ref{SCRIPT_FILENAME}) #can I read this file?
- ){
- pipe(CHILD_RD, PARENT_WR);
- $pid_child = open(KID_TO_READ, "-|");
- unless(defined($pid_child))
- {
- print("Content-type: text/plain\r\n\r\n");
- print "Error: CGI app returned no output - Executing $$req_params_ref{SCRIPT_FILENAME} failed !\n";
- next;
- }
- if ($pid_child > 0)
- {
- close(CHILD_RD);
- print PARENT_WR $stdin_passthrough;
- close(PARENT_WR);
- while(my $s = <KID_TO_READ>) { print $s; }
- close KID_TO_READ;
- waitpid($pid_child, 0);
- }else{
- foreach $key ( keys %{$req_params_ref}){ $ENV{$key} = $$req_params_ref{$key}; }
- # cd to the script's local directory
- if ($$req_params_ref{SCRIPT_FILENAME} =~ /^(.*)\/[^\/]+$/) { chdir $1;}
- close(PARENT_WR);
- close(STDIN);
- #fcntl(CHILD_RD, F_DUPFD, 0);
- syscall(&SYS_dup2, fileno(CHILD_RD), 0);
- #open(STDIN, "<&CHILD_RD");
- exec($$req_params_ref{SCRIPT_FILENAME});
- die("exec failed");
- }
- }else{
- print("Content-type: text/plain\r\n\r\n");
- print "Error: No such CGI app - $$req_params_ref{SCRIPT_FILENAME} may not exist or is not executable by this process.\n";
- }
- $req_count++;
- exit if $req_count > $CHILDRENS_MAX_REQ;
- $$proc_manager_ref->pm_post_dispatch();
- }
- }
- [/code]
- Доброго времени суток. О сабже:
- [code]# cgi-bin/installer.pl
- [Wed Oct 23 09:22:11 2013] HTMLUtils.pm: In '(?...)', splitting the initial '(?' is deprecated in regex; marked by <-- HERE in m/
- [Wed Oct 23 09:22:11 2013] HTMLUtils.pm: ( # $1 greater-than and less-than sign
- [Wed Oct 23 09:22:11 2013] HTMLUtils.pm: > | < | \s+ | \#{6} |
- [Wed Oct 23 09:22:11 2013] HTMLUtils.pm: (?: &[a-zA-Z0-9]+; ) # get html entities
- [Wed Oct 23 09:22:11 2013] HTMLUtils.pm: )
- [Wed Oct 23 09:22:11 2013] HTMLUtils.pm: ( # $2
- [Wed Oct 23 09:22:11 2013] HTMLUtils.pm: (?: # http or only www
- [Wed Oct 23 09:22:11 2013] HTMLUtils.pm: (?: (?: http s? | ftp ) :\/\/) | # http://,https:// and ftp://
- [Wed Oct 23 09:22:11 2013] HTMLUtils.pm: (?: (?: www | ftp ) \.) # www. and ftp.
- [Wed Oct 23 09:22:11 2013] HTMLUtils.pm: )
- [Wed Oct 23 09:22:11 2013] HTMLUtils.pm: )
- [Wed Oct 23 09:22:11 2013] HTMLUtils.pm: ( # $3
- [Wed Oct 23 09:22:11 2013] HTMLUtils.pm: (?: [a-z0-9\-]+ \. )* # get subdomains, optional
- [Wed Oct 23 09:22:11 2013] HTMLUtils.pm: [a-z0-9\-]+ # get top level domain
- [Wed Oct 23 09:22:11 2013] HTMLUtils.pm: (?: # file path element
- [Wed Oct 23 09:22:11 2013] HTMLUtils.pm: [\/\.]
- [Wed Oct 23 09:22:11 2013] HTMLUtils.pm: | [a-zA-Z0-9\-]
- [Wed Oct 23 09:22:11 2013] HTMLUtils.pm: )*
- [Wed Oct 23 09:22:11 2013] HTMLUtils.pm: (?: # param string
- [Wed Oct 23 09:22:11 2013] HTMLUtils.pm: [\?] # if param string is there, "?" must be present
- [Wed Oct 23 09:22:11 2013] HTMLUtils.pm: [a-zA-Z0-9&;=%]* # param string content, this will also catch entities like &
- [Wed Oct 23 09:22:11 2013] HTMLUtils.pm: )?
- [Wed Oct 23 09:22:11 2013] HTMLUtils.pm: (?: # link hash string
- [Wed Oct 23 09:22:11 2013] HTMLUtils.pm: [\#] #
- [Wed Oct 23 09:22:11 2013] HTMLUtils.pm: [a-zA-Z0-9&;=%]* # hash string content, this will also catch entities like &
- [Wed Oct 23 09:22:11 2013] HTMLUtils.pm: )?
- [Wed Oct 23 09:22:11 2013] HTMLUtils.pm: )
- [Wed Oct 23 09:22:11 2013] HTMLUtils.pm: ( # $4
- [Wed Oct 23 09:22:11 2013] HTMLUtils.pm: ? <-- HERE =(?:
- [Wed Oct 23 09:22:11 2013] HTMLUtils.pm: [\?,;!\.\)] (?: \s | $ ) # \)\s this construct is because of bug# 2450
- [Wed Oct 23 09:22:11 2013] HTMLUtils.pm: | \"
- [Wed Oct 23 09:22:11 2013] HTMLUtils.pm: | \]
- [Wed Oct 23 09:22:11 2013] HTMLUtils.pm: | \s+
- [Wed Oct 23 09:22:11 2013] HTMLUtils.pm: | '
- [Wed Oct 23 09:22:11 2013] HTMLUtils.pm: | > # greater-than and less-than sign
- [Wed Oct 23 09:22:11 2013] HTMLUtils.pm: | < # "
- [Wed Oct 23 09:22:11 2013] HTMLUtils.pm: | (?: &[a-zA-Z0-9]+; )+ # html entities
- [Wed Oct 23 09:22:11 2013] HTMLUtils.pm: | $ # bug# 2715
- [Wed Oct 23 09:22:11 2013] HTMLUtils.pm: )
- [Wed Oct 23 09:22:11 2013] HTMLUtils.pm: | \#{6} # ending LinkHash
- [Wed Oct 23 09:22:11 2013] HTMLUtils.pm: )
- [Wed Oct 23 09:22:11 2013] HTMLUtils.pm: / at /usr/local/otrs/bin/cgi-bin/../../Kernel/System/HTMLUtils.pm line 865.
- [Wed Oct 23 09:22:11 2013] installer.pl: Use of uninitialized value in shmctl at /usr/local/otrs/bin/cgi-bin/../../Kernel/System/Log.pm line 277.
- ERROR: OTRS-CGI-10 Perl: 5.18.1 OS: freebsd Time: Wed Oct 23 09:22:11 2013
- Message: Can't remove shm for log: Function not implemented
- Traceback (812):
- Module: Kernel::System::Log::CleanUp (OTRS 3.2.10) Line: 278
- Module: Kernel::System::Log::new (OTRS 3.2.10) Line: 99
- Module: Kernel::System::Web::InterfaceInstaller::new (OTRS 3.2.10) Line: 78
- Module: cgi-bin/installer.pl (unknown version) Line: 38
- [Wed Oct 23 09:22:11 2013] installer.pl: Use of uninitialized value in shmread at /usr/local/otrs/bin/cgi-bin/../../Kernel/System/Log.pm line 254.
- Function not implemented at /usr/local/otrs/bin/cgi-bin/../../Kernel/System/Log.pm line 254.
- [/code]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement