Greg's Tech blog

My technical journal where I record my challenges with Linux, open source SW, Tiki, PowerShell, Brewing beer, AD, LDAP and more...

Auto login to the Linksys WRT54GS Parental Control

Sunday 02 of October, 2005
Auto login to the Linksys WRT54GS Parental Control

So we use the WRT54GS v2 for Parental Control. The PC software has a per user login that tracks what sites/IM/E-mail you use and restricts access based on time, site, user, etc. More can be found on the Linksys site (cache).

I have a Linux server that runs e-mail, a web site and keeps my dynamic dns up-to-date. in order for it to work, it must aleays be logged into parental control. Problem is that whenever the server or router is restarted, I have to manually log in the server so it can work. Until now. With the release of the 3.x and 4.x firmware, a new feature was added to allow you to "auto-login" particular PCs or gaming device. it took me 3 tech support chat sessions before I was able to convice Linksys tech support that the router now supported the feature (I had to read them the release notes!) and that they should find out how to do it. Here's what you do! (Thanks to Bryan Beals at Cisco for finally sending me the docs)

  • upgrade the router firmware to the latest version (currently 4.70.6)
  • Go to the Parental Control Support page (cache)
  • Reconnect your router (this is important - it will upgrade the version of firmware on file and allow you to get the new settings

Once this is done, you are ready to setup the PC to autologin

  • Get the MAC address for you PC. It will look like this 00:40:93:35:41:42 or this 00-40-92-35-41-47. You can get this address from the DHCP Clients table on your router if the client is currently connected and using DHCP (it is unless you've done something to stop it). That table is located at Status, Local Network, DHCP Clients Table.
  • Go Back to the Parental Control Support page. Click the Family Settings menu option.
  • Look for the hyperlink "here" text in the beginning of the instructions and click it:
"Click a family member's name to change their Internet privileges. Click here to automatically use a family member's privileges on a specific computer or device.
  • Enter a name for the device (e.g. XBox)
  • Enter the MAC address use the colon as a separator (e.g. 00:40:93:35:41:42). Note: There is a link to see the currently connected devices. Click "Show me the known devices", highlight the device you wish to use and click Move then Close
  • Pick the existing family member's setting that you wish to use. The device will always use the permissions of the familiy member you've chosen. You might consider creating a special family member for the device.
  • Click Add, then click Save.

That's it. Now the device you specified will always be logged in to Parental Controls.


AD, SSL & Load Balancing

Wednesday 04 of May, 2005

Interesting times. In previous posts we walked through some thoughts about how to create 3rd party certs that have the same CN so that the LDAP clients could see any server as though it were one.

We had created a cert request that had the cn set correctly, but AD/Win2k3 would not accept it since the domain controller name was not in the CN. The article from MS said we could put the dc name in the DNS name field of the Subject Alternative Name (SAN). We thought we had tried this. What we found is that you cannot specify a SAN with a retail cert from Verisign. We then signed up for the Verisign Managed PKI service.

We're still working through the results.

LDAP, SSL & Load balancing

Wednesday 20 of April, 2005

We need to configure two AD domain controllers/ldap servers behind a load balancer. The certificates for the servers (to allow ldaps) must have a common host name in order for the application server to see the correct cert when it connects.

For the Certs for the DCs we created the following Subjects:
Subject = "CN=AUTH.dom.ORG,OU=DomNTBZ07,O=DOM,C=US,S=state,L=city"

Note that the CN is the DNS name for the load balancer VIP.

The question is whether once the certs are installed whether AD will accept them as appropriate and enable ldap over SSL. We'll know soon

ssh config

Wednesday 20 of April, 2005

I realized the danger in having root access via ssh. I reconfigured sshd by editing /etc/ssh/sshd_config and adding the line: DenyUsers root.

Using a Verisign (or 3rd party) Certificate for AD Domain Controllers

Thursday 07 of April, 2005

If you are using a Microsoft CA, adding a cert to enable LDAP over SSL is a matter of simply installing the CA on a domain controller in the domain. The DCs all enroll automatically and you're done.

We've been struggling with how to add a 3rd party (Verisign) certificate to our Win2k3 AD domain controllers. Here's what we tried and what worked. If this helps you, please drop me a note at gmartinatgmartin.org

We first went to the MS knowledge base and found several articles. See the resoruces link below

They were mostly useless as few relate to Windows 2003. Particularly with how to generate the request. They refer to the Certificates snap-in. For whatever reason, you cannot generate a cert request using the snap-in. I believe it was tied to the MS CA.

The document with the real information is <a href="http://www.microsoft.com/technet/prodtechnol/windowsserver2003/technologies/security/advcert.mspx" target="_blank">Advanced Certificate Enrollment and Management</a>

Read that document then follow these steps:

Create the reqdccert.vbs vbscript on the domain controller file system
Run the script on the domain controller console (or in a terminal service session). (I did so without any command-line switches)
The following files get created:

We're most interested in the .inf file. Open it with notepad and the contents should look like this:
Signature= "$Windows NT$"

KeySpec = 1
KeyLength = 1024
Exportable = TRUE
MachineKeySet = TRUE
PrivateKeyArchive = FALSE
UserProtected = FALSE
UseExistingKeySet = FALSE
ProviderName = "Microsoft RSA SChannel Cryptographic Provider"
ProviderType = 12
RequestType = PKCS10
KeyUsage = 0xa0

; The subject alternative name (SAN) can be included in the INF-file
; for a Windows 2003 CA.
; You don't have to specify the SAN when submitting the request.
; The template name can be included in the INF-file for any CA.
; You don't have to specify the template when submitting the request.

The section that says NewRequest. For Verisign, there must be a subject entry in this section and it must contain a lot of information. The subject we settled on looked like this:
Subject = "CN=ourServerName.ourDomain.org,OU=IT,O=ourOrg,C=US,S=somState,L=someCity"

Verisign requires the OU,O,C,S,L entries in order to generate the cert.
So make the changes and save the ifn file.

Now run the certreq -new svrname.inf svrname.req

The resulting .cer file can be used to request the certificate from Verisign.

Once you receive the cert back you import it using:

certutil -ACCEPT certfilename

Hope this helps.

If this helps you, please drop me a note at gmartinatgmartindotorg

Description of the requirements and of the troubleshooting methods that you can use to enable an LDAP client to communicate with an LDAP server over SSL

Requirements for Domain Controller Certificates from a Third-Party CA

Unable to Connect to a Domain Controller by Using LDAP Connection over SSL

How to enable LDAP over SSL with a third-party Certification Authority

Advanced Certificate Enrollment and Management

Updating user accounts with DSMOD

Thursday 07 of April, 2005

We had to set the passwords for a bunch of accounts. DSMOD seemed appropriate since we had a list of DNs.

Here's what I did.
I saved the file as a CSV then replaced the commas delimiting the fields with colons. Using comma as the delim didn't work since DNs have commas.

Then the following command did the trick:
for /f "delims=: tokens=1-3" %a in (ETSNT60UsersToSetPasswords2.csv) do dsmod user %a -pwd %c

The for /f loops through the file specified in 'in (...)

The delims=: tells for that every colon delimits the next field

The tokens tells for how many items to pass once it has split the input line based on the delim

The %a is the name of the first token. Inour command %a %b & %c was set with DN, samaccoutname and password. The samaccount name was not need so the followin g command would have worked:

for /f "delims=: tokens=1,3" %a in (ETSNT60UsersToSetPasswords2.csv) do dsmod user %a -pwd %c
Note the change in token to pass just the first & 3rd token (DN & pwd).


Using wget for DynamicDNS updates

Wednesday 06 of April, 2005

wget -O - http-user=username http-passwd=$SEC 'https://dynamic.zoneedit.com/auth/dynamic.html?host=linux2.gmartin.org'

wget -O - http-user=username http-passwd=$SEC 'https://dynamic.zoneedit.com/auth/dynamic.html?host=linux1.gmartin.org'

wget -O - http-user=username http-passwd=$SEC 'https://dynamic.zoneedit.com/auth/dynamic.html?host=ldap.gmartin.org'

MIIS Design

Wednesday 06 of April, 2005
MIIS design
Question today was whether we need to provide a MIIS environment for staging. After talking through we came up with the following:

  • There is no internal staging directory. There is only the etslan.org directory although we do have staging server defined
  • There is no need to performance test against the internal directory

With this in mind, we're thinking that we'll have a single MIIS server sync accounts into both the prod & stage directories

WebCalendar upgrade

Monday 27 of September, 2004

I upgraded WebCalendar to 0.9.44 (from .43). The process was painless. I:

  1. created a new directory /usr/local/WebCalendar-0.9.44
  2. Edited the includes/config.php to add the db password
  3. edit the Alias entry in httpfd.conf to point to the new directory

What's left:

  • zip the old directory
  • make any no db updates


sed (the stream editor)

Tuesday 07 of September, 2004

I've been using sed to modify the import files for the Exchange lab here are some tricks & links.

To match & replace a particular string:

"s/%Distribution Lists\/cn=[0-9][0-9][0-9][0-9]//ig" This matches "%Distribution Lists/cn=xxxx" where xxxx is four digits
s/ROSNT[0-9][0-9]/EAOEX1/gImatches ROSNTxx and replaces with EAOEX1
s/EWZNT[0-9][0-9]/EAOEX1/gImatches EWZNTxx
s/ou=ETS\//ou=ETSEXT\//gImatches ou=ETS\
s/o=ETS\//o=ETSEXT\//gImatches o=ETS\
s/ETS\//ETSEXT\//gImatches ETS\
s/p=ETS;/p=ETSEXT;/gImatches p=ETS;
s/o=ETS;/o=ETSEXT;/gImatches o=ETS;
s/ETS.ORG/etsext.ORG/gImatches ETS.ORG
sed -n -e "/\$:/p" <filename Prints only lines in filename containing "$:"
sed -e "/\$:/d" <filename Prints only lines not containing "$:"
sed -n -e "/^dn: CN=ets/,/^$/p" matches all the lines between one starting with ^dn: CN=ets and end a blank line (^$)

The general command line looks like:

sed -e "s/%Distribution Lists\/cn=[0-9][0-9][0-9][0-9]//ig" filename.
The quotes around the regex are required if there is a space in the regex. The regex can be added to a file and references with -f

sed -f sedscript.sed filename

  • The

PXE Server

Thursday 22 of April, 2004

We need three things:

  • DHCP server
  • TFTP server
  • NFS share

DHCP server

edit configure file:

option domain-name "linux.sun.com";
option domain-name-servers,;
option subnet-mask;

allow bootp;
allow booting;
option ip-forwarding false; # No IP forwarding
option mask-supplier false; # Don’t respond to ICMP Mask req
ddns-update-style = adhoc;
get-lease-hostnames on; # DNS lookup hostnames
use-host-decl-names on; # And supply them to clients

  1. WARNING: This is a default configuration — any system PXE booting will
  2. wipe out all existing data on the first hard disk and install
  3. RedHat Enterprise Linux AS

subnet netmask {
next-server; # name of your TFTP server
filename "/as-2.1/sun/pxelinux.bin"; # name of the boot-loader program
range; # dhcp clients IP range

- start dhcpd manually (added it to rc.local)

tftp server

  • create /var/tftp directory
  • Add files tp directory (pxelinux.bin)
  • startup using /usr/sbin/in.tftpd -c -l -v -s /var/tftp

NFS share

  • edit /etc/exports
  • add ' /var/tftp *(ro,sync) '
  • restart nfs 'rc.inet2 restart'

Turning on POP3 & other services

Monday 19 of April, 2004
Turning on POP3 & other services

I have sendmail working but couldn't connect to a mailbox using OE. Did some looking around and sure enough we weren't listening on port 110 - the POP3 port. More research and I found that I needed to edit etc/inetd.conf in order to have inetd start the pop3 service. While I was there I started imap2 and swat (for samba admin).

After saving the file I ran '/etc/rc.d/rc.inetd restart' to restart the daemon.


PS - what's left?
- Mail testing
- Mail migration for Priscilla & Caolinn
- Mailman install & migration

Compiling Sendmail

Wednesday 14 of April, 2004
Compiling Sendmail

  • Downloaded Sendmail 8.12.11
  • Created site.config.m4 file in sendmail/Site directory. Added following lines:


APPENDDEF(`conf_sendmail_LIBS', `-lsasl2')

APPENDDEF(`confLIBDIRS', `-L/usr/local/lib')

APPENDDEF(`confINCDIRS', `-I/usr/local/include/sasl')



APPENDDEF(`confLIBS', `-lnsl -lssl -lcrypto -lwrap -lm -ldb -lresolv')

  • ran ./Build -c -n (to clear out old build)
  • Set authinfo file

Authinfo:outgoing.verizon.net "U:vze1jt1m" "I:vze1jt1m@verizon.net"_

"P:password" "R:outgoing.verizon.net" "M:PLAIN"

  • restart sendmail ('rc.sendmail restart')

http://www.sendmail.org/~ca/email/auth.html (cache)

Adding SASL support

Wednesday 14 of April, 2004
Adding SASL support

I need to configure Sendmail. From my experience, I believe I will need SASL to support client authentication. The first step is to install SASL

  • I downloaded Cyrus-SASL v 2.1.18 from ftp.andrew.cmu.edu/pub/cyrus
  • Renamed file to *.tgz so it was compatible with the slackware installer
  • moved the subsequent directory to /tmp/sasl/cyrus-sasl-2.1.18

  • Ran ./configure without error

./configure enable-anon enable-plain enable-login disable-krb4 with-saslauthd=/var/run/saslauthd with-pam with-openssl=/usr/local/ssl with-plugindir=/usr/local/lib/sasl2 enable-cram enable-digest --enable-otp
http://www.projektfarm.com/en/support/howto/sendmail_smtp_auth_tls/sendmail_smtp_auth_tls.html (cache)
http://www.sendmail.org/~ca/email/auth.html (cache)
http://www.jimohalloran.com/archives/000227.html (cache)

  • Ran make without error
  • Ran make install
  • Removed /tmp/sasl...

  • Start SASL ('saslauthd -a shadow")
  • added to rc.local

More Linux2 changes

Tuesday 13 of April, 2004

More Linux2 changes

I made some more changes tonight. Specifically

  • Copies over and configured zoneclient to update ddns automatically. See 'crontab -e' and /usr/local/zoneclient

  • Copied over myindex.html
  • Apache changes
    • Copied but have not configured phpMyAdmin. Added dbAdmin link. Still need to do .htaccess
    • Configured apache to listen on port 80 & 82 (Listen). Removed forward from port 82 to port 80.
    • Configured Servername and serveradmin in apache config (httpd.conf)
    • Changed UseCanonicalname to Off. Should fix some problems with mailman...


Tiki Move

Monday 12 of April, 2004
Tiki Move

Tiki was migrated to linux2.gmartin.org over easter weekend. The new server is twice the speed (400mhz) and 3x RAM (320MB). Pages load much faster and graphics are rendered quickly. John is testing externally.

I moved the data using mysqldump and mysql. The config looks like this

  • Tiki is installed to /usr/local/tiki-<version> with a link to /usr/local/tiki
  • Files are stored extrnal in /usr/local/tiki/files
  • Images in /usr/local/tiki/imagegal

Still to do:

  • Upgrade tiki to 1.7.7 or 1.8.4
  • Install phpMyAdmin (use webmin until then)
  • Configure Sendmail
  • Move mailboxes
  • Move Mailman


Fixing new Mailman Lists

Wednesday 25 of February, 2004

Fixing new Mailman Lists

Creating a new mailman list imbeds it with an improper hostname. The best way to create a list is the following.

run '/usr/local/mailman/bin/newlist'

Once crerated, fix the url by running:
'/usr/local/mailman/bin> ./withlist -l -r fix_url -u linux1.gmartin.org:81'

grabbing a single line of command output

Saturday 10 of January, 2004
grabbing a single line of command output

I wrote this Windows script (batch file) to grab a single line of output from a command


set /a max=1

typeperf "\memory\Pages/sec" -f csv -sc 1 -o c:\temp\1.tmp -y

for /f "usebackq skip=1 tokens=1*" %%a in ("c:\temp\1.tmp") do (

call :onlyone %%a%%b)

goto :eof


set /a counter = NaV + 1

if /i NaV gtr NaV goto :EOF

echo %* >>c:\temp\2.tmp

goto :EOF



The for command reads the file line by lines and calls only one with parameters.
:onlyone does something (in this case echo), then increments a counter to keep track of how many it has done then returns
Next time onlyone is called the counter = max, so it returns without doing anything

Note: tried to execute typeperf from within the for command but the command must write directly to the screen on a non-line oriented mode. For could not capture the output correctly

Setting Linux Time

Monday 05 of January, 2004

Running gnome on Linux2 and the time was off. I tried to use gnome to set the time but it said no program was configured to change time. I don't get it.

Found a nice discussion on the clock here (cache)

Needed to use hwclock. Here are the commands

hwclock set date hh:mm:ss (to set the time)

hwclock --localtime (tells linux the rtc is set to local time)

hwclock --hctosys (to set system time from hwclock)


Smarthost Relaying

Friday 28 of November, 2003

in my last post I spent a lot of time discussing how to install SASL and configure Sendmail to do SMTP AUTH.
I was confusing smartthost authentication with user authentication. I found an article on comp.mail.sendmail
that hinted to the problem and directed me to the sendmail README in /usr/share/sendmail/cf/

All I needed to do was

  • configure the sendmail smarthost

    • in gmartin.mc


  • tell sendmail where to relay mail

    • configure access.db to tell sendmail how & where to store access information.

FEATURE(`access_db', `hash -T<TMPF> /etc/mail/access')dnl

  • modify access.db
    • Edit /etc/mail/access
    • Add the login info:
    • Authinfo:outgoing.verizon.net "U:vze1jt1m" "I:vze1jt1m@verizon.net" "P:xxxxxx" "R:outgoing.verizon.net" "M:PLAIN"
    • Rebuld access.db

makemap hash access <access

Note: The other entries in access.db are the hosts to accept as relay hosts

Sendmail, SASL & Smarthost

Tuesday 25 of November, 2003

We need to start forwarding mail through verizon because sites like AOL are not accepting mail from mail servers on
soft-links(based on IP range). I started researching this and found that first I need:

  • SASL version of sendmail
  • sendmail configured with a smarthost
  • sendmail configured to do SMTP Auth

SASL & Sendmail

Found this page that lead me down the right path (cache)

So I downloaded SASL and followed the instructions to build it, but received and error during 'make':

"kerberos4.c:49:17: krb.h: No such file or directory "

This was resolved by modifying the ./configure step. I used this command-line based on a a link to
http://www.irbs.net/internet/info-cyrus/0207/0196.html (cache):
./configure with-saslauthd=/usr/lib/sasl2 enable-cram \

enable-digest enable-plain disable-anon disable-gssapi \

disable-krb4 disable-otp --with-openssl

Sendmail 8.12.10

Next I had to compile Sendmail. Based on the sendmail book I ran
./Build -c -n (create clean build, no make)
./Build -c
./Build install
Then I restarted sendmail and all was well
(Actually, I received an error:
"libsasl.so.7: cannot open shared object file: No such file or directory"
At this point I remembered that my SASL build had an error which I resolved and documented above).
Never stop in the middle of something!

Sendmail and SMTP AUTH

Useful links:
http://dbforums.com/arch/181/2002/12/574316 (cache)

Still not getting AUTH from EHLO command

Printing Exchange Distribution List Members

Thursday 15 of May, 2003
HOWTO Print Exchange 5.5 Distribution List Members

We had a need recently to print the contents of an Exchange 5.5 distribution list. We've looked in thre past for a tool to do this and never had any luck.
I found a python script that did this and since I don't know python(yet), I converted it to vbscript. Run the script (cscript getmembers.vbs) to see the Usage.
You'll need ADO & ADSI installed locally. E-mail with questions/bugs. Let me know if it works for Exch2k

I hope you'll find this of value. (save as getmembers.vbs)

'getmembers.vbs - Greg Martin - CSC May 2003
'If you use this regularly, you can define sUser & sPwd with a user from your local site
'Run with cscript to prevent a gazillion pop up windows

dim oIADs
dim MyContainer
dim objRecipients
dim item

CRLF = Chr(13) & Chr(10)

sUsage =    "Getmembers.vbs - Greg Martin, CSC  2003" & CRLF & CRLF
sUsage = sUsage & "Returns the entries of an Exchange distribution list and nested lists" & CRLF
sUsage = sUsage & "Usage:  cscript getmembers.vbs      " & CRLF & CRLF
sUsage = sUsage & "Where:" & CRLF  
sUsage = sUsage & "Servername is the name of an exchange server" & CRLF  & CRLF
sUsage = sUsage & "Listname is the alias of the list to be enumerated" & CRLF   & CRLF
sUsage = sUsage & "UserDN is the DN of an exchange user(used to login via LDAP)" & CRLF 
sUsage = sUsage & "Note: User DN typically looks like 'cn=alias, ou=site, o=org'" & CRLF
sUsage = sUsage & "      Specifying the recipients container is not necessary and does not work" & CRLF &CRLF
sUsage = sUsage & "Password is the password for user" & CRLF  & CRLF
sUsage = sUsage & "1 Recurses list members. 0 does not recurse (optional - must be supplied if CN|UID id specified) " & CRLF  & CRLF
sUsage = sUsage & "CN prints Exch CN of list member; UID prints Exch alias (optional)" & CRLF & CRLF
sUsage = sUsage & "Example: cscript getmembers.vbs Rosnt47 " & chr(34) & "cn=tcs_users,cn=Distribution_
Lists,ou=ets,o=ets" & chr(34) & " " & chr(34) & "cn=juser, ou=ETS, o=ETS" & chr(34) & " p@ssw0rd 1 CN" & CRLF & CRLF

Set oArgs = WScript.Arguments

Tikiwiki 1.6 upgrade

Saturday 26 of April, 2003

coolHey, we upgraded the site to TikiWiki 1.6 back two weeks ago. A couple things to note. Pages (actualy templates) are compiled on first use. This speeds up access. However, it broke the Admin page. Had to grant php rights to use 32MB and 120 secs of run time. The Admin page is by far the most complex. After that compile, all was well and we're back to 24MB & 30 seconds


Mailman running as the wrong user

Saturday 08 of March, 2003

Mailman errors
Had a problem posting to mailing lists. It would return an error saying the script ran as the wrong user.
The answer was adding 'mail' as the default user in sendmail.cf


Mailman URL Info

Monday 24 of February, 2003

Resetting URL for a mailing list

From the /usr/local/mailman/bin directory

'./withlist -l -r fix_url MOC -u www.gmartin.org'

(where MOC is the listname
and www.gmartin.org is the new URL)

Check it using bin/dumpdb ../lists/moc/config.pck

Look for web_page_url near the end of the dump