<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	>

<channel>
	<title>Dastrup Tech Logs</title>
	<atom:link href="http://blog.dastrup.com/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://blog.dastrup.com</link>
	<description>Stuff to Remember</description>
	<pubDate>Tue, 29 Jun 2010 15:47:03 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Easy Centos SFTP Chroot User Jail</title>
		<link>http://blog.dastrup.com/?p=156</link>
		<comments>http://blog.dastrup.com/?p=156#comments</comments>
		<pubDate>Mon, 14 Jun 2010 15:58:46 +0000</pubDate>
		<dc:creator>James Dastrup</dc:creator>
		
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://blog.dastrup.com/?p=156</guid>
		<description><![CDATA[I had to set up a SFTP site for a customer which required a true chroot user jail - each user would go directly to their own home directory. Other requirements included: Users could not see other users folders, Authentication via Active Directory, and no SSH or other access.
After much research and trial-and-error, I figured [...]]]></description>
			<content:encoded><![CDATA[<p>I had to set up a SFTP site for a customer which required a true chroot user jail - each user would go directly to their own home directory. Other requirements included: Users could not see other users folders, Authentication via Active Directory, and no SSH or other access.<br />
After much research and trial-and-error, I figured out that OpenSSH simply would not work. The reason is OpenSSH, while it offers a ChrootDirectory option, has a very annoying limitation. From the man pages: <em>&#8220;This path, and all its components, must be root-owned directories that are not writable by any other user or group.&#8221;</em> So tell me, how do you chroot a user to their home directory if their home directory must be owned by root and not writable to the users? You can&#8217;t. You can jail the user to /home/ but then the user can see other users directories, even if they can&#8217;t access them. When trying to keep users, or clients, from seeing the names of other clients, that&#8217;s not an option.<br />
(On a side note, I was able to get it mostly working if in the /etc/samba/smb.conf file I had this line:
<pre>template homedir = /home/%U/%U</pre>
<p> which would create a home directory like this:
<pre>/home/joeblow/joeblow</pre>
<p> and in /etc/ssh/sshd_config set this:
<pre>ChrootDirectory /home/%u</pre>
<p> This would meet the security requirements, but would cause an annoyance to users since they would have to descend into a subdirectory to upload files.)<br />
rssh is another option some people use instead of openssh, but it has the exact same limitation, in addition of requiring you to copy a bunch of system files to the chroot directory.<br />
Then I discovered the <a href="http://www.proftpd.org/">ProFTPD Project</a>. The current version has a module called mod_sftp, which provides sftp access. So I changed my openssh port to something other than 22, installed proftpd (actually, I had to build and install it, since I couldn&#8217;t find a current version rpm for CentOS), and it worked beautifully. There are some steps I had to do to get it working smoothly with Active Directory, but once configured, now all my customer has to do is create a new Active Directory account - nothing else at all. Once done, the user can log on and go directly to their home directory, which even gets automatically created. Below are the settings and configuration files.</p>
<p>First, (optional, only if you want AD authentication) build CentOS 5.5 with a working Samba and Winbind configuration (see my other post <a href="http://blog.dastrup.com/?p=83">CentOS 5.2 and Winbind</a>). Verify that AD users can log in via SSH and their home directory gets created automatically.</p>
<p>Change the OpenSSH port:</p>
<pre>
#/etc/ssh/sshd_config
#Port 22
Port 222  #Something other than 22
</pre>
<p>ProFTPD 1.3.3rc4 build configuration options:</p>
<pre>./configure --prefix=/usr --sysconfdir=/etc --with-modules=mod_sftp</pre>
<pre>
#/etc/proftpd.conf
ServerName                      "My SFTP Server"
ServerType                      standalone
DefaultServer                   on
IdentLookups                    off
Port                            22
UseIPv6                         off
Umask                          022
MaxInstances                    30
User                            nobody
Group                           nobody
DefaultRoot ~
AllowOverwrite          on
&lt;Limit SITE_CHMOD&gt;
  DenyAll
&lt;/Limit&gt;

#SFTP Support
SFTPEngine      On
SFTPHostKey /etc/ssh/ssh_host_rsa_key
SFTPHostKey /etc/ssh/ssh_host_dsa_key
SFTPClientMatch ".*WinSCP.*" sftpProtocolVersion 4
SFTPOptions IgnoreSFTPUploadPerms

#Winbind support
PersistentPasswd   off
AuthPAMConfig samba
AuthPAM on
AuthOrder mod_auth_pam.c* mod_auth_unix.c
</pre>
<p>Create the proftpd init script (below) in /etc/init.d and chmod +x</p>
<pre>
#!/bin/sh
# $Id: proftpd.init,v 1.1 2004/02/26 17:54:30 thias Exp $
#
# proftpd        This shell script takes care of starting and stopping
#                proftpd.
#
# chkconfig: - 80 30
# description: ProFTPD is an enhanced FTP server with a focus towards \
#              simplicity, security, and ease of configuration. \
#              It features a very Apache-like configuration syntax, \
#              and a highly customizable server infrastructure, \
#              including support for multiple 'virtual' FTP servers, \
#              anonymous FTP, and permission-based directory visibility.
# processname: proftpd
# config: /etc/proftp.conf
# pidfile: /var/run/proftpd.pid

# Source function library.
. /etc/rc.d/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

# Check that networking is up.
[ ${NETWORKING} = "no" ] &#038;&#038; exit 0

[ -x /usr/sbin/proftpd ] || exit 0

RETVAL=0

prog="proftpd"

start() {
        echo -n $"Starting $prog: "
        daemon proftpd
        RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] &#038;&#038; touch /var/lock/subsys/proftpd
}

stop() {
        echo -n $"Shutting down $prog: "
        killproc proftpd
        RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] &#038;&#038; rm -f /var/lock/subsys/proftpd
}

# See how we were called.
case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  status)
        status proftpd
        RETVAL=$?
        ;;
  restart)
        stop
        start
        ;;
  condrestart)
        if [ -f /var/lock/subsys/proftpd ]; then
          stop
          start
        fi
        ;;
  reload)
        echo -n $"Re-reading $prog configuration: "
        killproc proftpd -HUP
        RETVAL=$?
        echo
        ;;
  *)
        echo "Usage: $prog {start|stop|restart|reload|condrestart|status}"
        exit 1
