Monday, May 30, 2011

Enable HTTP Compression

IIS


cscript adsutil.vbs set W3Svc/Filters/Compression/Parameters/HcDoDynamicCompression true
cscript adsutil.vbs set W3Svc/Filters/Compression/Parameters/HcDoStaticCompression true
cscript adsutil.vbs set W3Svc/Filters/Compression/GZip/HcDynamicCompressionLevel 7
cscript adsutil.vbs set W3Svc/Filters/Compression/GZip/HcScriptFileExtensions "asp" "dll" "exe" "aspx"
cscript adsutil.vbs set W3Svc/Filters/Compression/GZip/HcOnDemandCompLevel 7
cscript adsutil.vbs set W3Svc/Filters/Compression/GZip/HcFileExtensions "txt" "htm" "html" "js" "htc"
cscript adsutil.vbs set W3Svc/Filters/Compression/Deflate/HcDynamicCompressionLevel 7
cscript adsutil.vbs set W3Svc/Filters/Compression/Deflate/HcFileExtensions "txt" "htm" "html" "js" "htc"
cscript adsutil.vbs set W3Svc/Filters/Compression/Deflate/HcOnDemandCompLevel 7
cscript adsutil.vbs set W3Svc/Filters/Compression/Deflate/HcScriptFileExtensions "asp" "dll" "exe" "aspx"
cscript adsutil.vbs set W3Svc/Filters/Compression/Parameters/HcNoCompressionForHttp10 true
cscript adsutil.vbs set W3Svc/Filters/Compression/Parameters/HcNoCompressionForProxies true



Apache



# Insert filter
SetOutputFilter DEFLATE


# Netscape 4.x has some problems...
        BrowserMatch ^Mozilla/4 gzip-only-text/html


# Netscape 4.06-4.08 have some more problems
        BrowserMatch ^Mozilla/4\.0[678] no-gzip


# MSIE masquerades as Netscape, but it is fine
        BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
# Don't compress images
        SetEnvIfNoCase Request_URI \
        \.(?:gif|jpe?g|png)$ no-gzip dont-vary


# Make sure proxies don't deliver the wrong content
        Header append Vary User-Agent env=!dont-vary

Friday, May 20, 2011

iptables as WOL packet proxy

sudo iptables -t nat -A PREROUTING -p udp --dport 7 -j DNAT --to-destination <UNUSED_IP>
sudo ip neigh add <UNUSED_IP> lladdr ff:ff:ff:ff:ff:ff nud permanent dev eth0

Download
http://www.depicus.com/wake-on-lan/wake-on-lan-cmd.aspx

wolcmd <mac> <proxy_ip> 255.255.255.255 7

DogTag Certificate System on CentOS 5.5 x64

https://fedoraproject.org/wiki/QA:Testcase_Dogtag_Certificate_System_Configure

yum install pki-ca pki-ra pki-kra pki-ocsp pki-tks pki-tps.x86_64 pki-console pki-common pki-native-tools centos-ds

pkicreate -pki_instance_root=/var/lib        \
          -pki_instance_name=pki-ca          \
          -subsystem_type=ca                 \
          -agent_secure_port=9443            \
          -ee_secure_port=9444               \
          -ee_secure_client_auth_port=9446   \
          -admin_secure_port=9445            \
          -unsecure_port=9180                \
          -tomcat_server_port=9701           \
          -user=pkiuser                      \
          -group=pkiuser                     \
          -redirect conf=/etc/pki-ca         \
          -redirect logs=/var/log/pki-ca     \
          -verbose

setup-ds.pl

User Firefox or IE
Open the link shown after running the above script.
If it failed, change to use http with port 9180


Saturday, May 7, 2011

Making Ubuntu 11.04 as Kiosk using Google Chrome

1. Create Kiosk Users (with password)
2. Switch to Login Kiosk Users, Open Chrome to create default setting, Set Screensaver Setting (E.g. 5 minutes with no password lock)
3. Logout Kiosk Users, Switch back to your normal users
4. sudo vi /usr/share/xsessions/kiosk.desktop
[Desktop Entry]
Encoding=UTF-8
Name=Kiosk Mode
Comment=Chromium Kiosk Mode
Exec=/usr/share/xsessions/chromeKiosk.sh
Type=Application
5. sudo vi /usr/share/xsessions/chromeKiosk.sh
#!/bin/bash
while true; do google-chrome %u --incognito; sleep 5s; done
6. sudo chmod 755 /usr/share/xsessions/chromeKiosk.sh
7. sudo vi /home/kiosk/.dmrc
[Desktop]
Session=kiosk
Language=en_US
8. sudo chown root.root .dmrc
9. sudo chmod 644 .dmrc
10. sudo vi /home/kiosk/.config/google-chrome/Default/Preferences

  "browser": {
      "window_placement": {
         "maximized": true,
        }

      "exited_cleanly": true,

11. Change Kiosk Users to Auto Login without asking Password
12. Login Kiosk and Test

PS: Chrome will automatically reopen after 5 second, somehow if you want to logout that session, just kill chomeKiosk.sh in console will do.

Reference: http://www.instructables.com/id/Setting-Up-Ubuntu-as-a-Kiosk-Web-Appliance/step6/Set-up-Kiosk-Desktop-Mode-in-Xsessions/?images#images