Re: .sh script code to determine IPv4 or IPv6

2013-08-06 Thread markham breitbach
I have some scripts that do fairly crude IPv4/6 validation testing. It is 
generally
assumed that the input is coming from someone who knows what they are doing, 
but even the
best of us have fat fingers sometimes :) Having standardized routines for 
something like
this is great!

Thanks,
-Markham

On 13-08-06 11:45 AM, Teske, Devin wrote:
> On Aug 6, 2013, at 10:39 AM, Polytropon wrote:
>
>> On Tue, 6 Aug 2013 16:50:37 +, Teske, Devin wrote:
>>> And yes... to clarify... the port is a mirror of what's in 9.x base.
>>> (however, see my recent notes in a separate reply; TL;DR: port is
>>> 9.x only; proceed only if you know you don't care about the dialog(1)
>>> aspects of the library code).
>> I think it should be relatively unproblematic to fetch the
>> port and only use the subroutines "as is", even if it's just
>> for educational purposes. :-)
>>
> Right.
>
> Just a warning though, what is "fetched" in ports is actually in the format 
> of what's in HEAD (read: not in the format of what gets installed).
>
> For example, there are things that end up in /usr/share/bsdconfig that aren't 
> in the "bsdconfig/share/" source directory (e.g., all the stuff under 
> /usr/share/bsdconfig/networking is under the source directory 
> "bsdconfig/networking/share"). This may be counter-intuitive from an 
> "exploratory" view if looking at the source directory (what's fetched by 
> ports).
>
> And since the port Makefile will prevent you from turning that fetch'ed 
> source directory into an installed software (putting things where they end 
> up), it might be easier to grab this pre-built package that I stashed...
>
> http://druidbsd.sf.net/download/bsdconfig/bsdconfig-0.9.0.tbz
>
> Because then you can say "pkg_add" and everything will be in the right place 
> (/usr/share/bsdconfig/ will be flush with everything and you won't have to 
> hunt-and-peck through the source with a "maintainers" view).

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


Re: .sh script code to determine IPv4 or IPv6

2013-08-06 Thread markham breitbach
On 13-08-03 8:04 AM, Teske, Devin wrote:
> Actually, there's /usr/share/bsdconfig/media/tcpip.subr
>
>
I don't seem to have that (FreeBSD 8.3-RELEASE).  Where would I get that from? 


___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


Re: jls usage