esac

exit $RETVAL
</pre>
<p>Rotate the logs</p>
<pre>
#/etc/logrotate.d/proftp
/var/log/proftp {
    missingok
    notifempty
    daily
    rotate 7
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.dastrup.com/?feed=rss2&amp;p=156</wfw:commentRss>
		</item>
		<item>
		<title>Convert IIS SSL Cert to Apache</title>
		<link>http://blog.dastrup.com/?p=147</link>
		<comments>http://blog.dastrup.com/?p=147#comments</comments>
		<pubDate>Fri, 27 Nov 2009 21:07:30 +0000</pubDate>
		<dc:creator>James Dastrup</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.dastrup.com/?p=147</guid>
		<description><![CDATA[Export your SSL Cert to a PFX file and include the private key. Copy it to your apache server.
# openssl pkcs12 -in www.yourdomain.com.pfx -nocerts -out www.yourdomain.key.pem
# openssl pkcs12 -in www.yourdomain.com.pfx -clcerts -nokeys -out www.yourdomain.cert.pem
# openssl rsa -in www.yourdomain.key.pem -out www.yourdomain.key
Copy contents of www.yourdomain.cert.pem between and including BEGIN CERTIFICATE and END CERTIFICATE into www.yourdomain.cert.
Here&#8217;s a sample [...]]]></description>
			<content:encoded><![CDATA[<p>Export your SSL Cert to a PFX file and include the private key. Copy it to your apache server.</p>
<pre># openssl pkcs12 -in www.yourdomain.com.pfx -nocerts -out www.yourdomain.key.pem
# openssl pkcs12 -in www.yourdomain.com.pfx -clcerts -nokeys -out www.yourdomain.cert.pem
# openssl rsa -in www.yourdomain.key.pem -out www.yourdomain.key</pre>
<p>Copy contents of www.yourdomain.cert.pem between and including BEGIN CERTIFICATE and END CERTIFICATE into www.yourdomain.cert.</p>
<p>Here&#8217;s a sample apache virtualhost config file that includes redirecting the non-SSL site to the new SSL site:</p>
<pre>&lt;VirtualHost *:80&gt;
 ServerName www.yourdomain.com
 Redirect permanent / https://www.yourdomain.com/
&lt;/VirtualHost&gt;

&lt;VirtualHost *:443&gt;
 ServerName www.yourdomain.com
 DocumentRoot /var/www/html
 &lt;Directory /var/www/html&gt;
  AllowOverride All
 &lt;/Directory&gt;
 SSLEngine on
 SSLCertificateFile /path/to/www.yourdomain.cert
 SSLCertificateKeyFile /path/to/www.yourdomain.key
&lt;/VirtualHost&gt;</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.dastrup.com/?feed=rss2&amp;p=147</wfw:commentRss>
		</item>
		<item>
		<title>Find SQL queries that use too much CPU</title>
		<link>http://blog.dastrup.com/?p=143</link>
		<comments>http://blog.dastrup.com/?p=143#comments</comments>
		<pubDate>Wed, 11 Nov 2009 22:32:11 +0000</pubDate>
		<dc:creator>James Dastrup</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.dastrup.com/?p=143</guid>
		<description><![CDATA[
SELECT total_worker_time/execution_count AS AvgCPU
, total_worker_time AS TotalCPU
, total_elapsed_time/execution_count AS AvgDuration
, total_elapsed_time AS TotalDuration
, (total_logical_reads+total_physical_reads)/execution_count AS AvgReads
, (total_logical_reads+total_physical_reads) AS TotalReads
, execution_count
, SUBSTRING(st.TEXT, (qs.statement_start_offset/2)+1
, ((CASE qs.statement_end_offset  WHEN -1 THEN datalength(st.TEXT)
ELSE qs.statement_end_offset
END - qs.statement_start_offset)/2) + 1) AS txt
, query_plan
FROM sys.dm_exec_query_stats AS qs
cross apply sys.dm_exec_sql_text(qs.sql_handle) AS st
cross apply sys.dm_exec_query_plan (qs.plan_handle) AS qp
ORDER BY 1 DESC

Take note of the [...]]]></description>
			<content:encoded><![CDATA[<pre>
SELECT total_worker_time/execution_count AS AvgCPU
, total_worker_time AS TotalCPU
, total_elapsed_time/execution_count AS AvgDuration
, total_elapsed_time AS TotalDuration
, (total_logical_reads+total_physical_reads)/execution_count AS AvgReads
, (total_logical_reads+total_physical_reads) AS TotalReads
, execution_count
, SUBSTRING(st.TEXT, (qs.statement_start_offset/2)+1
, ((CASE qs.statement_end_offset  WHEN -1 THEN datalength(st.TEXT)
ELSE qs.statement_end_offset
END - qs.statement_start_offset)/2) + 1) AS txt
, query_plan
FROM sys.dm_exec_query_stats AS qs
cross apply sys.dm_exec_sql_text(qs.sql_handle) AS st
cross apply sys.dm_exec_query_plan (qs.plan_handle) AS qp
ORDER BY 1 DESC
</pre>
<p>Take note of the AvgCPU value. Fix the query, clear the query cache with:</p>
<pre>
DBCC FREEPROCCACHE
</pre>
<p>run the query again a few times, and run the above query again. Compare the numbers.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.dastrup.com/?feed=rss2&amp;p=143</wfw:commentRss>
		</item>
		<item>
		<title>Mixing 64 and 32 bit applications pools on OWA website</title>
		<link>http://blog.dastrup.com/?p=135</link>
		<comments>http://blog.dastrup.com/?p=135#comments</comments>
		<pubDate>Sat, 23 May 2009 22:09:47 +0000</pubDate>
		<dc:creator>James Dastrup</dc:creator>
		
		<category><![CDATA[Microsoft]]></category>

		<category><![CDATA[Windows]]></category>

		<category><![CDATA[IIS7]]></category>

		<guid isPermaLink="false">http://blog.dastrup.com/?p=135</guid>
		<description><![CDATA[If you need to create and run a 32-bit application pool on the same website you are running Exchange OWA, usually the Default Web Site, you need to make a couple changes. For example, you want to run an old ASP component that only runs in 32 bit mode.

Register the DLL - copy it to [...]]]></description>
			<content:encoded><![CDATA[<p>If you need to create and run a 32-bit application pool on the same website you are running Exchange OWA, usually the Default Web Site, you need to make a couple changes. For example, you want to run an old ASP component that only runs in 32 bit mode.</p>
<ol>
<li>Register the DLL - copy it to \Windows\SysWOW64 and run regsvr32 your.dll</li>
<li>Create a 32 bit application pool in IIS 7 - On the advanced settings, set Enable 32-bit applications = True</li>
<li>Create a subfolder and assign your 32-bit app pool to it.</li>
<li>Modify \Windows\system32\inetsrv\config\applicationhost.config:
<pre>&lt;location path="Default Web Site"&gt;
        &lt;system.webServer&gt;
            isapiFilters&gt;
                &lt;clear /&gt;
                &lt;filter name="Exchange OWA Cookie Authentication ISAPI Filter" path="D:\Program Files\Microsoft\Exchange Server\ClientAccess\owa\auth\owaauth.dll" enabled="true" preCondition="bitness64" /&gt;
                &lt;filter name="Exchange ActiveSync ISAPI Filter" path="D:\Program Files\Microsoft\Exchange Server\ClientAccess\sync\bin\AirFilter.dll" enabled="true" preCondition="bitness64" /&gt;
            &lt;/isapiFilters&gt;</pre>
<p>Notice the added preCondition=&#8221;bitness64&#8243;. This tells those filters to only run on 64 bit app pools.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://blog.dastrup.com/?feed=rss2&amp;p=135</wfw:commentRss>
		</item>
		<item>
		<title>How to Thin Provision on VMware ESXi 3.5 Free version</title>
		<link>http://blog.dastrup.com/?p=119</link>
		<comments>http://blog.dastrup.com/?p=119#comments</comments>
		<pubDate>Thu, 30 Apr 2009 02:31:27 +0000</pubDate>
		<dc:creator>James Dastrup</dc:creator>
		
		<category><![CDATA[Linux]]></category>

		<category><![CDATA[vmware]]></category>

		<guid isPermaLink="false">http://blog.dastrup.com/?p=119</guid>
		<description><![CDATA[VMware does not offer a supported method to create a thin disk on the free version of ESXi 3.5. Thin = only allocate space as the guest OS demands. The GUI, Virtual Infrastructure Client, only creates zeroedthick disks (pre-allocated and zeroed on demand), therefore using up much more space than required. The command-line tools, RCLI, either on [...]]]></description>
			<content:encoded><![CDATA[<p>VMware does not offer a supported method to create a <em>thin</em> disk on the free version of ESXi 3.5. Thin = only allocate space as the guest OS demands. The GUI, Virtual Infrastructure Client, only creates zeroedthick disks (pre-allocated and zeroed on demand), therefore using up much more space than required. The command-line tools, RCLI, either on Windows or in VIMA, are read-only, therefore don&#8217;t work for anything useful. If you try, you get an error <em>fault.RestrictedVersion.summary</em>; in other words - you&#8217;re not allowed to do that. But there is a way:</p>
<p>On the console (the yellow server console), press ALT-F1.<br />
Type the command <strong>unsupported</strong> (you won&#8217;t see your typing) and you&#8217;ll get a password prompt.<br />
Enter your root password, and then you should get a busybox prompt.<br />
Use the vmkfstools to create your disk, like this:</p>
<pre>vmkfstools -c 10G -d thin -a lsilogic /vmfs/volumes/[Your_Datastore]/[YourGuestOS]/ThinDisk1.vmdk</pre>
<p>If you <strong>ls -lh</strong> the directory, it will show the full size, but if you <strong>df -h</strong> you&#8217;ll see that very little space was actually used.</p>
<p>While you&#8217;re on the hidden console, might as well enable ssh access, too:</p>
<p><strong>vi /etc/inetd.conf</strong> and uncomment the ssh line. Look up the Process ID, <strong>ps | grep inetd</strong>, and restart it with <strong>kill -HUP [pid]</strong></p>
<p>Yeah, pretty cool.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.dastrup.com/?feed=rss2&amp;p=119</wfw:commentRss>
		</item>
		<item>
		<title>Partition alignment</title>
		<link>http://blog.dastrup.com/?p=104</link>
		<comments>http://blog.dastrup.com/?p=104#comments</comments>
		<pubDate>Wed, 11 Mar 2009 19:19:53 +0000</pubDate>
		<dc:creator>James Dastrup</dc:creator>
		
		<category><![CDATA[Microsoft]]></category>

		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://blog.dastrup.com/?p=104</guid>
		<description><![CDATA[Windows:

strComputer = "."
Set wmi= GetObject("winmgmts:\\" &#038; strComputer &#038; "\root\CIMV2")
Set col = wmi.ExecQuery("SELECT * FROM Win32_DiskPartition",,48) 

For Each item in col
	Wscript.Echo "Disk: " &#038; item.DiskIndex &#038; "  Partition: " &#038; item.Index &#038; "  StartingOffset: " &#038; item.StartingOffset/1024 &#038; "KB"     

Next

Set partition alignment on a new partition, required on &#60;= Win2003

c:\>diskpart.exe
DISKPART>list [...]]]></description>
			<content:encoded><![CDATA[<p>Windows:</p>
<pre>
strComputer = "."
Set wmi= GetObject("winmgmts:\\" &#038; strComputer &#038; "\root\CIMV2")
Set col = wmi.ExecQuery("SELECT * FROM Win32_DiskPartition",,48) 

For Each item in col
	Wscript.Echo "Disk: " &#038; item.DiskIndex &#038; "  Partition: " &#038; item.Index &#038; "  StartingOffset: " &#038; item.StartingOffset/1024 &#038; "KB"     

Next
</pre>
<p>Set partition alignment on a new partition, required on &lt;= Win2003</p>
<pre>
c:\>diskpart.exe
DISKPART>list disk
DISKPART>select disk x
DISKPART>create partition primary align=64
DISKPART>exit
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.dastrup.com/?feed=rss2&amp;p=104</wfw:commentRss>
		</item>
		<item>
		<title>CentOS 5.2 and Winbind</title>
		<link>http://blog.dastrup.com/?p=83</link>
		<comments>http://blog.dastrup.com/?p=83#comments</comments>
		<pubDate>Sat, 07 Feb 2009 22:55:35 +0000</pubDate>
		<dc:creator>James Dastrup</dc:creator>
		
		<category><![CDATA[Linux]]></category>

		<category><![CDATA[Microsoft]]></category>

		<category><![CDATA[Windows]]></category>

		<category><![CDATA[samba]]></category>

		<category><![CDATA[Winbind]]></category>

		<guid isPermaLink="false">http://blog.dastrup.com/?p=83</guid>
		<description><![CDATA[Built a Linux Samba server for a file server this week. It&#8217;s in a satellite office connected via OpenVPN to the main office, which hosts Active Directory. Samba is running winbind, which allows transparent access to resources and minimal management on the server. I learned that winbind&#8217;s offline logons work for local or ssh logon [...]]]></description>
			<content:encoded><![CDATA[<p>Built a Linux Samba server for a file server this week. It&#8217;s in a satellite office connected via OpenVPN to the main office, which hosts Active Directory. Samba is running winbind, which allows transparent access to resources and minimal management on the server. I learned that winbind&#8217;s offline logons work for local or ssh logon to the server if Active Directory is unavailable, but it <em>does not</em> allow offline access to the server via network shares; the VPN and Active Directory must be up to initially log on and get drives mapped. Outages during the day do not impact file or printer access. This could be disastrous in certain situations, but considering the bulk of the work this office does is via E-mail or Citrix, an Internet outage means they don&#8217;t get any work done anyway.</p>
<p>This setup is very similar to plain ads security mode as described in my earlier post, <a href="http://blog.dastrup.com/?p=8">Configure Samba with Domain Security Mode</a>, but, while a little more complicated to set up, has more features, such as local logon privileges for AD users.</p>
<p>Had a heck of a time getting winbind working on CentOS 5.2. Most everything worked, joined to the domain, wbinfo -u returned users, but getent wasn&#8217;t working. `getent passwd` only returned local users. `getent group` returned local groups and only two domain groups, preceded by BUILTIN. Finally figured out I had this in my smb.conf:</p>
<pre>winbind trusted domains only = yes</pre>
<p>when it should be this:</p>
<pre>winbind trusted domains only = no</pre>
<p>Just in case it helps anyone else, here&#8217;s relevant portions from my config files:</p>
<pre>#/etc/samba/smb.conf

[global]

   workgroup = DOMAIN
   password server = myadserver.domain.com
   realm = DOMAIN.COM
   security = ads
   idmap uid = 10000-20000
   idmap gid = 50000-60000
   winbind separator = +
   template homedir = /home/%U
   template shell = /bin/bash
   printing = cups
   printcap name = cups
   load printers = yes
   encrypt passwords = yes
   passdb backend = tdbsam
   server string = MY-SERVER
   os level = 20
   client use spnego = yes
   winbind offline logon = yes
   winbind use default domain = yes
   winbind enum users = yes
   winbind enum groups = yes
   winbind trusted domains only = no</pre>
<pre>#/etc/krb5.conf

[logging]
default = FILE:/var/log/krb5libs.log
kdc = FILE:/var/log/krb5kdc.log
admin_server = FILE:/var/log/kadmind.log

[libdefaults]
 default_realm = DOMAIN.COM
 dns_lookup_realm = true
 dns_lookup_kdc = true

[realms]
DOMAIN.COM = {
   default_domain = domain.com
  kdc = 192.168.0.5:88
  kdc = 192.168.0.5
  kdc = myadserver.domain.com
  admin_server = 192.168.0.5:749
  default_domain = domain.com
}

[domain_realm]
domain.com = DOMAIN.COM
.domain.com = DOMAIN.COM

[kdc]
 profile = /var/kerberos/krb5kdc/kdc.conf

[appdefaults]
 pam = {
   debug = false
   ticket_lifetime = 36000
   renew_lifetime = 36000
   forwardable = true
   krb4_convert = false
 }</pre>
<pre>#/etc/pam.d/system-auth

auth        required      pam_env.so
auth        sufficient    pam_unix.so nullok try_first_pass
auth        requisite     pam_succeed_if.so uid &gt;= 500 quiet
auth        sufficient    pam_krb5.so use_first_pass
auth        sufficient    pam_winbind.so use_first_pass
auth        required      pam_deny.so

account     required      pam_unix.so broken_shadow
account     sufficient    pam_succeed_if.so uid &lt; 500 quiet
account     [default=bad success=ok user_unknown=ignore] pam_krb5.so
account     [default=bad success=ok user_unknown=ignore] pam_winbind.so
account     required      pam_permit.so

password    requisite     pam_cracklib.so try_first_pass retry=3
password    sufficient    pam_unix.so md5 shadow nullok try_first_pass use_authtok
password    sufficient    pam_krb5.so use_authtok
password    sufficient    pam_winbind.so use_authtok
password    required      pam_deny.so

session     optional      pam_keyinit.so revoke
session     required      pam_limits.so
session     [success=1 default=ignore] pam_succeed_if.so service in crond quiet use_uid
session     required      pam_unix.so
session     required      pam_mkhomedir.so skel=/etc/skel/ umask=0022
session     optional      pam_krb5.so</pre>
<pre>#/etc/nsswitch.conf

&lt;snip&gt;
passwd:  files winbind
shadow:  files winbind
group:    files winbind
&lt;/snip&gt;</pre>
<pre>#/etc/security/pam_winbind.conf

[global]

;debug = yes
cached_login = yes
;krb5_auth = yes
;krb5_ccache_type = FILE
;require_membership_of =</pre>
<p>In order to get shared documents on the server to act more Windows-like, I had to change the default umask and use ACL&#8217;s instead of default file security:</p>
<pre>
#/etc/bashrc

&lt;snip&gt;
if [ $UID -gt 99 ] &amp;&amp; [ "`id -gn`" = "`id -un`" ]; then
        umask 002
else
        umask 002
fi
&lt;/snip&gt;
</pre>
<pre>
#/etc/samba/smb.conf

#========= Share Definitions ========
[Share]
  create mask = 0770
  force create mode = 0770
  force directory mode = 0770
  force group = DOMAIN+Group_Name</pre>
<p>Use chown and chmod to set your domain groups as owners of your shared directories. Should look something like this:</p>
<pre># ls -l
drwxrwx--- 2 root DOMAIN+domain users 4096 Feb  6 15:13 Docs</pre>
<p>Then for ACL&#8217;s, use setfacl:</p>
<pre># setfacl -d -R -m u::rwx,g::rwx,m::rwx Docs</pre>
<p>Use getfacl to confirm. When you ls a directory after that, you&#8217;ll see a + sign next to the normal permissions</p>
<pre># ls -l
drwxrwx---+ 2 root DOMAIN+domain users 4096 Feb  6 15:13 Docs</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.dastrup.com/?feed=rss2&amp;p=83</wfw:commentRss>
		</item>
		<item>
		<title>Windows 2008 NLB, dual-nics and routing</title>
		<link>http://blog.dastrup.com/?p=69</link>
		<comments>http://blog.dastrup.com/?p=69#comments</comments>
		<pubDate>Fri, 30 Jan 2009 20:42:33 +0000</pubDate>
		<dc:creator>James Dastrup</dc:creator>
		
		<category><![CDATA[Microsoft]]></category>

		<category><![CDATA[Windows]]></category>

		<category><![CDATA[2008]]></category>

		<category><![CDATA[NLB]]></category>

		<guid isPermaLink="false">http://blog.dastrup.com/?p=69</guid>
		<description><![CDATA[I set up NLB in unicast mode on a couple Windows 2008 servers using dual-nics. Everything worked fine, except hosts outside the subnet could not access the cluster IP. The same setup works with Windows 2003. This is only a problem because I prefer to disable all services on the clustered NICs except IP, since [...]]]></description>
			<content:encoded><![CDATA[<p>I set up NLB in unicast mode on a couple Windows 2008 servers using dual-nics. Everything worked fine, except hosts outside the subnet could not access the cluster IP. The same setup works with Windows 2003. This is only a problem because I prefer to disable all services on the clustered NICs except IP, since I&#8217;m only load-balancing a few IP services and I want internal communication to use the primary NICs. Here&#8217;s my setup:</p>
<pre>Server 1
-------------------------
NIC1 (Public)
IP 192.168.1.10
Gateway 192.168.1.1

NIC2 (NLB)
IP 192.168.1.11
No Gateway, File &#038; Print, MS Client or DNS Registration

Server 2
-------------------------
NIC1 (Public)
IP 192.168.1.12
Gateway 192.168.1.1

NIC2 (NLB)
IP 192.168.1.13
No Gateway, File &#038; Print, MS Client or DNS Registration

Cluster
-------------------------
IP 192.168.1.14</pre>
<p>For 2008, it can be fixed with the netsh command. To get it working:</p>
<pre>
C:\>netsh interface show int

Admin State    State          Type             Interface Name
-------------------------------------------------------------------------
Enabled        Connected      Dedicated        NLB
Enabled        Connected      Dedicated        Public
</pre>
<p>Note the name of the NIC used for the cluster. My case, NLB. Then run:</p>
<pre>
C:\>netsh interface ipv4 set interface "NLB" forwarding=enabled

Ok.
</pre>
<p>Also have to make some routing changes, since the NLB NIC&#8217;s don&#8217;t have a default gateway, and adding one can cause confusion to the OS. I want all remote traffic to source from the NLB NIC&#8217;s, so I figure out the interface number with:</p>
<pre>
C:\route print
==============================================
Interface List
 [XX] ..[NLB MAC ADDRESS]... [NLB NIC Model]
==============================================
</pre>
<p>and add a persistent default route on both nodes with this:</p>
<pre>
C:\route add 0.0.0.0 mask 0.0.0.0 192.168.1.1 if [XX] -p
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.dastrup.com/?feed=rss2&amp;p=69</wfw:commentRss>
		</item>
		<item>
		<title>Goodbye, Vista</title>
		<link>http://blog.dastrup.com/?p=63</link>
		<comments>http://blog.dastrup.com/?p=63#comments</comments>
		<pubDate>Wed, 21 Jan 2009 23:50:12 +0000</pubDate>
		<dc:creator>James Dastrup</dc:creator>
		
		<category><![CDATA[Microsoft]]></category>

		<category><![CDATA[Windows]]></category>

		<category><![CDATA[Vista]]></category>

		<guid isPermaLink="false">http://blog.dastrup.com/?p=63</guid>
		<description><![CDATA[I tried. For over 2 years now I&#8217;ve tried to use Vista. I believed early on that it would improve, someday it will be standard on every computer, eventually you won&#8217;t be able to buy XP anymore, etc. I believed that I needed to use it in order to better support my customers with it. [...]]]></description>
			<content:encoded><![CDATA[<p>I tried. For over 2 years now I&#8217;ve tried to use Vista. I believed early on that it would improve, someday it will be standard on every computer, eventually you won&#8217;t be able to buy XP anymore, etc. I believed that I needed to use it in order to better support my customers with it. I believed lots of things, but I don&#8217;t believe anymore.</p>
<p>86 hours. That&#8217;s the time I have waited the last two years. Over two work-weeks of waiting. Several thousand dollars of waiting. Waiting for what?  Waiting for my computer to resume from hibernation or cold boot. It takes about 10 minutes before my computer is usable. I have a modern laptop, T9300 proc, SATA2 HDD, 4 GB RAM, etc. Previously, I had another modern laptop, T7xxx proc, 4 GB RAM, etc. The hard drive light just won&#8217;t stop blinking for ten minutes, the stupid green circular icon keeps spinning. I can&#8217;t use standby overnight or else my battery is often near dead, if it even stays in standby that long, and sometimes I need my battery first thing in the AM.</p>
<p>Most computers still come with XP pre-installed. Some computers, specifically certain HP or Dell configurations, only come with XP installed. Most of my clients still use XP. Why? Because Vista offers nothing for businesses. What can businesses do now that they couldn&#8217;t do with XP? Nothing.</p>
<p>Now I have to wait for Windows 7 to save me, somehow recoup the 86 hours of time lost, but I&#8217;m not holding my breath. When I read an article that lists as one of its new great features: &#8220;maximized windows now feature transparent borders&#8221; as a new operating system highlight, I don&#8217;t really have much hope. Is Microsoft really going to rewrite their OS to remove the bulk that Vista added, or just hope that hardware is faster by the time it is released and therefore the time wasted will be reduced?</p>
<p>In a few short hours I will have <em>upgraded</em> to a previous, more reliable, and faster, operating system.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.dastrup.com/?feed=rss2&amp;p=63</wfw:commentRss>
		</item>
		<item>
		<title>ATI fglrx proprietary driver problems</title>
		<link>http://blog.dastrup.com/?p=62</link>
		<comments>http://blog.dastrup.com/?p=62#comments</comments>
		<pubDate>Fri, 14 Nov 2008 19:43:03 +0000</pubDate>
		<dc:creator>James Dastrup</dc:creator>
		
		<category><![CDATA[Hardware]]></category>

		<category><![CDATA[Linux]]></category>

		<category><![CDATA[MythTV]]></category>

		<category><![CDATA[ati]]></category>

		<category><![CDATA[fglrx]]></category>

		<category><![CDATA[hdtv]]></category>

		<guid isPermaLink="false">http://blog.dastrup.com/?p=62</guid>
		<description><![CDATA[I know many hate ATI+Linux, but I&#8217;m not a gamer and usually run linux by command line only. I have a ATI 9600 Pro AGP video card that I&#8217;ve been using in one of my MythTV frontend&#8217;s for years. In order to play high definition resolutions (720p 1080i) I need to use ATI&#8217;s proprietary linux [...]]]></description>
			<content:encoded><![CDATA[<p>I know many hate ATI+Linux, but I&#8217;m not a gamer and usually run linux by command line only. I have a ATI 9600 Pro AGP video card that I&#8217;ve been using in one of my MythTV frontend&#8217;s for years. In order to play high definition resolutions (720p 1080i) I need to use ATI&#8217;s proprietary linux driver, fglrx. And it works well for that, as well as my nVidia card in my other frontends. I end up rebuilding my frontends maybe every 9-12 months, just for fun. That&#8217;s where nVidia outperforms ATI. The ATI driver can be much more difficult to get running properly, partly because they change it so drastically, at least it&#8217;s different every time I rebuild a frontend.<br />
The latest problem is the driver and assocated configuration tool, aticonfig. fglrx now basically ignores any options in xorg.conf except for the options available by the aticonfig tool. For example, it reads EDID information from your display and will only output a mode that your display allows. Sounds great, right? Sure, assuming fglrx is reading EDID properly, or if at all. If it can&#8217;t read EDID, the max resolution is 1024&#215;768. You can&#8217;t tell it to ignore EDID and specify a modeline instead. This happened to me. I tried every possible combination of settings in xorg.conf, reinstalled the driver, from RPM and the installer from ATI&#8217;s website. But EDID came up as invalid according to /var/log/Xorg.0.log.<br />
Finally figured out there is a file that the driver uses that can become incorrect or corrupt. I deleted this file:</p>
<pre># rm /etc/ati/amdpcsdb</pre>
<p>and everything started working great. X came up at 1080p and MythTV works great, although openGL menu transitions are a little slow with my card, so I turned that off.  Apparently its possible to modify settings in that file, which overrides anything in xorg.conf.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.dastrup.com/?feed=rss2&amp;p=62</wfw:commentRss>
		</item>
	</channel>
</rss>
