MythWeb: Howto fix "fsockopen() [function.fsockopen]: unable to connect to 127.0.0.1:6543 (Permission denied)" error

Posted by ryan
at 9:32 AM on Tuesday, September 27, 2005

I’ve recently embarked on the resurrection of my mythtv project that had been reclaimed for other uses. This time around I’m using Fedora Core 4 and Jarod’s still very authoritative tutorial, which got me completely up and running. However, when I tried to run mythweb I kept getting this error:

Warning at /var/www/html/mythweb/includes/mythbackend.php, line 102:
fsockopen() [function.fsockopen]: unable to connect to 127.0.0.1:6543 (Permission denied)

After digging around a little bit I figured out that this occurs when you have SELinux installed – which prevents the opening of a socket to the backend from mythweb. To fix this I simply followed these instructions, which say to set the following config value in ”/etc/selinux/config”:

SELINUX=disabled

After a reboot, all is well.

Howto Install the "lame" mp3 ripper on Debian Linux

Posted by ryan
at 3:33 PM on Sunday, September 25, 2005

I recently bought a new CD (can’t tell you the last time I did that was…) and was trying to rip it onto my Debian linux machine use “grip”. Long story short, I couldn’t figure out to install a proper mp3 ripping library – the two I know of being mp3encode and lame. Grip kept giving me “Invalid encoder executable Check your encoder config” errors on the encode step. What I eventually figured out was that neither of them have a debian package anymore (due to mp3 license issues?) – so you have to compile it on your machine if you want it.

I chose to install the lame library since that’s what I first ran across. Here’s how I went about that:

  1. Download the source tar from: http://lame.sourceforge.net/download/download.html
  2. Extract the source: tar -xvzf lame-3.X.tar.gz
  3. Change into the lame dir: cd lame-3.X
  4. Compile and install: ./configure && make && make install
And there you have it. After this you should have a “lame” executable in /usr/local/bin/lame that you can now reference in your mp3 ripper – such as Grip or RipperX.

If anybody knows how to do the equivalent for mp3encode, definitely let me know.

XSLT Best Practices - My undergrad research uncovered

Posted by ryan
at 1:03 PM on Tuesday, September 20, 2005

When I was doing my undergrad over at N.C. State I took a pretty autonomous undergrad research course to complete the honor’s CSC program. At the time I was working for TIBCO/Extensibility and was pretty heavy into the XML/XSLT world. My research reflected that focus as I chose to focus on “Extensible Stylesheet Language Transformations (XSLT); Programming for Code Reuse and Performance”. I recently dug up the results of the research and have to say that “research” isn’t quite the right term for this underwhelming paper. Something like “Best Practices Whitepaper” seems more appropriate. In either case, I’ve attached it here so I don’t lose it again in my stacks of corrupted cd backups:

Extensible Stylesheet Language Transformations (XSLT); Programming for Code Reuse and Performance (pdf)


Java-Frameworks.com is no more

Posted by ryan
at 9:40 AM on Tuesday, September 20, 2005

My little frameworks experiment is coming to an end… Java-Frameworks.com started out as my little personal repository of java utilities, frameworks and libraries that was open to anybody (think a lightweight version of sourceforge with project dependency linking). Rather than keep it around knowing I’m not going to add any functionality or fix any bugs I’ve decided to take it off the air. I have backups of all the projects, so let me know if you need something off of there and I’ll see what I can do.

Here is a listing of all of my little projects that were hosted there (most are several years old and have better alternatives, but for posterity sake….):

  • JDBC Execution Framework v1.1.4: “This is a flexible framework that will remedy the repetition of interacting with a JDBC compliant database. Note: The original form of the framework is outlined in this JavaWorld article. It has since been modified for more flexible use.” [depends on Common Utilities v1.2]
  • Spring Web MVC Chain Extension v1.0.1: see here for summary.
  • Directory Watcher v1.1: “This is a set of utility classes that will monitor a specified directory for any changes to that directory (i.e. additions, deletions or modifications). The monitor will listen to the directory, pinging it for changes on a developer specified time interval. The monitor can accept generic resource listeners, which will be notified when an event occurs on the directory.” [depends on Common Utilities v1.2]
  • Web App Flow Framework v1.1.1: “This is a framework designed to take the repetition out of servlet based application programming. This framework forms an application into a series of request handlers. The flow of each request can then be configured in an XML file that specified which handlers will be called on which requests. The idea is to have several handlers that perform logical independent tasks. By stringing a series of independent handlers together, different chains of reusable functionality can be achieved.” [depends on Common Utilities v1.2 and dom4J]
  • Web App Security Framework v1.0.2: “This framework is designed to provide a way to specify reource level security for a web application. Resources may include jsp pages as well as individual classes. The security of each resource is specified external to that resource, thus seperating the security from the business logic.” [depends on Common Utilities v1.2 and dom4J]
  • Cache Framework v1.0: “This caching framework allows you to build a simple, type-independant caching mechanism with developer specified key types.” [depends on Common Utilities v1.2 and Log4J]
  • Pool Framework v1.0: “This is a framework that will allow for type independent pools to be built very quickly. The common functionality of pooling mechansims has been factored out into a set of clean interfaces and abstract classes. All a developer of a pool needs to code is the factory methods for creating a new poolable item.” [depends on Common Utilities v1.2 and Log4J]
  • Common Utilities v1.2: “Simple utility classes such as NestedException and others…”

