Table of Contents
edit /etc/httpd/conf/httpd.conf
DocumentRoot "/www/aoe-html" # # This should be changed to whatever you set DocumentRoot to. # <Directory "/www/aoe-html">
edit /etc/php.ini
include_path = ".:/www/common:/www/aoe-html"
yum install httpd yum install httpd-devel apr-devel mysql-client mysql-devel mod_perl yum install mod_ssl yum install php yum install php-mysql yum install mysql mysql-devel mysql-server
these are recommended by http://www.howtoforge.com/centos-5.1-server-lamp-email-dns-ftp-ispconfig
yum info php php-devel php-gd php-imap php-ldap php-mysql php-odbc php-pear php-xml php-xmlrpc curl curl-devel perl-libwww-perl ImageMagick libxml2 libxml2-devel
I just installed this from the list above:
yum install php-mysql
edit /etc/my.cnf and add option skip-networking:
vi /etc/my.cnf #skip-networking
copy the database directory /var/lib/mysql:
[root@bacchus ~]# cd /var/lib [root@bacchus ~]# tar -cvf mysql.tar mysql/ [root@bacchus ~]#
scp the file to /var/lib
[root@webtest alumni]# cd /var/lib [root@webtest lib]# tar -xvf mysql.tar
Delete the tar
edit /etc/php.ini
include_path = ".:/www/common:/www/aoe-html" memory_limit = 128M ; Maximum amount of memory a script may consume register_globals = On register_argc_argv = On
Start the services!
service mysqld start service httpd start
install the image processing (GD)
yum install php-gd
Pages modified
/index.php
- added newsblock
- removed hard links to http://www.aoe.vt.edu and replaced with /…
/news.index.php
- removed hard link to http://www.aoe.vt.edu/calendars/… with /calendars/…
/www/common/include/head_foot.inc.php
- removed hard links to http://www.aoe.vt.edu/…
/www/people/
- replaced index.php with indexNew.php
/www/common/include/head_foot.inc.php
- added gateway-horizontal template code
- search inserted to just before END HEADER close div tag so it will be on the unit_header image. (after line 58 of original gateway-horizontal.
- BEGIN SEARCH to END SEARCH commented out. (lines 67-87)
- <div id=“main”>, <div id=“content”> moved to after sub-header for
php test codes
<HTML> <HEAD><TITLE>PHP INFO</TITLE></HEAD> <BODY> <?php phpinfo(); ?> <hr> <?php var_dump(gd_info()); ?> <hr> <?php var_dump($HTTP_GET_VARS); ?> <hr> <?php var_dump($_GET); ?> </BODY> </HTML>
htaccess password protect pages
for http://www.aoe.vt.edu/~stedwar1/test
## make sure nobody gets the htaccess files
<Files ~ "^[\._]ht">
Order allow,deny
Deny from all
Satisfy All
</Files>
## change to secure pages
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
## password protect the page and change to secure page for transmission of password
SSLRequireSSL
ErrorDocument 403 https://www.aoe.vt.edu/~stedwar1/test/index.html
AuthUserFile /path to /.htpasswd
AuthName Steve
AuthType Basic
require valid-user
## the following can specify users in the .htpasswd file
# require user stedwar1
# require user lscharf
## Restrict and deny access to ip addresses, or domain names
## vt.edu only works if DNS returns a hostname and domain name
Order allow,deny
Allow from vt.edu
#Allow from 128.173.
Allow from 198.82.
#Deny from rougedomain.vt.edu
Reset MySQL root password
http://www.cyberciti.biz/faq/mysql-reset-lost-root-password/
/etc/init.d/mysqld stop vi /root/mysql.reset.sql
UPDATE mysql.user SET Password=PASSWORD('YOUR-NEW-MYSQL-PASSWORD') WHERE User='root';
FLUSH PRIVILEGES;
mysqld_safe --init-file=/root/mysql.reset.sql & killall mysqld /etc/init.d/mysqld start
update from 4 to 5
mysql_upgrade -u root -p
logstalgia
ssh user@webhost.com tail -f /home/user/logs/http/access.log | logstalgia -
online ldaps
yum install openldap-devel cyrus-sasl-devel
Add these lines to /etc/openldap/ldap.conf
TLS_CACERT /etc/openldap/cachain_edauth.pem TLS_CACERTDIR /etc/openldap/cacerts
Add this file: /etc/openldap/cachain_edauth.pem contents here:http://www.pki.vt.edu/gettingstarted/vtc1sca/vtca_cachain.pem
-----BEGIN CERTIFICATE----- MIIGMTCCBBmgAwIBAgIBADANBgkqhkiG9w0BAQUFADBVMQswCQYDVQQGEwJVUzER MA8GA1UECBMIVmlyZ2luaWExEzARBgNVBAcTCkJsYWNrc2J1cmcxHjAcBgNVBAoT FVZpcmdpbmlhIFRlY2ggUm9vdCBDQTAeFw0wMzA0MTAxOTI3NDlaFw0zMzA0MDI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jqDo20voxmOrbdeb/jKwh33q5dRlIHm+ C1jv3l/7v3r3kmbLBRksmxN+gurbqm8PPn7OZ45IuGHdn98D8ndxpjIpYxk1EqOA pHk0ED0ue8RnBeZaxdHPtbpE6rUDwTWnzvV5ZcZHs41pBERicjqt/l7+vicnfUbA DaZ8PHCFlUufQsQsy+X6xSL2RyP+6I3Hw1cqH1MB9isafLE9zxsnNAh5dvl4HwFt 6hTpWlx62eOyeE1oNrSbro2SIj+Km89FO6RzB3DuXtihCwSvEMr7aHI0uhv9UEUd 7pD4lled/swk7qg= -----END CERTIFICATE-----
LimitExcept
AuthType Basic AuthName "Restricted Directory" AuthUserFile /web/users AuthGroupFile /web/groups Require group admin
<LimitExcept POST GET> Require valid-user </LimitExcept>
disable php files
<Files ~".*\.php$"> Order deny,allow Deny from all </Files>
Automating the RSS Feeds
Notes for Updating the RSS feed with a summary and automatically writing the information to the RSS file.
First the summary field has to be added in the newsadmin.php file. This also has to be added to the editnews.php
file.
The following code added the field:
newsadmin.php:
<tr><th align="right">Summary for RSS<br><font size="1">(text or html)</font></th>
<td><textarea name="summary" cols="70" rows="10"></textarea>
</td></tr>
editnews.php:
<tr><th align="right">Summary for RSS<br><font size="1">(text or html)</font></th>
<td><textarea name="summary" cols="70" rows="10"><?php echo $myrow[5]?></textarea>
</td></tr>
Now create a column in the database for the summary field.
mysql -p -u root
use newsdb;
alter table news add summary text;
alter table news add updated int(1);
Add the lines in addnews.php and updatenews.php to write the summary section into the database:
updatenews.php
$sql = "UPDATE news SET date='$date', title='$title', content='$content', summary='$summary',imageurl='$imageurl', updated='1'";
addnews.php
$sql = "INSERT INTO news(date,title,content,summary,imageurl)";
$sql .= " values('$date', '$title', '$content', '$summary', '$imageurl')";
Create a file in /common/include called writerss.inc.php
Here are the contents of the file:
<?php
#include_once("include/aoe_mysql.inc.php");
#This recreates the rss feed by opening the old rss feed file in write mode, delete it's contents,
#then looping the database and recreating the file.
#Author: Jason Salyers
#Date: 06/05/2009
function recreate_rss_feed()
{
$fp = fopen( "/www/aoe-html/news/aoerssfeed2.rss", w );
#Write the beginning of the rss file
fwrite( $fp, "<?xml version=\"1.0\" ?>\n");
fwrite( $fp, "<rss version=\"2.0\">\n");
fwrite( $fp, "\n\n" );
fwrite( $fp, "<channel>\n");
fwrite( $fp, "<title>AOE News Page</title>\n" );
fwrite( $fp, "<link>\n" );
fwrite( $fp, "http://www.aoe.vt.edu/news/news.php\n");
fwrite( $fp, "</link>\n\n");
fwrite( $fp, "<description>AOE News</description>\n\n\n");
#Loop the data base and write each article
$db = aoe_mysql_connect_rw();
mysql_select_db("newsdb", $db );
$sql = "SELECT * FROM news order by date desc, id desc";
$result = mysql_query($sql,$db);
while ( $myrow = mysql_fetch_row($result)) {
fwrite( $fp, "<item>\n" );
fwrite( $fp, "<title>$myrow[2]</title>\n");
fwrite( $fp, "<link>http://www.aoe.vt.edu/news/news.php</link>\n");
fwrite( $fp, "<description>$myrow[5]</description>\n");
$st = $myrow[1];
$updated = $myrow[6];
$pd = format_pub_date( $st, $updated );
fwrite( $fp, "<pubDate>$pd</pubDate>\n");
fwrite( $fp, "</item>\n\n");
if ( $updated != 0 ) {
$sql = "update news set updated=0 where id=$myrow[0]";
mysql_query($sql,$db);
}
}
#Write the end of the file
fwrite( $fp, "</channel>\n");
fwrite( $fp, "</rss>\n");
fclose( $fp );
#Close it out and exit
}
function format_pub_date( $stamp, $updated )
{
$toReturn = "";
if ( $stamp == "" ) {
return $toReturn;
}
if ( strlen($stamp) != 10 ) {
return $toReturn;
}
$yr = substr( $stamp, 0, 4 ); #get the year out of the stamp
$mo = substr( $stamp, 5, 2 ); #get the month
$da = substr( $stamp, 8, 2 ); #get the day
if ( $updated != 0 )
{
$mn = rand(0,59);
$hr = rand(0,23);
$ts = mktime( $mo, $da, $yr );
}
else
$ts = mktime( 0, 0, 0, $mo, $da, $yr ); #get the UNIX timestamp for the file for the rss feed
$toReturn .= date(DATE_RSS, $ts );
return $toReturn;
}
?>
This file needs to be included in addnews.php and updatenews.php so the function recreate_rss_feed() can be called.
updatenews.php automatcally sets the updated field in the database, so when the script runs it checks for this field not being 0.
If it's not 0, it gives it the current timestamp instead of 00:00:00, this updates it in rss.
In order for this to open the rss feed file, for now that file has to be owned by apache and owner writable. This may
pose a security risk. However, I am trying to find a way to open this as another user.
This file has to be added into the list of files that can access the database as well as in the database that lists those files.
Input Variables
- faculty.php? fac_id
- ?selfimageresize
- news/month/php?monthcode
- news/seminardetails.php?id
- button.php?xsize ysize button text
- /news/events.php?eventid
ssl configuration
log events
Connection attempts using mod_proxy:
81.88.124.30 -> 64.12.202.1:443: 1 Time(s)
[root@bacchus ~]# grep 81.88.124 /var/log/httpd/access_log.1 81.88.124.30 - - [21/May/2010:22:38:31 -0400] "GET http://www.yahoo.com/ HTTP/1.1" 200 20767 81.88.124.30 - - [21/May/2010:23:19:17 -0400] "CONNECT 64.12.202.1:443 HTTP/1.0" 200 20751
password protect pages using htaccess
Password protection can be applied to folders in Apache by adding .htaccess and .htpasswd files for basic authentication. Or, digest authentication can be implemented which will pass hashes of the password. SSL should be implemented to protect from casual sniffing of the password.
http://httpd.apache.org/docs/1.3/howto/auth.html
http://home.golden.net/htaccess.html
Basic
.htaccess
[stedwar1@hephaistos ~]$ cat /home/facultystaff/stedwar1/Webpages/Steve/.htaccess
## make sure nobody gets the htaccess files
<Files ~ "^[\._]ht">
Order allow,deny
Deny from all
Satisfy All
</Files>
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
SSLRequireSSL
ErrorDocument 403 https://www.aoe.vt.edu/~stedwar1/Steve/
AuthUserFile /home/facultystaff3/stedwar1/.htpasswd
AuthName Steve
AuthType Basic
## only allow users that exist in the .htpasswd file
require valid-user
## or specify users in the password file
# require user stedwar1
# require user lscharf
Generate the htpasswd file with:
htpasswd -s .htpasswd user
.htpasswd
[stedwar1@hephaistos ~]$ cat .htpasswd
stedwar1:{SHA}L3BVYedbebadcC7PT9zOdorKkPU=
lscharf:Redbebadv/SeU
jes2850:tHedbebad6iho
leifur:{SHA}UwTVedbebadgOYk8tFQryD3HEEg=
Digest
Digest authentication is similar, but uses
AuthType Digest
and a corresponding htdigest file (in this example .htpasswd)
AuthDigestFile does not work with my version of apache, but AuthUserFile generated by htdigest does work.
.htaccess
[stedwar1@hephaistos sandbox]$ cat .htaccess
## make sure nobody gets the htaccess files
<Files ~ "^[\._]ht">
Order allow,deny
Deny from all
Satisfy All
</Files>
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
SSLRequireSSL
ErrorDocument 403 https://www.aoe.vt.edu/~gbyun/Konkuk
AuthUserFile /home/facultystaff/gbyun/.htpasswd
#AuthDigestFile /home/facultystaff/gbyun/.htdigest
AuthName "Konkuk"
AuthDigestDomain /Konkuk/ https://www.aoe.vt.edu/~gbyun/Konkuk/
AuthDigestNonceLifetime 300
AuthType Digest
#require valid-user
require user aoeuser
generate the password digest file with:
htdigest -c .htpasswd Konkuk aoeuser
.htpasswd
[stedwar1@hephaistos sandbox]$ cat .htpasswd aoeuser:Konkuk:2bdcd42a3e38bc12254552311611d94a
Unicode translation
Results from a problem with Dr Brown's VTShipDesign Web page rendering space characters as commas
A solution was found on 6/9/2010.
The current version of the web server, Server version: Apache/2.2.3, includes by default a setting in httpd.conf that specifies unicode translation to UTF-8.
Here is an excerpt of the config file as specified by Apache:
... # # Specify a default charset for all content served; this enables # interpretation of all content as UTF-8 by default. To use the # default browser choice (ISO-8859-1), or to allow the META tags # in HTML content to override this choice, comment out this # directive: # AddDefaultCharset UTF-8 ...
Dr Brown has a web page created with a Microsoft Office Product, which seems to like “Windows-1252” character encoding.
One can experiment with these settings in Firefox using: View Menu, Character Encoding.
www.vt.edu uses UTF-8, as a default, so AOE will also. In order to work around the Microsoft induced problem, add this line to an .htaccess file in the directory where the Microsoft created documents are located and the Web server will override the default Character Encoding.
.htaccess
AddType "text/html; charset=Windows-1252" htm AddType "text/html; charset=Windows-1252" html
The articles I found are all the reverse problem with the Web server not supporting UTF-8. I used the following article in reverse to find a solution.
phpmyadmin probe block for iptables
cat /var/log/httpd/access_log|awk '/myadmin/ {IGNORECASE = 1;print $1}'|sort|uniq|awk '{print "-A RH-Firewall-1-INPUT -s "$1" -j LOG --log-level info --log-prefix \"FIREWALL-PMA-DROPPED \""} {print "-A RH-Firewall-1-INPUT -s "$1" -j DROP"}'
Character encoding in html
testencoding.html
<pre>
<script>alert('test 2-not encoded')</script>
</pre>
<script>alert('test 2-not encoded')</script>
<br>
<br>
<pre>
&lt;script&gt;alert('test 1-character entity')&lt;/script&gt;
</pre>
<br>
<script>alert('test 1-character entity')</script>
<br>
<br>
<pre>
&#x3c;script&#x3e;alert('test 3-hex encoded')&#x3c;/script&#x3e;
</pre>
<br>
<script>alert('test 3-hex encoded')</script>
<br><hr>
Some good charater entity encodings:
<pre> & --> &amp;
< --> &lt;
> --> &gt;
" --> &quot;
' --> &#x27; &apos; is not recommended
/ --> &#x2F; forward slash is included as it helps end an HTML entity
</pre>
<a href=http://en.wikipedia.org/wiki/Character_encodings_in_HTML>http://en.wikipedia.org/wiki/Character_encodings_in_HTML</a>
convert image geomentry
convert -strip -geometry <horizontal dim> <input file> <output file> cd <images dir> mkdir 52 185 240 490 for i in `ls` ; do for j in 52 185 240 490; do convert -strip -geometry $j $i $j/$i; done; done;
or, to put them all in the same directory with different names:
for i in `ls *.jpg` ; do for j in 52 185 240 490; do convert -strip -geometry $j $i ./converted/`basename $i .jpg`-$j.jpg ; done; done;
subtotal page usage
grep 3./Mar/2011 /var/log/httpd/access_log |grep -v 404|awk '{a[$7] += $10} END {for (i in a) print a[i]", "i}' |sort -n