2013-07-12 Thread markham breitbach
On 13-07-12 9:56 AM, Frank Leonhardt wrote:
> On 12/07/2013 16:32, Frank Leonhardt wrote:
>> I've tried using the actual jail name, and the hostname to be sure - nothing 
>> - and on
>> checking (jls -v) I'm somehow ending up with the Name being the same as the 
>> ID. I just
>> put this down to a quirk/bug (it's there in 8.2-9) but it sounds like it's 
>> not an issue
>> for anyone else. I'm defining them in rc.conf:
>
> jail_enable="yes"
> jail_list="one two three"
>
> jail_agnet_rootdir="/usr/jail/one"
> jail_agnet_hostname="one.mydomain.com"
> jail_agnet_ip="123.123.123.123"
> jail_agnet_devfs_enable="yes"
> jail_agnet_devfs_ruleset="devfsrules_jail"
>
 You've configured "one" and "two" and "three" in your jail_list, but quite 
 oddly...

 You have not defined "jail_one_*" or "jail_two_*" or "jail_three_*".

 I'm extremely confused as to how your jail even started!
>>>
>>> Sorry - should have said I'd obfuscated the IP addresses and hostnames 
>>> (it's not
>>> really "one.mydomain.com" ;-) ) Unfortunately I forgot to obfuscate the 
>>> jail name as
>>> fully as I thought in the startup lines. It should have read 
>>> jail_one_rootdir &c.
>>>
>>> As I said, it's been working happily for years on lots of different 
>>> installations and
>>> they're all configured the same. The only weirdness is that the jail name 
>>> appears in
>>> the table as it's number.
>>
>> A further clarification - I know using the jail utility defaults the jail 
>> name to that
>> of its ID if you don't specify one, and presume this is the mechanism 
>> messing it up
>> here. However as I've gone to the trouble of configuring them in rc.conf 
>> with names,
>> listing said names in jail_list and when commands like:
>>
>> service jail start one
>> service jail stop one
>>
>> work just fine, I don't see what I'm doing wrong! Incidentally, it doesn't 
>> matter if I
>> start them at boot time or start/stop later - the jail name always sets to 
>> the jail-iD,
>> and not the name specified. I suspect a bug in the rc.d script, but I can't 
>> be the
>> first person to notice, can I??? I'll take a look.
>>
>
> Okay - answering my own question and solved... It's a bug (or is that a 
> feature?).
>
> In /etc/rc.d/jail line 647 it currently reads:
>
> eval ${_setfib} jail ${_flags} -i ${_rootdir} ${_hostname} \
> \"${_addrl}\" ${_exec_start} > ${_tmp_jail} 2>&1 \
> 
> And it should (IMHO) read:
>
> eval ${_setfib} jail ${_flags} -n ${_jail} -i ${_rootdir} ${_hostname} \
> \"${_addrl}\" ${_exec_start} > ${_tmp_jail} 2>&1 \
> 
> Once changed, everything works find and your jails are named as per the 
> rc.conf file
> definitions. Can anyone think of a reason for NOT fixing this?
>
> Regards, Frank.
>
>
>
I see where you are defining a hostname, but not a jail name. Jail name cannot 
contain the
"." character.

-Markham
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


Re: Why doesn't this work?

2013-06-27 Thread markham breitbach
logger logs to syslog, so unless you have user.notice logging to 
/var/log/testing.log this
will probably not do what you are expecting. Have a look in /var/log/messages 
for
something like this.

Jun 27 16:38:03 xxx-hostname base_http_access: /var/log/testing.log

Otherwise, you may want to setup /etc/syslog.conf to log one of the local 
facilities to
/var/log/testing.log with something like this:

local6.* /var/log/testing.log

you will need to touch /var/log/testing.log and restart syslog, then change 
your script to
something like this:

echo "Testing, testing, testing" |/usr/bin/tee -a /var/log/httpd-access.log
|/usr/bin/logger -t base_http_access -p local6.info

Don't forget to update newsyslog.conf to rotate your new testing.log


-Markham


On 13-06-27 10:29 AM, Paul Schmehl wrote:
> echo "Testing, testing, testing" |/usr/bin/tee -a /var/log/httpd-access.log
> |/usr/bin/logger -t base_http_access /var/log/testing.log
>
> This writes to the httpd-access.log but does not write to 
> /var/log/testing.log. I'm
> probably reading the man page incorrectly, but I thought this should work. 
> For some
> reason absolutely nothing is being passed from tee to logger.
>
> What am I missing?
>

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


Re: looking for command to display default route ip address

2013-05-29 Thread markham breitbach
route -n get default


On 13-05-29 12:03 PM, Joe wrote:
> Hello list
>
> How do I find the ip address of the default route?
>
> thanks
> ___
> freebsd-questions@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


Re: check variable content size in sh script

2013-05-16 Thread markham breitbach
something like this:

#!/bin/sh
if [ $# -lt 1 ] ; then
echo "put a nickel in the slot, pal!"
exit 1;
fi
NUMCHARS=`echo $1 | wc -m`
if [ $NUMCHARS -lt 51 ] ; then
echo "You input "$NUMCHARS" characters."
exit 0
else
echo "whoa sailor I can't take all that!"
exit 1
fi


On 13-05-16 9:08 AM, Joe wrote:
> Hello
>
> Have script that has max size on content in a variable.
> How to code size less than 51 characters?
>
> Thanks
> ___
> freebsd-questions@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


Re: VIMAGE in GENERIC kernel

2013-05-09 Thread markham breitbach
   I was talking with BZ about this a few months ago, and it does not look
   terribly likely to happen any time soon, although I am still willing to
   pay good money for anyone willing and able to fix the problems with it.
   ---
   [1]Markham Breitbach
   Network Operations
   SSi   People, Ideas, Technology
   - - - - - - - - - - - - - - - - - - - - -
   +1 867 669 7500 work
   +1 867 669 7510 fax
   [2]markham_breitb...@ssimicro.com
   [3]www.ssimicro.com
   356B Old Airport Road
   Yellowknife , NT X1A 3T4
   Canada
   - - - - - - - - - - - - - - - - - - - - -
   Visit some of our other networks
   [4]www.qiniq.com   &   [5]www.airware.ca
   On 13-05-09 3:50 PM, [6]b...@todoo.biz wrote:

Hi,

I just wanted to know if there were any plans to have VIMAGE function / features
 included in GENERIC kernels sometimes soon ?


Sincerely yours.


�?���?���?���?���?���?���?���?���?���?���?���?��

BSD - BSD - BSD - BSD - BSD - BSD - BSD - BSD -

�?���?���?���?���?���?���?���?���?���?���?���?��

PGP ID --> 0x1BA3C2FD

___
[7]freebsd-questions@freebsd.org mailing list
[8]http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [9]"freebsd-questions-unsubscr...@freebsd.org"

References

   1. http://www.ssimicro.com/
   2. mailto:markham_breitb...@ssimicro.com
   3. http://www.ssimicro.com/
   4. http://www.qiniq.com/
   5. http://www.airware.ca/
   6. mailto:b...@todoo.biz
   7. mailto:freebsd-questions@freebsd.org
   8. http://lists.freebsd.org/mailman/listinfo/freebsd-questions
   9. mailto:freebsd-questions-unsubscr...@freebsd.org
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"

Re: sshd - time out idle connections

2013-05-03 Thread markham breitbach
Depending on the shell you are using, you may be able to set that to 
auto-logout, or you
could set a cron job to run every 5 minutes and terminate tty's with > 5min 
idle time.

Honestly though, you will rarely find a good technical solution to a social
problem--there's always a work-around--and this is a social problem.  If there 
is a
company security policy stating that ssh sessions are not to be left idling > 5 
min, then
make sure everyone is aware of this policy and start handing out pink slips to 
people that
violate it.

-M


On 13-05-03 8:28 AM, Fleuriot Damien wrote:
> Hello list,
>
>
>
> I'm facing this unusual demand at work where we need to time out idle SSH 
> connections for security purposes.
>
> I've checked the following options from sshd_config but none seems to fit my 
> needs :
> TCPKeepAlive
> ClientAliveCountMax
> ClientAliveInterval
>
>
> Basically, I'm trying to defeat the use of the following client-side option:
> ServerAliveInterval 5
>
>
> I'm afraid all I've hit now is dead ends.
>
>
> Has anyone ever had the same requirements before and, perhaps, found a 
> solution to this ?
>
> ___
> freebsd-questions@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


Re: cksum entire dir??

2012-09-13 Thread markham breitbach
Perhaps this would be a question best asked in a Linux Forum or on a Fedora 
list in that
case.  This is, after all, the FreeBSD Questions mailing list.


On 12-09-12 9:12 PM, Gary Kline wrote:
> On Wed, Sep 12, 2012 at 08:17:16PM -0500, Robert Bonomi wrote:
>>> Date: Wed, 12 Sep 2012 14:47:04 -0700
>>> From: Gary Kline 
>>> Subject: Re: cksum entire dir??
>>>
>>> On Wed, Sep 12, 2012 at 10:55:57AM -0700, Waitman Gobble wrote:
>> [sneck]
 are you sure it's not 'md5sum' ? ... that seems to be on all my 
 GNU/Linux machines.

>>>  yup, you be right.  altho we have no md5 [[does FBSD?]], fedora does 
>>>  have md5sum.  makes me wonder why this flavor didnt do at least a 
>>>  symlink.   oh well.
>> to find out what you do have, try 'apropos'.
>> e.g.
>>apropos checksum
>>apropos md5
>>apropos sha
>
>   this was the second thing I did.  I have basically 
>   cksum and sum
>
>   on this fedora box.
>
>   oh, and now, md5sum.
>
>> ___
>> freebsd-questions@freebsd.org mailing list
>> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
>> To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
> ___
> freebsd-questions@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


Re: cksum entire dir??

2012-09-11 Thread markham breitbach
As long as you are not moving files across mount points, you could always do 
something
like this:

cd $SOURCE_DIR && find . -print | cpio -dplm $DEST_DIR
rm -rf $SOURCE_DIR

That will create hard links from one directory to the other so you don't have 
to worry
about any file corruption since the data is never actually moved around on the 
disk.  It
should also be a whole lot faster than actually moving or copying the data and 
you don't
have to worry about running out of disk space half way through a copy.

-M


On 12-09-11 3:38 PM, Gary Kline wrote:
> I'm trying to checksum directories as I move them around.
> ive read the man page for sum and cksum ... or maybe skimmed 
> them.  no joy.  anybody know of a utility to do this?  I've 
> got files that are decades old... 
>
> tx, guys.
>
> gary
>
>
> ___
> freebsd-questions@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


Re: gpart and mbr give "no operating system" message at boot.

2012-09-07 Thread markham breitbach
Thanks Warren!

I was always under the impression that partition 3 was not to be touched as the 
"raw"
partition, so figured it was best left alone.
I was mostly concerned with installing MBR so it would still be compatible with
sysinstall, although I can't really think of a terribly good reason not to go 
GPT.
Installing the bootcode gets me a step closer, but is now puking at the loader. 
I'm not
sure if this is because the bootcode is coming from and 8.1 install, but at 
this point I'm
pretty much out of time and out of patience for this, since it is something of 
a bandaid
situation anyway.


On 12-09-07 2:48 PM, Warren Block wrote:
> On Fri, 7 Sep 2012, markham breitbach wrote:
>
>> I am trying to partition a disk to be used as the primary boot disk for a 
>> FreeBSD 8.3
>> installation using gpart to install an MBR partition.
>>
>> The system is an existing FreeBSD 5.2.1 system at a remote location (ie 
>> impossible to boot
>> from CD/netboot/etc), but has no data of value. To do this I am copying 
>> /boot and
>> mfsroot.gz from an mfsbsd iso image to boot to an MFS live system so I can 
>> wipe the drive
>> and do a clean install of 8.3. After booting to the MFS I do this:
>>
>> dd if=/dev/zero of=/dev/ad2 bs=1m count=1
>> gpart create -s mbr ad2
>> gpart add -b63 -t freebsd ad2
>> gpart create -s bsd ad2s1
>> gpart add -i1 -s 1g -t freebsd-ufs ad2s1
>> gpart add -i2 -s 1g -t freebsd-swap ad2s1
>> gpart add -i4 -s 2g -t freebsd-ufs ad2s1
>> gpart add -i5 -s 1g -t freebsd-ufs ad2s1
>> gpart add -i6 -t freebsd-ufs ad2s1
>> gpart set -a active -i 1 ad2
>> gpart bootcode -b /boot/mbr ad2
>> newfs /dev/ad2s1a
>> newfs -U /dev/ad2s1d
>> newfs -U /dev/ad2s1e
>> newfs -U /dev/ad2s1f
>>
>> followed by a sysinstall and some configuration. When I reboot I get a 
>> message that says
>> "Operating system not found" and the system hangs.
>>
>> If I follow the same procedure but create a gpt partition it works 
>> swimmingly. I am OK
>> with using a gpt partition if needed, but for the sake of curiosity I would 
>> like to know
>> why I can't make the MBR partition partition work. Am I missing something?
>
> Need to install bootcode to the slice also:
>
> # gpart bootcode -b /boot/boot ad2s1
>
> Why are you skipping partition 3? For that matter, don't give partition 
> numbers when
> adding, and gpart will just use the next available.
>
> If GPT works, there is little reason to use MBR.
> ___
> freebsd-questions@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


gpart and mbr give "no operating system" message at boot.

2012-09-07 Thread markham breitbach
I am trying to partition a disk to be used as the primary boot disk for a 
FreeBSD 8.3
installation using gpart to install an MBR partition.

The system is an existing FreeBSD 5.2.1 system at a remote location (ie 
impossible to boot
from CD/netboot/etc), but has no data of value.  To do this I am copying /boot 
and
mfsroot.gz from an mfsbsd iso image to boot to an MFS live system so I can wipe 
the drive
and do a clean install of 8.3.  After booting to the MFS I do this:

dd if=/dev/zero of=/dev/ad2 bs=1m count=1
gpart create -s mbr ad2
gpart add -b63 -t freebsd ad2
gpart create -s bsd ad2s1
gpart add -i1 -s 1g -t freebsd-ufs ad2s1
gpart add -i2 -s 1g -t freebsd-swap ad2s1
gpart add -i4 -s 2g -t freebsd-ufs ad2s1
gpart add -i5 -s 1g -t freebsd-ufs ad2s1
gpart add -i6 -t freebsd-ufs ad2s1
gpart set -a active -i 1 ad2
gpart bootcode -b /boot/mbr ad2
newfs /dev/ad2s1a
newfs -U /dev/ad2s1d
newfs -U /dev/ad2s1e
newfs -U /dev/ad2s1f

followed by a sysinstall and some configuration.  When I reboot I get a message 
that says
"Operating system not found" and the system hangs.

If I follow the same procedure but create a gpt partition it works swimmingly.  
I am OK
with using a gpt partition if needed, but for the sake of curiosity I would 
like to know
why I can't make the MBR partition partition work.  Am I missing something?


___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


Re: free sco unix

2011-06-18 Thread markham breitbach
I think this thread has wandered pretty far from having anything at all to do 
with freebsd.

Please find a more appropriate place for this discussion.


___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


8.1 broken inter-jail IP communication

2011-06-15 Thread markham breitbach
Good Day,

I am encountering an occassional problem under FreeBSD 8.1 where two jails on 
the same
server cannot reach each other after a reboot.

The Jails are running a mail server and ldap server, respectively and each has 
it's own IP
address.

The problem manifests itself after a reboot of the server.  After both jails 
have started
the mail server is unable to communicate with the ldap server.  From inside the 
jail, a
host unreachable is returned when trying to connect to the ldap server.

I have tried clearing the arp-cache and route-cache from the host and 
restarting both
jails, but the problem persists. The arp table from the host server (outside 
the jail)
shows an "(incomplete)" entry for the mail server when this is happening. 

I was able to ping the mail IP address from the host server and the incomplete 
entry
disappeared and, as expected, there was no longer an arp entry for the mail 
server and
communications between the two jails was restored.

Unfortunately I have had difficulty recreating this scenario in a test 
environment and it
only pops up occasionally in the field.  And while this workaround is suitable, 
it is a
bit of a PITA and I would like to know if this problem can be resolved.

So, I am wondering if anyone has some insights into what might be at the root 
of this
problem and what might be useful data to collect when this problem is happening 
to help
pin down the source of it.  Unfortunately, when service fails, I don't have a 
lot of time
to poke around at things as I need to do whatever I can to get it back up a 
quickly as
possible, although I am continuing to try and recreate this scenario in a test 
environment.

Best Regards,

Markham Breitbach
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"