It’s funny to look back on work I’ve done in the past and see how different things are now a days. Who writes their own web MVC framework now? JDBC … what’s that?

Setting up MPPE VPN support in Debian Linux

Posted by ryan
at 6:45 PM on Sunday, September 11, 2005

Awhile ago I posted this howto for compiling a kernel with MPPE support to be able to connect to a Microsoft VPN. Now that I’m going through this process again for a new Dell Latitude D610 I thought it might be time to document the next step, which is setting up the scripts to connect to an actual VPN.

Most of these steps were taken pretty directly from http://www.adamhooper.com:4242/mcgill-vpn-mppe/#config, but it can’t hurt to have more than one howto out there, right?

Steps to connect to a Microsoft VPN from a Debian linux client:

  1. Install ppp: apt-get install pptpd pptp-linux
  2. Create and edit ”/etc/ppp/options.your_vpn_abrev” to contain:
    lock
    noauth
    nobsdcomp
    nodeflate
    persist
    
  3. Create and edit ”/etc/ppp/peers/your_vpn_abrev” to contain:
    pty "pptp <i>your_vpn_url</i> --nolaunchpppd"  # i.e. vpn.domain.com
    name "<i>your_login_username</i>" 
    remotename <i>your_vpn_abrev</i>
    require-mppe-128
    file /etc/ppp/options.<i>your_vpn_abrev</i>
    ipparam <i>your_vpn_abrev</i>
    
  4. Update ”/etc/ppp/chap-secrets” to contain:
    <i>your_login_username</i>  <i>your_vpn_abrev</i>  <i>your_login_password</i>  *
    <i>your_vpn_abrev</i>  <i>your_login_username</i>  <i>your_login_password</i>  *
    
  5. Create and edit ”/etc/ppp/ip-up.d/your_vpn_abrev” to contain (add one line per ip range that needs to go through the VPN):
    route add -net <i>vpn_ip_range</i> ppp0  # i.e. 192.168.20.0/24 or 132.216.0.0/16
    
  6. Make the ip-up script executable: chmod +x /etc/ppp/ip-up.d/your_vpn_abrev

Try to connect:
At this point you should be able to execute the following command to bring up the VPN:

pon <i>your_vpn_abrev</i> debug dump logfd 2 updetach persist && /etc/ppp/ip-up.d/<i>your_vpn_abrev</i>
You should see something similar to this:
pppd options in effect:
debug           # (from command line)
updetach                # (from command line)
persist         # (from command line)
logfd 2         # (from command line)
dump            # (from command line)
noauth          # (from /etc/ppp/options.<i>your_vpn_abrev</i>)
name ryan               # (from /etc/ppp/peers/<i>your_vpn_abrev</i>)
remotename tribeca              # (from /etc/ppp/peers/<i>your_vpn_abrev</i>)
                # (from /etc/ppp/options.<i>your_vpn_abrev</i>)
pty pptp <i>your_vpn_url</i> --nolaunchpppd            # (from /etc/ppp/peers/<i>your_vpn_abrev</i>)
crtscts         # (from /etc/ppp/options)
                # (from /etc/ppp/options)
asyncmap 0              # (from /etc/ppp/options)
lcp-echo-failure 4              # (from /etc/ppp/options)
lcp-echo-interval 30            # (from /etc/ppp/options)
hide-password           # (from /etc/ppp/options)
ipparam tribeca         # (from /etc/ppp/peers/<i>your_vpn_abrev</i>)
proxyarp                # (from /etc/ppp/options)
nobsdcomp               # (from /etc/ppp/options.<i>your_vpn_abrev</i>)
nodeflate               # (from /etc/ppp/options.<i>your_vpn_abrev</i>)
require-mppe-128                # (from /etc/ppp/peers/<i>your_vpn_abrev</i>)
noipx           # (from /etc/ppp/options)
using channel 2
Using interface ppp0
Connect: ppp0 <--> /dev/pts/2
sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0xbd67cf7f> <pcomp> <accomp>]
rcvd [LCP ConfReq id=0x1 <asyncmap 0x0> <auth chap MS-v2> <magic 0x359da88e> <pcomp> <accomp>]
sent [LCP ConfAck id=0x1 <asyncmap 0x0> <auth chap MS-v2> <magic 0x359da88e> <pcomp> <accomp>]
rcvd [LCP ConfAck id=0x1 <asyncmap 0x0> <magic 0xbd67cf7f> <pcomp> <accomp>]
sent [LCP EchoReq id=0x0 magic=0xbd67cf7f]
rcvd [CHAP Challenge id=0x1 <db473bebd9077d4f59295aa64932f573>, name = "nas"]
sent [CHAP Response id=0x1 <9c3606e62374744e490d7305f3050a3784090810000000e057efca0fc6216021088d786cb800533ccce2d92e1b17819500>, name = "<i>your_vpn_username</i>"]
rcvd [LCP EchoRep id=0x0 magic=0x359da88e]
rcvd [CHAP Success id=0x1 "S=46E4685DE0338610FF22D2CA53DE41F9310424AF"]
sent [CCP ConfReq id=0x1 <mppe +H -M +S -L -D -C>]
rcvd [IPCP ConfReq id=0x1 <addr 192.168.20.230> <compress VJ 0f 01>]
sent [IPCP TermAck id=0x1]
rcvd [CCP ConfReq id=0x1 <deflate 15> <deflate(old#) 15> <mppe +H -M +S +L -D -C>]
sent [CCP ConfRej id=0x1 <deflate 15> <deflate(old#) 15>]
rcvd [CCP ConfAck id=0x1 <mppe +H -M +S -L -D -C>]
rcvd [CCP ConfReq id=0x2 <mppe +H -M +S +L -D -C>]
sent [CCP ConfNak id=0x2 <mppe +H -M +S -L -D -C>]
rcvd [CCP ConfReq id=0x3 <mppe +H -M +S -L -D -C>]
sent [CCP ConfAck id=0x3 <mppe +H -M +S -L -D -C>]
MPPE 128-bit stateless compression enabled
sent [IPCP ConfReq id=0x1 <compress VJ 0f 01> <addr 0.0.0.0>]
rcvd [IPCP ConfNak id=0x1 <addr 192.168.20.233>]
sent [IPCP ConfReq id=0x2 <compress VJ 0f 01> <addr 192.168.20.233>]
rcvd [IPCP ConfAck id=0x2 <compress VJ 0f 01> <addr 192.168.20.233>]
rcvd [IPCP ConfReq id=0x1 <addr 192.168.20.230> <compress VJ 0f 01>]
sent [IPCP ConfAck id=0x1 <addr 192.168.20.230> <compress VJ 0f 01>]
Cannot determine ethernet address for proxy ARP
local  IP address 192.168.20.233
remote IP address 192.168.20.230
Note: I could never get the automatic execution of the ip-up script to work after the vpn connects which is why it’s explicitly being executed here (the “&& /etc/ppp/ip-up.d/your_vpn_abrev” part)

After this is done, you should be able to ping the remote ip address (the last line of the log above) and you should see “ppp0” now listed in “ifconfig”:

# ifconfig
eth0      ...

lo        ...

ppp0      Link encap:Point-to-Point Protocol
          inet addr:192.168.20.233  P-t-P:192.168.20.230  Mask:255.255.255.255
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1496  Metric:1
          RX packets:8 errors:0 dropped:0 overruns:0 frame:0
          TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:3
          RX bytes:106 (106.0 b)  TX bytes:94 (94.0 b)
If you see this chances are you’ve got it all up and running! And to stop the VPN, just execute this command:
poff <i>your_vpn_abrev</i>

And that’s all there is to it (well, and this minor step that you should have done before hand). Let me know if you have any issues and I’ll see what I can come up with. Keep in mind I am by no means an expert, I’ll just see if I can help up as I’ve run into setup problems myself that you may find yourself confronted with.