From altodorado at blainebuxton.com Sun Dec 2 19:41:05 2007 From: altodorado at blainebuxton.com (Blaine Buxton) Date: Mon, 03 Dec 2007 03:41:05 +0000 Subject: [Omaha.pm] Dec 4 2007 - Matt Secoske - Processing - ODYNUG Message-ID: <5B3D5144-40A7-4D22-BD47-D773AAC03F5D@blainebuxton.com> The next Perl Mongers meeting is tomorrow night. We're meeting w/ the ODYNUG again, see below. Also, I'm volunteering to give the following presentations: - A 3-minute presentation on the Takahashi presentation method using FireFox & XUL. http://jays.net/takahashi_xul/takahashi.xul?data=english.data - An hour (half hour?) presentation on Perl Moose: Moose is a complete modern object system for Perl 5. http://www.iinteractive.com/moose/ - An hour (half hour?) presentation on Perl Catalyst: Catalyst is a web application framework with some similarities to Ruby on Rails. http://catalyst.perl.org/ I hope to see you tomorrow night. :) j Omaha Perl Mongers: http://omaha.pm.org ================== Still eating leftovers from Thanksgiving? Had your fill of Christmas shopping? Sounds like you need a break. Why not head on down to the local Omaha Dynamic Language User's Group and meeting the best and brightest that Omaha has to offer? This month we are honored to have world famous "No Fluff" wowie zowie speaker, Matt Secoske presenting. He will be showing us the ins and outs of a framework called "Processing". It's a graphical canvas with a programming interface. Simple to use and the results are jaw dropping. Spice up your Christmas cards this year. There will be pizza and drinks provided. Free food, drink, great conversation, an exciting presentation, and an amazing new technique to make cards. What do you have to lose? Christmas shopping can wait. It's time to have some fun. Topic Processing: Cool Graphics Now Speaker Matt Secoske Time December 4, 7-9pm Location UNO's Peter Kiewit Institute (PKI) building 1110 South 67th Street Omaha, NE -- Blaine Buxton Simplicity Synthesist http://blog.blainebuxton.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/omaha-pm/attachments/20071203/992b89de/attachment.html From jay at jays.net Wed Dec 5 12:01:19 2007 From: jay at jays.net (Jay Hannah) Date: Wed, 05 Dec 2007 14:01:19 -0600 Subject: [Omaha.pm] Perl (and BioPerl?) - BIIG Meeting This Monday! Message-ID: <4757038F.6090202@jays.net> Kate used a lot of Perl gluing MTAP together: http://biobase.ist.unomaha.edu/mediawiki/index.php/Main_Page Her presentation will be very sciency and not Perly, but it may be of interest if you're interested in Perl & Bioinformatics. j Dear Bioinformatics Student, There will be a BIIG meeting this coming Monday, December 10th. Please come hear Kate Dempsey, Bioinformatics major to be graduating this December, and NE-INBRE Scholar, present on ?The Development of Parsing Tools for Motif Detection Methods?. Please see the attached abstract. The meeting will be at the Peter Kiewit Institue, 67th & Pacfic St., in room 279. *PLEASE NOTE THE ADJUSTED MEETING TIME OF 11:15a.m. FOR LUNCH AND 11:30a.m. FOR THE PRESENTATION.* Please RSVP, as quickly as possible would be appreciated, to me at this address here or at 554-3889. Any questions, please let me know. Thank you. Connie Jones University of Nebraska at Omaha UNO Bioinformatics Program Coordinator Peter Kiewit Institute, rm 253 (402) 554-3889 www.unomaha.edu/bioinformatics -------------- next part -------------- A non-text attachment was scrubbed... Name: Abstract_Dempsey_12-10.pdf Type: application/pdf Size: 7870 bytes Desc: not available Url : http://mail.pm.org/pipermail/omaha-pm/attachments/20071205/1d0c331f/attachment.pdf From webmaster at tvortex.net Thu Dec 6 09:03:44 2007 From: webmaster at tvortex.net (Tony Simons) Date: Thu, 6 Dec 2007 11:03:44 -0600 Subject: [Omaha.pm] Net::SSH::Perl and sudo or su Message-ID: I'm a bit new to perl and am having a bit of trouble getting a sudo (or su for that matter) to work through Net::SSH::Perl. Interactive with a shell doesn't seem to do anything for me. And I'd like to not have to fuss with the sudoers to turn off the requiretty. Snippets of my code utilizing it... #!/usr/bin/perl -w #---------------Includes---------------- use strict; use warnings; #use Getopt::Std; use Net::SSH::Perl; use Term::ReadKey; use Getopt::Long; .... my $cmd = "sudo test"; my $ssh = Net::SSH::Perl->new($hos, interactive =>1, use_pty => 1, debug => 1, port => $port, protocol => '2,1', options => ["BatchMode yes"]) or die("Could not connect"); #$ssh->login($user, $pass); $ssh->login($user); #$ssh->shell; my ($stdout, $stderr, $exit) = $ssh->cmd($cmd); print "OUT:$stdout \nERR:$stderr \nEXIT:$exit \n"; .... Response from a sudo test Use of uninitialized value in concatenation (.) or string at ./SerialPush.pl line 79. OUT: ERR:sudo: sorry, you must have a tty to run sudo EXIT:1 ... Response from a su root test Use of uninitialized value in concatenation (.) or string at ./SerialPush.pl line 79. OUT: ERR:standard in must be a tty EXIT:1 Any ideas on how I can get this to work? What I'm trying to do is get a perl script to move a file from tmp to etc, or just simply write a config file to /etc on a ton of remote systems. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/omaha-pm/attachments/20071206/06b5eb91/attachment.html From jay at jays.net Thu Dec 6 10:33:58 2007 From: jay at jays.net (Jay Hannah) Date: Thu, 06 Dec 2007 12:33:58 -0600 Subject: [Omaha.pm] Net::SSH::Perl and sudo or su In-Reply-To: References: Message-ID: <47584096.7040304@jays.net> Tony Simons wrote: > What I'm trying to do is get a perl script to move a file from tmp to > etc, or just simply write a config file to /etc on a ton of remote > systems. You want to move a file from server1:/etc to server1:/tmp ? Or is the tmp file on a different host? Is the other host a *nix box? You can't just scp the file? Or use rsync? I don't (yet) see why Perl is involved in solving your problem. :) j From webmaster at tvortex.net Thu Dec 6 13:12:35 2007 From: webmaster at tvortex.net (Tony Simons) Date: Thu, 6 Dec 2007 15:12:35 -0600 Subject: [Omaha.pm] Net::SSH::Perl and sudo or su Message-ID: Here's the process I'm trying to follow. I have this working with a bash script btw, just thought I'd take an adventure into perl. :) I'm trying to get my perl script to populate a serialnumber file by sshing to the host and writing a file by one of 2 methods. (either way root is inaccessible via ssh) Method 1: write the file to /tmp and move it to /etc. Method 2: write to /etc. Regardless of how I do this I need to get root (via 'su' or vi 'sudo') to get the file into /etc All the file work is done on the remote client after sshing to it while providing the information needed. my $cmd = "echo \"HOST='$hos'\nASSET='$ass'\nSERIAL='$ser'\nMAKE='$mak'\nMODEL='$mod'\nFACILITY='$fac'\nRACK='$rac'\nUNITS='$uni'\" > $tmpf; sudo mv $tmpf /etc"; Hope this helps with a few questions. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/omaha-pm/attachments/20071206/7b310480/attachment.html From jay at jays.net Thu Dec 6 13:26:10 2007 From: jay at jays.net (Jay Hannah) Date: Thu, 06 Dec 2007 15:26:10 -0600 Subject: [Omaha.pm] Net::SSH::Perl and sudo or su In-Reply-To: References: Message-ID: <475868F2.60200@jays.net> Tony Simons wrote: > Here's the process I'm trying to follow. I have this working with a > bash script btw, just thought I'd take an adventure into perl. > :) I fully support the leap from bash scripting to Perl. :) Can you show us how your bash script successfully copies the file? I'm curious how you're getting past the permissions barrier. j From webmaster at tvortex.net Thu Dec 6 13:35:01 2007 From: webmaster at tvortex.net (Tony Simons) Date: Thu, 06 Dec 2007 15:35:01 -0600 Subject: [Omaha.pm] Net::SSH::Perl and sudo or su References: dd7f36190712061312o2e51e174n177ebc04c7408d33@mail.gmail.com Message-ID: <47586B05.8080403@tvortex.net> Ok, but it's really long... But... this is what I have. And it's a little rough but it works. #!/bin/bash author="Tony Simons" altauthor="" ver=0 rev=1 mod="2007.10.12" HOS=0; ASS=1; SER=2; MAK=3; MOD=4; RAC=5; FAC=6; UNI=7; SSHCMD="/usr/bin/ssh -t" SSHEXEC=${SSHCMD} DEBUG=0 FPCHECK=1 ERRORED=0 ERRCODE=99 #------------------------------------------------- # Functions #------------------------------------------------- function usage { echo "Version ${ver}.${rev}, original by ${author} ${altauthor} on ${mod}" echo -e "\nUsage: $0 Options: \t -h {for ssh purposes} \t -a \t -s \t -k \t -m \t -f \t -r \t -u \t -p Turn off fingerprinting NOTE: this help message shows when no options are supplied\n another NOTE: if your running this outside of the script every value MUST be in double quotes Error Codes: 99: No options were supplied. 2: Sudo Failed 3: SinFP not found 4: SinFP failed 8: NOT A UNIX BOX " } if [ $# -lt 1 ]; then usage exit 99 fi #------------------------------------------------- # Sudo Checking #------------------------------------------------- echo "Checking sudo status (Enter Password if asked)..." if [ `sudo test; echo $?` -gt 1 ]; then echo "This script uses SinFP which requires Root privileges please run the script again and enter your password." exit 2 fi echo -e "Local Sudo PASSED!\nLooking for sinfp.pl..." #------------------------------------------------- # SinFP Checking #------------------------------------------------- SINFP=`which sinfp.pl` if [ ! -f "$SINFP" ]; then echo "This script uses SinFP for fingerprinting purposes which helps locate certain scripts" echo -e "********SinFP is installed through cpan********* # cpan Net::SinFP If it fails with IOSOMETHING Interface not found... # perl -MCPAN -e shell > force install Net::Pcap Try the cpan line again." exit 61 fi echo "Found $SINFP!" #------------------------------------------------- # Variable Assignments #------------------------------------------------- while getopts "dpa:f:h:k:m:r:s:u:" optname do case ${optname} in a)SNFILE[$ASS]=${OPTARG};; f)SNFILE[$FAC]=${OPTARG};; h)SNFILE[$HOS]=${OPTARG};; k)SNFILE[$MAK]=${OPTARG};; m)SNFILE[$MOD]=${OPTARG};; r)SNFILE[$RAC]=${OPTARG};; s)SNFILE[$SER]=${OPTARG};; u)SNFILE[$UNI]=${OPTARG};; p)FPCHECK=0;; d)DEBUG=1 echo "DEBUG ON; NOTHING WILL BE SENT" ;; esac done for w in `seq 1 2`; do if [ "${SNFILE[${w}]}" == "" ]; then ERRORED=1 ERRCODE=${w} fi done if [ $ERRORED -eq 1 ]; then echo "${SNFILE[${HOS}]} Missing Variables: ${ERRCODE}" echo "${SNFILE[${HOS}]} Missing Variables: ${ERRCODE}" >> SNPushMissingContent-`date +%Y%m%d` exit fi if [ ${DEBUG} -eq 0 ]; then STR="ASSET=\\\"${SNFILE[${ASS}]}\\\" \\\nSERIAL=\\\"${SNFILE[${SER}]}\\\" \\\nMAKE=\\\"${SNFILE[${MAK}]}\\\" \\\nMODEL=\\\"${SNFILE[${MOD}]}\\\" \\\nFACILITY=\\\"${SNFILE[${FAC}]}\\\" \\\nRACK=\\\"${SNFILE[${RAC}]}\\\" \\\nUNITS=\\\"${SNFILE[${UNI}]}\\\"" else STR="ASSET=${SNFILE[${ASS}]} \nSERIAL=${SNFILE[${SER}]} \nMAKE=${SNFILE[${MAK}]} \nMODEL=${SNFILE[${MOD}]} \nFACILITY=${SNFILE[${FAC}]} \nRACK=${SNFILE[${RAC}]} \nUNITS=${SNFILE[${UNI}]}" fi #------------------------------------------------- # Guessing the OS #------------------------------------------------- #if [ ${FPCHECK} -eq 1 ]; then echo "Detecting the OS of ${SNFILE[${HOST}]} with SinFP..." case `sudo sinfp.pl -a -i${SNFILE[${HOS}]} -p 22 | grep IPv4 | awk '{print $4}' | head -n1` in "Linux:") #echo "Has Linux Fingerprint!" SUDO=/usr/bin/sudo ;; "SunOS:") #echo "Has Solaris Fingerprint!" SUDO=/usr/local/bin/sudo ;; *) echo "No Unix Fingerprint Found...doing one more check!" if [ "`sudo sinfp.pl -i${SNFILE[${HOS}]} -p 22 | grep IPv4 | awk '{print $2}' | head -n1`" == "unknown" ]; then SUDO=/usr/bin/sudo else exit 6 fi ;; esac #else # echo "Fingerprint Disabled!" #fi #------------------------------------------------- # Making the connections #------------------------------------------------- if [ ${DEBUG} -eq 0 ]; then $SSHCMD ${SNFILE[${HOS}]} "echo -e $STR > /tmp/${SNFILE[${HOS}]}.sn ;$SUDO mv /tmp/${SNFILE[${HOS}]}.sn /etc/serialnumber; $SUDO chmod 660 /etc/serialnumber" RESULT=$? if [ ${RESULT} -gt 0 ]; then exit 22 fi else echo "This is what would be sent to ${SNFILE[${HOS}]}!" echo -e $STR fi exit 0 From webmaster at tvortex.net Thu Dec 6 14:00:21 2007 From: webmaster at tvortex.net (Tony Simons) Date: Thu, 06 Dec 2007 16:00:21 -0600 Subject: [Omaha.pm] Net::SSH::Perl and sudo or su Message-ID: <475870F5.8040102@tvortex.net> Heh, Pretty ugly huh? I'm doing some OS detection for locations of executables in there as well so that's what the sinfp stuff is all about. From jay at jays.net Thu Dec 6 14:25:04 2007 From: jay at jays.net (Jay Hannah) Date: Thu, 06 Dec 2007 16:25:04 -0600 Subject: [Omaha.pm] BEGIN block for Test::More Message-ID: <475876C0.5000905@jays.net> Stumbled into this one today... I had to add BEGIN {} around my if test to catch clients that aren't configured correctly to run tests like the one below. Without BEGIN, they'd get down to use OTA2::Skeletons, which would blow up (not skip) because that package wasn't in their PERL5LIB path... Ahh, the magic of BEGIN... j $ cat j2.t use Test::More; BEGIN { if( -d "$ENV{OTA2_PATH}/skeletons" ) { plan tests => 4; } else { plan skip_all => 'Looks like your $ENV{OTA2_PATH} is not set'; } } use strict; use OTA2::Skeleton; # ... $ perl j2.t 1..0 # Skip Looks like your $ENV{OTA2_PATH} is not set From jay at jays.net Thu Dec 6 14:36:29 2007 From: jay at jays.net (Jay Hannah) Date: Thu, 06 Dec 2007 16:36:29 -0600 Subject: [Omaha.pm] Net::SSH::Perl and sudo or su In-Reply-To: <47586B05.8080403@tvortex.net> References: dd7f36190712061312o2e51e174n177ebc04c7408d33@mail.gmail.com <47586B05.8080403@tvortex.net> Message-ID: <4758796D.4060904@jays.net> Tony Simons wrote: > Ok, but it's really long... But... this is what I have. And it's a > little rough but it works. > if [ `sudo test; echo $?` -gt 1 ]; then > echo "This script uses SinFP which requires Root privileges please > So you have to be root to run your bash script? > case `sudo sinfp.pl -a -i${SNFILE[${HOS}]} -p 22 | grep IPv4 | awk > '{print $4}' | head -n1` in > What does sudo do if you're already root? > echo "No Unix Fingerprint Found...doing one more check!" > if [ "`sudo sinfp.pl -i${SNFILE[${HOS}]} -p 22 | grep IPv4 | awk > '{print $2}' | head -n1`" == "unknown" ]; then > What is that doing? Is it doing it locally? > $SSHCMD ${SNFILE[${HOS}]} "echo -e $STR > /tmp/${SNFILE[${HOS}]}.sn > ;$SUDO mv /tmp/${SNFILE[${HOS}]}.sn /etc/serialnumber; $SUDO chmod 660 > /etc/serialnumber" > So this is our goal, right? To create /etc/serialnumber on the remote host? Why does this work under bash? Do all your remote hosts have /root/.ssh/authorized_keys files set up to trust root coming from your local machine? ... Maybe we'll get to a Perl question eventually ... -grin- j From webmaster at tvortex.net Thu Dec 6 15:08:31 2007 From: webmaster at tvortex.net (Tony Simons) Date: Thu, 6 Dec 2007 17:08:31 -0600 Subject: [Omaha.pm] Net::SSH::Perl and sudo or su Message-ID: Q. So you have to be root to run your bash script? A. The sudo part is only for the sinfp check. I have keys for my own user on the systems. Q. What does sudo do if you're already root? A. Won't do anything because there is no root access to the remote host Q. What is that doing? Is it doing it locally? A. It is doing it locally...once it determines which OS is running (we only have 2 different flavors being Solaris or linux) it will be told where sudo is located. hmm.....may need to test my theory here for the Perl method.* * Q. So this is our goal, right? To create /etc/serialnumber on the remote host? A. Absolutely Q. Why does this work under bash? Do all your remote hosts have /root/.ssh/authorized_keys files set up to trust root coming from your local machine? A. The initial sudo test is to get the sudo running (for sinfp checks) so I don't have to do it every time. (you'll see why that is done after the next sentance) Typically during a session you only have to run sudo once for something; then it's taken care of your sudo session for a certain time. This is actually part 2 of the script...one part has my hosts list and the other has a csv file with the serialnumbers, asset, tags and other miscelaneous info, they get cross referenced becuase the list is mixed with Windows servers. That script calls this one for every host. The functional part of the script runs entirely under my own account it ssh's to a box sending along the script it needs to run as part of the ssh command which includes the sudo commands that the remote host needs to run. I'm thinking I should have included line numbers in the code so I could highlight certain aspects. #------------------------------------------------- # Making the connections #------------------------------------------------- if [ ${DEBUG} -eq 0 ]; then Here's how this would initally read (run as me not sudo'd locally): /usr/bin/ssh "host" "echo -e [the string with all the information in it] to a serialnumber temp file. THEN "remote sudo here' move the temp file to /etc and change it's permissions" $SSHCMD ${SNFILE[${HOS}]} "echo -e $STR > /tmp/${SNFILE[${HOS}]}.sn ;$SUDO mv /tmp/${SNFILE[${HOS}]}.sn /etc/serialnumber; $SUDO chmod 660 /etc/serialnumber" RESULT=$? if [ ${RESULT} -gt 0 ]; then exit 22 fi else echo "This is what would be sent to ${SNFILE[${HOS}]}!" echo -e $STR fi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/omaha-pm/attachments/20071206/aa0c2ad0/attachment-0001.html From webmaster at tvortex.net Thu Dec 6 16:03:41 2007 From: webmaster at tvortex.net (Anthony Simons) Date: Thu, 06 Dec 2007 18:03:41 -0600 Subject: [Omaha.pm] Net::SSH::Perl and sudo or su References: 47586B05.8080403@tvortex.net Message-ID: <47588DDD.5090700@tvortex.net> K, this doesn't wok so well with gmail so I emerged thunderbird :P Q. So you have to be root to run your bash script? A. The sudo part is only for the sinfp check. I have keys for my own user on the systems. Q. What does sudo do if you're already root? A. Won't do anything because there is no root access to the remote host Q. What is that doing? Is it doing it locally? A. It is doing it locally...once it determines which OS is running (we only have 2 different flavors being Solaris or linux) it will be told where sudo is located. hmm.....may need to test my theory here for the Perl method.* * Q. So this is our goal, right? To create /etc/serialnumber on the remote host? A. Absolutely Q. Why does this work under bash? Do all your remote hosts have /root/.ssh/authorized_keys files set up to trust root coming from your local machine? A. The initial sudo test is to get the sudo running (for sinfp checks) so I don't have to do it every time. (you'll see why that is done after the next sentance) Typically during a session you only have to run sudo once for something; then it's taken care of your sudo session for a certain time. This is actually part 2 of the script...one part has my hosts list and the other has a csv file with the serialnumbers, asset, tags and other miscelaneous info, they get cross referenced becuase the list is mixed with Windows servers. That script calls this one for every host. The functional part of the script runs entirely under my own account it ssh's to a box sending along the script it needs to run as part of the ssh command which includes the sudo commands that the remote host needs to run. I'm thinking I should have included line numbers in the code so I could highlight certain aspects. #------------------------------------------------- # Making the connections #------------------------------------------------- if [ ${DEBUG} -eq 0 ]; then Here's how this would initally read (run as me not sudo'd locally): /usr/bin/ssh "host" "echo -e [the string with all the information in it] to a serialnumber temp file. THEN "remote sudo here' move the temp file to /etc and change it's permissions" $SSHCMD ${SNFILE[${HOS}]} "echo -e $STR > /tmp/${SNFILE[${HOS}]}.sn ;$SUDO mv /tmp/${SNFILE[${HOS}]}.sn /etc/serialnumber; $SUDO chmod 660 /etc/serialnumber" RESULT=$? if [ ${RESULT} -gt 0 ]; then exit 22 fi else echo "This is what would be sent to ${SNFILE[${HOS}]}!" echo -e $STR fi From topher-pm at zyp.org Thu Dec 6 16:31:43 2007 From: topher-pm at zyp.org (Christopher Cashell) Date: Thu, 6 Dec 2007 18:31:43 -0600 Subject: [Omaha.pm] Net::SSH::Perl and sudo or su In-Reply-To: References: Message-ID: On Dec 6, 2007 5:08 PM, Tony Simons wrote: > Q. So this is our goal, right? To create /etc/serialnumber on the remote > host? > A. Absolutely Would it be possible to approach this from a different side and handle it via permissions? Create a group on the box(es) where the file lives, for writing to the file. Then make the file setgid to that group, and writable by that group. Then add the user account the script will be run from (or that it logs in as) to the group. This could remove the requirement for sudo/su. -- Christopher From webmaster at tvortex.net Fri Dec 7 07:02:38 2007 From: webmaster at tvortex.net (Tony Simons) Date: Fri, 07 Dec 2007 09:02:38 -0600 Subject: [Omaha.pm] Net::SSH::Perl and sudo or su References: dd7f36190712061508q65e0e98bwb0e9340fafefecd7@mail.gmail.com Message-ID: <4759608E.40505@tvortex.net> It's possible, and a group and user are in the works. However the goal was to have it in a commonplace (/etc) As I was reading your message I was thinking of the "New user/Group" directory. We have automounted home directories which would make the file in the user's home directory a problem since it would be continuously overwritten by the script. From jay at jays.net Fri Dec 7 07:56:27 2007 From: jay at jays.net (Jay Hannah) Date: Fri, 7 Dec 2007 09:56:27 -0600 Subject: [Omaha.pm] Net::SSH::Perl and sudo or su In-Reply-To: <47588DDD.5090700@tvortex.net> References: 47586B05.8080403@tvortex.net <47588DDD.5090700@tvortex.net> Message-ID: <471AAB4F-8C3D-460D-ACD4-E5BD0433BBC1@jays.net> On Dec 6, 2007, at 6:03 PM, Anthony Simons wrote: > A. The initial sudo test is to get the sudo running (for sinfp checks) > so I don't have to do it every time. (you'll see why that is done > after the next sentance) Typically during a session you only have to > run sudo once for something; then it's taken care of your sudo session > for a certain time. So your bash script has to be run manually? Do you have to enter a password manually? (But only once?) Isn't that bad? (Don't you want to be able to fully automate this task?) > Here's how this would initally read (run as me not sudo'd locally): > /usr/bin/ssh "host" "echo -e [the string with all the information > in it] to a serialnumber temp file. THEN "remote sudo here' move the > temp file to /etc and change it's permissions" > > $SSHCMD ${SNFILE[${HOS}]} "echo -e $STR > /tmp/${SNFILE[$ > {HOS}]}.sn > ;$SUDO mv /tmp/${SNFILE[${HOS}]}.sn /etc/serialnumber; $SUDO chmod 660 > /etc/serialnumber" So your username has sudo privileges on the remote server? sudo has the effect of running those mv and chmod commands as root on the remote host, right? Are you saying that through manual sudo authentication locally the remote box now trusts the remote user to run things as root? (That sounds crazy, doesn't it?) j ...waaaay off topic. But maybe we're building up to some Perl... :) From webmaster at tvortex.net Fri Dec 7 14:10:42 2007 From: webmaster at tvortex.net (Tony Simons) Date: Fri, 07 Dec 2007 16:10:42 -0600 Subject: [Omaha.pm] Net::SSH::Perl and sudo or su References: 47588DDD.5090700@tvortex.net Message-ID: <4759C4E2.3090903@tvortex.net> The local sudo only for the sinfp (sinfp requires root for this for some reason; 'Net::SinFP' BTW) portion only asks once per local session. Sudo on all the REMOTE systems still requires a password to be entered by hand everytime(can't change that for security reasons). My username has sudo privileges on the remote boxes (password required) and sudo (with password on the remote system) is used to move the file into /etc yes. I may have answered the last question for you here. From topher-pm at zyp.org Fri Dec 7 22:01:25 2007 From: topher-pm at zyp.org (Christopher Cashell) Date: Sat, 8 Dec 2007 00:01:25 -0600 Subject: [Omaha.pm] Net::SSH::Perl and sudo or su In-Reply-To: <4759608E.40505@tvortex.net> References: <4759608E.40505@tvortex.net> Message-ID: On Dec 7, 2007 9:02 AM, Tony Simons wrote: > It's possible, and a group and user are in the works. However the goal > was to have it in a commonplace (/etc) > As I was reading your message I was thinking of the "New user/Group" > directory. We have automounted home directories which would make the > file in the user's home directory a problem since it would be > continuously overwritten by the script. I think you misunderstand my suggestion. You should be able to have a file in /etc/ that can be written by normal users, without using sudo. An example of setting it up: touch /etc/foo addgroup foowriters adduser USER foowriters chown root.foowriters /etc/foo chmod 644 /etc/foo At this point, you have a file, /etc/foo, which can be directly written to or edited by anyone in the foowriters group. Without using sudo or su. No new users needed, and it can still be restricted to only allow writes from the users you want. Would this work? -- Christopher From topher-pm at zyp.org Fri Dec 7 22:03:24 2007 From: topher-pm at zyp.org (Christopher Cashell) Date: Sat, 8 Dec 2007 00:03:24 -0600 Subject: [Omaha.pm] Net::SSH::Perl and sudo or su In-Reply-To: References: <4759608E.40505@tvortex.net> Message-ID: On Dec 8, 2007 12:01 AM, Christopher Cashell wrote: > chmod 644 /etc/foo Grrr. I typoed this. It should be 664, not 644. The key here is allowing writes from the foowriters group. -- Christopher From matt at omahageeks.com Sat Dec 8 09:34:53 2007 From: matt at omahageeks.com (Matthew Heller) Date: Sat, 8 Dec 2007 11:34:53 -0600 Subject: [Omaha.pm] Net::SSH::Perl and sudo or su In-Reply-To: References: <4759608E.40505@tvortex.net> Message-ID: <5BE066B4-DC41-44D4-BE4A-8BC0E3B7D4DD@omahageeks.com> gogo Topher! /cheer From webmaster at tvortex.net Sat Dec 8 10:15:06 2007 From: webmaster at tvortex.net (Anthony Simons) Date: Sat, 08 Dec 2007 12:15:06 -0600 Subject: [Omaha.pm] Net::SSH::Perl and sudo or su References: 4759608E.40505@tvortex.net Message-ID: <475ADF2A.5010202@tvortex.net> The script will be making the permission work for our new user but distributing the file is still the issue. The idea is to get the file to many hosts +200 systems. Manually visiting every one of them would not be a pretty sight. From matt at omahageeks.com Sun Dec 9 08:29:54 2007 From: matt at omahageeks.com (Matthew Heller) Date: Sun, 9 Dec 2007 10:29:54 -0600 Subject: [Omaha.pm] Net::SSH::Perl and sudo or su In-Reply-To: <5BE066B4-DC41-44D4-BE4A-8BC0E3B7D4DD@omahageeks.com> References: <4759608E.40505@tvortex.net> <5BE066B4-DC41-44D4-BE4A-8BC0E3B7D4DD@omahageeks.com> Message-ID: <88ED80AA-3834-402C-A69C-DD03093BFC51@omahageeks.com> Heyy, having reply-to set to the mailing list is a dirty trick. The only other possible explanation is that I'm an ignorant newb, and that's /obviously/ not... oh. Sigh. Sorry folks. :-P From jay at jays.net Mon Dec 10 07:55:45 2007 From: jay at jays.net (Jay Hannah) Date: Mon, 10 Dec 2007 09:55:45 -0600 Subject: [Omaha.pm] Net::SSH::Perl and sudo or su In-Reply-To: <88ED80AA-3834-402C-A69C-DD03093BFC51@omahageeks.com> References: <4759608E.40505@tvortex.net> <5BE066B4-DC41-44D4-BE4A-8BC0E3B7D4DD@omahageeks.com> <88ED80AA-3834-402C-A69C-DD03093BFC51@omahageeks.com> Message-ID: <0A4BF32A-15DC-48C8-9BEC-7AAEB4647A07@jays.net> On Dec 9, 2007, at 10:29 AM, Matthew Heller wrote: > Heyy, having reply-to set to the mailing list is a dirty trick. It helps pad our monthly posting stats. :) http://en.wikipedia.org/wiki/Lies,_damned_lies,_and_statistics > The only other possible explanation is that I'm an ignorant newb, and > that's /obviously/ not... oh. Sigh. Knowing stuff is boring. I'm an ignorant newb for life. :) Don't feel ignorant enough? Wait until you're 32 then try jumping cold into an academia / science career! That'll give your ego a solid whooping! http://clab.ist.unomaha.edu/CLAB/index.php/User:Jhannah Laugh, j From jay at jays.net Mon Dec 10 08:08:18 2007 From: jay at jays.net (Jay Hannah) Date: Mon, 10 Dec 2007 10:08:18 -0600 Subject: [Omaha.pm] Net::SSH::Perl and sudo or su In-Reply-To: <475ADF2A.5010202@tvortex.net> References: 4759608E.40505@tvortex.net <475ADF2A.5010202@tvortex.net> Message-ID: <63335754-CCA0-482A-A6B9-10BD0976BB4E@jays.net> On Dec 8, 2007, at 12:15 PM, Anthony Simons wrote: > The script will be making the permission work for our new user but > distributing the file is still the issue. > The idea is to get the file to many hosts +200 systems. Manually > visiting every one of them would not be a pretty sight. Can you use your whatever-is-already working sudo mojo to implement Chris' security suggestion? Then you'd have a clean slate from a security perspective and could just copy files with scp. At that juncture you can cleanly pick and choose whatever scripting language you want. For example, replacing icky bash scripts with oh-so-gorgeous Perl scripts*. j * tongue firmly in cheek http://www.rowan.edu/philosop/clowney/Aesthetics/philos_artists_onart/ plato.htm Perl... the contemplation of the ideal Form of Beauty itself. From KThompson at heiskell.com Mon Dec 10 08:36:36 2007 From: KThompson at heiskell.com (Thompson, Kenn) Date: Mon, 10 Dec 2007 08:36:36 -0800 Subject: [Omaha.pm] Net::SSH::Perl and sudo or su In-Reply-To: <63335754-CCA0-482A-A6B9-10BD0976BB4E@jays.net> References: 4759608E.40505@tvortex.net <475ADF2A.5010202@tvortex.net> <63335754-CCA0-482A-A6B9-10BD0976BB4E@jays.net> Message-ID: And there's the Perl... I knew you'd get there eventually ;) ---Sent from the desk of Kenn Thompson--- Direct Line: 402.289.6747 Cell: 402.598.8818 -----Original Message----- From: omaha-pm-bounces+kthompson=heiskell.com at pm.org [mailto:omaha-pm-bounces+kthompson=heiskell.com at pm.org] On Behalf Of Jay Hannah Sent: Monday, December 10, 2007 10:08 AM To: Perl Mongers of Omaha, Nebraska USA Subject: Re: [Omaha.pm] Net::SSH::Perl and sudo or su On Dec 8, 2007, at 12:15 PM, Anthony Simons wrote: > The script will be making the permission work for our new user but > distributing the file is still the issue. > The idea is to get the file to many hosts +200 systems. Manually > visiting every one of them would not be a pretty sight. Can you use your whatever-is-already working sudo mojo to implement Chris' security suggestion? Then you'd have a clean slate from a security perspective and could just copy files with scp. At that juncture you can cleanly pick and choose whatever scripting language you want. For example, replacing icky bash scripts with oh-so-gorgeous Perl scripts*. j * tongue firmly in cheek http://www.rowan.edu/philosop/clowney/Aesthetics/philos_artists_onart/ plato.htm Perl... the contemplation of the ideal Form of Beauty itself. _______________________________________________ Omaha-pm mailing list Omaha-pm at pm.org http://mail.pm.org/mailman/listinfo/omaha-pm No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.503 / Virus Database: 269.16.17/1179 - Release Date: 12/9/2007 11:06 AM No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.5.503 / Virus Database: 269.16.17/1179 - Release Date: 12/9/2007 11:06 AM From webmaster at tvortex.net Mon Dec 10 12:29:59 2007 From: webmaster at tvortex.net (Tony Simons) Date: Mon, 10 Dec 2007 14:29:59 -0600 Subject: [Omaha.pm] Net::SSH::Perl and sudo or su References: 475ADF2A.5010202@tvortex.net Message-ID: <475DA1C7.60401@tvortex.net> I take it I have you stumped on the initial problem. :) I was hoping to get the whole thing to work under perl in one shot as I have with the bash script. I have complete faith in your abilities Mr. Hannah. :) You know...Josh K. said you'd figure something out and that I couldn't stump you. From jay at jays.net Mon Dec 10 12:34:03 2007 From: jay at jays.net (Jay Hannah) Date: Mon, 10 Dec 2007 14:34:03 -0600 Subject: [Omaha.pm] Regexp::Common - 223,069 tests! Message-ID: <29422AF8-37E2-424C-885B-0197E50DAAA7@jays.net> Wow! Now that's a spicy meatball! Suddenly our in-house automated QA feels so puny... -laugh- j ... t/zip/spain......................ok t/zip/us.........................ok t/zip/zip........................ok All tests successful. Files=56, Tests=223069, 63 wallclock secs (25.94 cusr + 0.74 csys = 26.68 CPU) http://search.cpan.org/~abigail/Regexp-Common-2.120/lib/Regexp/Common.pm From jay at jays.net Mon Dec 10 12:43:53 2007 From: jay at jays.net (Jay Hannah) Date: Mon, 10 Dec 2007 14:43:53 -0600 Subject: [Omaha.pm] Regexp::Common::zip is pretty slick Message-ID: <08072E99-C1C5-4D44-9D48-1CB79519A1E3@jays.net> Wow. This would have been nice to have back in 1999 when I worked for a European telcom... CPAN rules. j /$RE{zip}{Germany}/; # Matches 'DE-12345' and 'D-12345'. /$RE{zip}{Germany}{-country => 'iso'}/; # Matches 'DE-12345' but not 'D-12345'. /$RE{zip}{Germany}{-country => 'cept'}/; # Matches 'D-12345' but not 'DE-12345'. /$RE{zip}{Germany}{-country => 'GER'}/; # Matches 'GER-12345'. http://search.cpan.org/~abigail/Regexp-Common-2.120/lib/Regexp/Common/ zip.pm From webmaster at tvortex.net Mon Dec 10 13:18:56 2007 From: webmaster at tvortex.net (Tony Simons) Date: Mon, 10 Dec 2007 15:18:56 -0600 Subject: [Omaha.pm] Net::SSH::Perl and sudo or su In-Reply-To: <54818.63.230.40.25.1197320248.squirrel@webmail.linder.org> References: 475ADF2A.5010202@tvortex.net <475DA1C7.60401@tvortex.net> <54818.63.230.40.25.1197320248.squirrel@webmail.linder.org> Message-ID: <475DAD40.8030304@tvortex.net> Got past the login which seems normal...things change when I do the sudo ...... ***Got past login*** azelf: channel 1: new [client-session] azelf: Requesting channel_open for channel 1. azelf: Entering interactive session. azelf: Sending command: whoami azelf: Requesting service exec on channel 1. azelf: channel 1: open confirm rwindow 0 rmax 32768 azelf: channel 1: rcvd eof azelf: channel 1: output open -> drain azelf: input_channel_request: rtype exit-status reply 0 azelf: channel 1: rcvd close azelf: channel 1: input open -> closed azelf: channel 1: close_read azelf: channel 1: obuf empty azelf: channel 1: output drain -> closed azelf: channel 1: close_write azelf: channel 1: send close azelf: channel 1: full closed OUT:tonys Use of uninitialized value in printf at ./test.pl line 19. ERR: EXIT:0 ----------------------------------------------------------------------------------- > OUT: > ERR:sudo: sorry, you must have a tty to run sudo > > EXIT:1 Daniel Linder wrote: > On Mon, December 10, 2007 14:29, Tony Simons wrote: > >> I take it I have you stumped on the initial problem. :) I was hoping >> to get the whole thing to work under perl in one shot as I have with the >> bash script. >> > > To recap, you're trying to use the Net::SSH:Perl module and you provided > this basic code in your initial e-mail: > > #!/usr/bin/perl -w > $|=1; > use strict; > use warnings; > use Net::SSH::Perl; > use Term::ReadKey; > use Getopt::Long; > my $hos="192.168.99.99"; > my $port=22; > my $user="dan"; > > my $cmd = "whoami"; > my $ssh = Net::SSH::Perl->new($hos, interactive =>1, use_pty => 1, debug > => 1, port => $port, protocol => '2,1', options => ["BatchMode yes"]) or > die("Could not connect"); > > $ssh->login($user); > printf ("\n\t***Got past login***\n"); > my ($stdout, $stderr, $exit) = $ssh->cmd($cmd); > printf ("OUT:%s\n",$stdout); > printf ("ERR:%s\n",$stderr); > printf ("EXIT:%s\n",$exit); > > > (You'll need to change the $hos and $port to match your machines IP and > port that SSHd is running on.) > > When I run it, I get the following output: > > dan at titan:~/tmp/PerlTests$ perl d5.pl > titan: Reading configuration data /home/dan/.ssh/config > titan: Reading configuration data /etc/ssh_config > titan: Connecting to 192.168.99.99, port 22. > titan: Remote version string: SSH-2.0-OpenSSH_4.2p1 Debian-7ubuntu3.1 > > titan: Remote protocol version 2.0, remote software version OpenSSH_4.2p1 > Debian-7ubuntu3.1 > titan: Net::SSH::Perl Version 1.30, protocol version 2.0. > titan: No compat match: OpenSSH_4.2p1 Debian-7ubuntu3.1. > titan: Connection established. > titan: Sent key-exchange init (KEXINIT), wait response. > titan: Algorithms, c->s: 3des-cbc hmac-sha1 none > titan: Algorithms, s->c: 3des-cbc hmac-sha1 none > titan: Entering Diffie-Hellman Group 1 key exchange. > titan: Sent DH public key, waiting for reply. > titan: Received host key, type 'ssh-dss'. > titan: Host '192.168.99.99' is known and matches the host key. > titan: Computing shared secret key. > titan: Verifying server signature. > titan: Waiting for NEWKEYS message. > titan: Enabling incoming encryption/MAC/compression. > titan: Send NEWKEYS, enable outgoing encryption/MAC/compression. > titan: Sending request for user-authentication service. > titan: Service accepted: ssh-userauth. > titan: Trying empty user-authentication request. > titan: Authentication methods that can continue: publickey. > titan: Next method to try is publickey. > titan: Trying pubkey authentication with key file '/home/dan/.ssh/id_dsa' > titan: Authentication methods that can continue: publickey. > titan: Next method to try is publickey. > Permission denied at d5.pl line 15 > dan at titan:~/tmp/PerlTests$ > > > Line 15 is the "$ssh->login($user);" line so I have to think the login() > routine is having issues. From the command line I can perform a "ssh > dan at 192.168.99.99 whoami" and it runs and returns "dan" (the output from > 'whoami'). > > For now it looks like the "login()" subroutine isn't handling the ssh > public key correctly. Is it possibly related to one of the options > supplied to the Net::SSH::Perl->new() call? Does yours die at the same > login() call? > > Dan > > - - - - > "There are four boxes to be used in defense of liberty: soap, ballot, > jury, and ammo. Please use in that order." > -- Ed Howdershelt (Author) > > "I do not fear computers, I fear the lack of them." -- Isaac Asimov (Author) > ** *** ***** ******* *********** ************* > SIRC, CID, subversives, 414, Flu, utopia, & > basement, GEO, Information Security, DSD, cocaine, SIGDEV, Keyhole > CESID, PRIME, Lexis-Nexis, CTP, DynCorp, gorilla, Recce > > > From dan at linder.org Mon Dec 10 12:57:28 2007 From: dan at linder.org (Daniel Linder) Date: Mon, 10 Dec 2007 14:57:28 -0600 (CST) Subject: [Omaha.pm] Net::SSH::Perl and sudo or su In-Reply-To: <475DA1C7.60401@tvortex.net> References: 475ADF2A.5010202@tvortex.net <475DA1C7.60401@tvortex.net> Message-ID: <54818.63.230.40.25.1197320248.squirrel@webmail.linder.org> On Mon, December 10, 2007 14:29, Tony Simons wrote: > I take it I have you stumped on the initial problem. :) I was hoping > to get the whole thing to work under perl in one shot as I have with the > bash script. To recap, you're trying to use the Net::SSH:Perl module and you provided this basic code in your initial e-mail: #!/usr/bin/perl -w $|=1; use strict; use warnings; use Net::SSH::Perl; use Term::ReadKey; use Getopt::Long; my $hos="192.168.99.99"; my $port=22; my $user="dan"; my $cmd = "whoami"; my $ssh = Net::SSH::Perl->new($hos, interactive =>1, use_pty => 1, debug => 1, port => $port, protocol => '2,1', options => ["BatchMode yes"]) or die("Could not connect"); $ssh->login($user); printf ("\n\t***Got past login***\n"); my ($stdout, $stderr, $exit) = $ssh->cmd($cmd); printf ("OUT:%s\n",$stdout); printf ("ERR:%s\n",$stderr); printf ("EXIT:%s\n",$exit); (You'll need to change the $hos and $port to match your machines IP and port that SSHd is running on.) When I run it, I get the following output: dan at titan:~/tmp/PerlTests$ perl d5.pl titan: Reading configuration data /home/dan/.ssh/config titan: Reading configuration data /etc/ssh_config titan: Connecting to 192.168.99.99, port 22. titan: Remote version string: SSH-2.0-OpenSSH_4.2p1 Debian-7ubuntu3.1 titan: Remote protocol version 2.0, remote software version OpenSSH_4.2p1 Debian-7ubuntu3.1 titan: Net::SSH::Perl Version 1.30, protocol version 2.0. titan: No compat match: OpenSSH_4.2p1 Debian-7ubuntu3.1. titan: Connection established. titan: Sent key-exchange init (KEXINIT), wait response. titan: Algorithms, c->s: 3des-cbc hmac-sha1 none titan: Algorithms, s->c: 3des-cbc hmac-sha1 none titan: Entering Diffie-Hellman Group 1 key exchange. titan: Sent DH public key, waiting for reply. titan: Received host key, type 'ssh-dss'. titan: Host '192.168.99.99' is known and matches the host key. titan: Computing shared secret key. titan: Verifying server signature. titan: Waiting for NEWKEYS message. titan: Enabling incoming encryption/MAC/compression. titan: Send NEWKEYS, enable outgoing encryption/MAC/compression. titan: Sending request for user-authentication service. titan: Service accepted: ssh-userauth. titan: Trying empty user-authentication request. titan: Authentication methods that can continue: publickey. titan: Next method to try is publickey. titan: Trying pubkey authentication with key file '/home/dan/.ssh/id_dsa' titan: Authentication methods that can continue: publickey. titan: Next method to try is publickey. Permission denied at d5.pl line 15 dan at titan:~/tmp/PerlTests$ Line 15 is the "$ssh->login($user);" line so I have to think the login() routine is having issues. From the command line I can perform a "ssh dan at 192.168.99.99 whoami" and it runs and returns "dan" (the output from 'whoami'). For now it looks like the "login()" subroutine isn't handling the ssh public key correctly. Is it possibly related to one of the options supplied to the Net::SSH::Perl->new() call? Does yours die at the same login() call? Dan - - - - "There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order." -- Ed Howdershelt (Author) "I do not fear computers, I fear the lack of them." -- Isaac Asimov (Author) ** *** ***** ******* *********** ************* SIRC, CID, subversives, 414, Flu, utopia, & basement, GEO, Information Security, DSD, cocaine, SIGDEV, Keyhole CESID, PRIME, Lexis-Nexis, CTP, DynCorp, gorilla, Recce From dan at linder.org Mon Dec 10 12:57:28 2007 From: dan at linder.org (Daniel Linder) Date: Mon, 10 Dec 2007 14:57:28 -0600 (CST) Subject: [Omaha.pm] Net::SSH::Perl and sudo or su In-Reply-To: <475DA1C7.60401@tvortex.net> References: 475ADF2A.5010202@tvortex.net <475DA1C7.60401@tvortex.net> Message-ID: <54818.63.230.40.25.1197320248.squirrel@webmail.linder.org> On Mon, December 10, 2007 14:29, Tony Simons wrote: > I take it I have you stumped on the initial problem. :) I was hoping > to get the whole thing to work under perl in one shot as I have with the > bash script. To recap, you're trying to use the Net::SSH:Perl module and you provided this basic code in your initial e-mail: #!/usr/bin/perl -w $|=1; use strict; use warnings; use Net::SSH::Perl; use Term::ReadKey; use Getopt::Long; my $hos="192.168.99.99"; my $port=22; my $user="dan"; my $cmd = "whoami"; my $ssh = Net::SSH::Perl->new($hos, interactive =>1, use_pty => 1, debug => 1, port => $port, protocol => '2,1', options => ["BatchMode yes"]) or die("Could not connect"); $ssh->login($user); printf ("\n\t***Got past login***\n"); my ($stdout, $stderr, $exit) = $ssh->cmd($cmd); printf ("OUT:%s\n",$stdout); printf ("ERR:%s\n",$stderr); printf ("EXIT:%s\n",$exit); (You'll need to change the $hos and $port to match your machines IP and port that SSHd is running on.) When I run it, I get the following output: dan at titan:~/tmp/PerlTests$ perl d5.pl titan: Reading configuration data /home/dan/.ssh/config titan: Reading configuration data /etc/ssh_config titan: Connecting to 192.168.99.99, port 22. titan: Remote version string: SSH-2.0-OpenSSH_4.2p1 Debian-7ubuntu3.1 titan: Remote protocol version 2.0, remote software version OpenSSH_4.2p1 Debian-7ubuntu3.1 titan: Net::SSH::Perl Version 1.30, protocol version 2.0. titan: No compat match: OpenSSH_4.2p1 Debian-7ubuntu3.1. titan: Connection established. titan: Sent key-exchange init (KEXINIT), wait response. titan: Algorithms, c->s: 3des-cbc hmac-sha1 none titan: Algorithms, s->c: 3des-cbc hmac-sha1 none titan: Entering Diffie-Hellman Group 1 key exchange. titan: Sent DH public key, waiting for reply. titan: Received host key, type 'ssh-dss'. titan: Host '192.168.99.99' is known and matches the host key. titan: Computing shared secret key. titan: Verifying server signature. titan: Waiting for NEWKEYS message. titan: Enabling incoming encryption/MAC/compression. titan: Send NEWKEYS, enable outgoing encryption/MAC/compression. titan: Sending request for user-authentication service. titan: Service accepted: ssh-userauth. titan: Trying empty user-authentication request. titan: Authentication methods that can continue: publickey. titan: Next method to try is publickey. titan: Trying pubkey authentication with key file '/home/dan/.ssh/id_dsa' titan: Authentication methods that can continue: publickey. titan: Next method to try is publickey. Permission denied at d5.pl line 15 dan at titan:~/tmp/PerlTests$ Line 15 is the "$ssh->login($user);" line so I have to think the login() routine is having issues. From the command line I can perform a "ssh dan at 192.168.99.99 whoami" and it runs and returns "dan" (the output from 'whoami'). For now it looks like the "login()" subroutine isn't handling the ssh public key correctly. Is it possibly related to one of the options supplied to the Net::SSH::Perl->new() call? Does yours die at the same login() call? Dan - - - - "There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order." -- Ed Howdershelt (Author) "I do not fear computers, I fear the lack of them." -- Isaac Asimov (Author) ** *** ***** ******* *********** ************* SIRC, CID, subversives, 414, Flu, utopia, & basement, GEO, Information Security, DSD, cocaine, SIGDEV, Keyhole CESID, PRIME, Lexis-Nexis, CTP, DynCorp, gorilla, Recce From jay at jays.net Tue Dec 11 14:20:59 2007 From: jay at jays.net (Jay Hannah) Date: Tue, 11 Dec 2007 16:20:59 -0600 Subject: [Omaha.pm] Firefox Search Engine Plugin: CPAN Message-ID: <475F0D4B.200@jays.net> http://tinyurl.com/ytpg6x Sweet! This should save me several seconds every month! Laugh, j * * From webmaster at tvortex.net Fri Dec 14 11:19:41 2007 From: webmaster at tvortex.net (Tony Simons) Date: Fri, 14 Dec 2007 13:19:41 -0600 Subject: [Omaha.pm] Net::SSH::Perl Alternative Solution Message-ID: <4762D74D.4080309@tvortex.net> Even though I don't really like the idea of using a password in a script I've decided to work with an alternative that works as well...may even be a shorter script. Net::SSH::Expect Jay, I have a question for you if you have the time. Lets say I have some variables in a script that I want to dump out to the serial number file. I'm having troubles with the "" part and writing that to the file. Ideas? Example SERIALNUMBER="asdf123123123" From dan at linder.org Fri Dec 14 11:56:23 2007 From: dan at linder.org (Dan Linder) Date: Fri, 14 Dec 2007 13:56:23 -0600 Subject: [Omaha.pm] Net::SSH::Perl Alternative Solution In-Reply-To: <4762D74D.4080309@tvortex.net> References: <4762D74D.4080309@tvortex.net> Message-ID: <4762DFE7.9060008@linder.org> Tony Simons wrote: > Even though I don't really like the idea of using a password in a script > I've decided to work with an alternative that works as well...may even > be a shorter script. Net::SSH::Expect > > Jay, I have a question for you if you have the time. > Lets say I have some variables in a script that I want to dump out to > the serial number file. I'm having troubles with the "" part and > writing that to the file. Ideas? > > Example > SERIALNUMBER="asdf123123123" > > Use the \ to escape the embedded quotes. printf "SERIALNUMBER=\"asdf123123123\""; ...or use single quotes -- ' -- to keep all internal quotes from being seen. printf 'SERIALNUMBER="asdf123123123"'; Dan -- - - - - "Wait for that wisest of all counselors, time." -- Pericles "I do not fear computers, I fear the lack of them." -- Isaac Asimov From webmaster at tvortex.net Fri Dec 14 12:23:47 2007 From: webmaster at tvortex.net (Tony Simons) Date: Fri, 14 Dec 2007 14:23:47 -0600 Subject: [Omaha.pm] Net::SSH::Perl Alternative Solution In-Reply-To: <4762DFE7.9060008@linder.org> References: <4762D74D.4080309@tvortex.net> <4762DFE7.9060008@linder.org> Message-ID: <4762E653.6090801@tvortex.net> Unlike bash can I use variables in '$test' "$test"...haven't had a chance to try it yet. Dan Linder wrote: > Tony Simons wrote: >> Even though I don't really like the idea of using a password in a script >> I've decided to work with an alternative that works as well...may even >> be a shorter script. Net::SSH::Expect >> >> Jay, I have a question for you if you have the time. >> Lets say I have some variables in a script that I want to dump out to >> the serial number file. I'm having troubles with the "" part and >> writing that to the file. Ideas? >> >> Example >> SERIALNUMBER="asdf123123123" >> >> > > Use the \ to escape the embedded quotes. > > printf "SERIALNUMBER=\"asdf123123123\""; > > ...or use single quotes -- ' -- to keep all internal quotes from being > seen. > > printf 'SERIALNUMBER="asdf123123123"'; > > Dan > From dan at linder.org Fri Dec 14 14:03:57 2007 From: dan at linder.org (Dan Linder) Date: Fri, 14 Dec 2007 16:03:57 -0600 Subject: [Omaha.pm] Net::SSH::Perl Alternative Solution In-Reply-To: <4762E653.6090801@tvortex.net> References: <4762D74D.4080309@tvortex.net> <4762DFE7.9060008@linder.org> <4762E653.6090801@tvortex.net> Message-ID: <4762FDCD.6000005@linder.org> Tony Simons wrote: > Unlike bash can I use variables in '$test' "$test"...haven't had a > chance to try it yet. > > When you use the double-quote -- " -- you can use $variables, but with the single-quotes -- ' -- the variables are ignored. $ cat -n d6.pl ; perl d6.pl 1 #!perl 2 $VAR="Hello"; 3 printf "single quotes: SERIALNUMBER=\"asdf $VAR 123123123\"\n"; 4 printf 'double quotes: SERIALNUMBER="asdf $VAR 123123123"'; 5 printf "\n"; 6 printf 'mixed quotes: SERIALNUMBER="asdf '.$VAR.' 123123123"'."\n"; single quotes: SERIALNUMBER="asdf Hello 123123123" double quotes: SERIALNUMBER="asdf $VAR 123123123" mixed quotes: SERIALNUMBER="asdf Hello 123123123" I'm sure someone will come up with an internal perl variable to change the meaning of the double-quote characters, or some other Guru-level hint. :-) Dan -- - - - - "Wait for that wisest of all counselors, time." -- Pericles "I do not fear computers, I fear the lack of them." -- Isaac Asimov From webmaster at tvortex.net Fri Dec 14 14:38:48 2007 From: webmaster at tvortex.net (Anthony Simons) Date: Fri, 14 Dec 2007 16:38:48 -0600 Subject: [Omaha.pm] Net::SSH::Perl Alternative Solution In-Reply-To: <4762FDCD.6000005@linder.org> References: <4762D74D.4080309@tvortex.net> <4762DFE7.9060008@linder.org> <4762E653.6090801@tvortex.net> <4762FDCD.6000005@linder.org> Message-ID: <476305F8.5080306@tvortex.net> So far SSH::Expect is working flawlessly, thanks for the attempts at the previous. Dan Linder wrote: > Tony Simons wrote: >> Unlike bash can I use variables in '$test' "$test"...haven't had a >> chance to try it yet. >> >> > When you use the double-quote -- " -- you can use $variables, but with > the single-quotes -- ' -- the variables are ignored. > > $ cat -n d6.pl ; perl d6.pl > 1 #!perl > 2 $VAR="Hello"; > 3 printf "single quotes: SERIALNUMBER=\"asdf $VAR 123123123\"\n"; > 4 printf 'double quotes: SERIALNUMBER="asdf $VAR 123123123"'; > 5 printf "\n"; > 6 printf 'mixed quotes: SERIALNUMBER="asdf '.$VAR.' > 123123123"'."\n"; > > single quotes: SERIALNUMBER="asdf Hello 123123123" > double quotes: SERIALNUMBER="asdf $VAR 123123123" > mixed quotes: SERIALNUMBER="asdf Hello 123123123" > > I'm sure someone will come up with an internal perl variable to change > the meaning of the double-quote characters, or some other Guru-level > hint. :-) > > Dan > From jay at jays.net Sun Dec 16 08:09:26 2007 From: jay at jays.net (Jay Hannah) Date: Sun, 16 Dec 2007 10:09:26 -0600 Subject: [Omaha.pm] debugger - $DB::single = 1; Message-ID: <9969988D-9682-4F2B-8023-00B06B84D1B7@jays.net> Oh, cool... Catalyst just introduced me to $DB::single = 1; If you throw that statement in your code then run your program under the debugger and hit "c" to continue, the debugger will stop on the next line. Under some circumstances this might be more convenient than the way I normally set breakpoints: via a .perldb file: =============== $ cat .perldb sub afterinit { my $lib = "/Library/Perl/5.8.6"; push @DB::typeahead, "f $lib/Control/Rates/Avail.pm", "b 189", } =============== While developing web apps under Catalyst $DB::single is really handy. You can launch your Catalyst server via the debugger, hit "c", and then use your browser to click around in your application just like normal. This way the browser keeps doing all its magical javascript / cookie stuff, and your server stops right after $DB::single so you can start debugging right there in real-time. Since I'm still learning the Catalyst framework, this is HUGE for me, since I'm still feeling my way through the framework. :) Yes, I could still use .perldb to accomplish the same things, but I'm still fumbling through Catalyst namespaces, so $DB::single is awesomely lazy. :) j Catalyst: http://catalyst.perl.org/ More info on $DB::single: http://search.cpan.org/~nwclark/perl-5.8.8/pod/ perldebug.pod#Debugging_compile-time_statements From jay at jays.net Mon Dec 17 16:34:18 2007 From: jay at jays.net (Jay Hannah) Date: Mon, 17 Dec 2007 18:34:18 -0600 Subject: [Omaha.pm] Perl::Install Message-ID: <55BC3F0B-B117-4003-A8C1-EEE404A71BAF@jays.net> As seen on #catalyst today... Someone was asking for something like this a while back. Was it Dave? j [16:34] For those interested, I've released Perl::Install to CPAN [18:28] <__robkinyon> jrockway: it's a set of scripts that automates the installation of a specific version of Perl and all the CPAN modules you specify [18:28] <__robkinyon> The idea is that you specify a directory and a list of modules to install from CPAN and go get coffee [18:28] <__robkinyon> come back in 30min and it's ready to go [18:29] <__robkinyon> very useful for production systems where you want to have multiple versions of Perl, each corresponding to a different installation of the app [18:29] <__robkinyon> also very useful for authors to have multiple Perls to test against [18:29] <__robkinyon> and not just multiple versions of Perl, but different CPAN installations search.cpan.org should have it indexed by tomorrow(?). Tonight you can use PAUSE incoming: http://pause.perl.org/incoming/ From jay at jays.net Wed Dec 19 14:08:06 2007 From: jay at jays.net (Jay Hannah) Date: Wed, 19 Dec 2007 16:08:06 -0600 Subject: [Omaha.pm] Fwd: Perl 5.10.0 is released Message-ID: <47699646.2080400@jays.net> I'm looking forward to using // and //= :) http://www.slideshare.net/acme/whats-new-in-perl-510 j On Tue, Dec 18, 2007 at 07:11:46PM +0100, Rafael Garcia-Suarez wrote: > He would often declare, in speaking his thoughts upon the subject, > that he did not conceive how the greatest family in England could > stand it out against an uninterrupted succession of six or seven > short noses.--And for the contrary reason, he would generally add, > That it must be one of the greatest problems in civil life, where > the same number of long and jolly noses, following one another in a > direct line, did not raise and hoist it up into the best vacancies > in the kingdom. > -- Laurence Sterne, The Life and Opinions of Tristram Shandy > > Perl 5.10.0 is now out, the first in the 5.10.x major version series, > after a five year long development process. It's currently being > mirrored on CPAN. > > A more formal announcement will follow via the usual canals. > I'm told a press release is also in the works. > > I would like to thank everyone on perl5-porters for their efforts. I > hope we'll all be proud of what Perl is becoming. And ready to get back > to the keyboard for 5.12, for which, I hope, we'll not wait as long as > we waited for 5.10. > > As a personal note, I can't wait to use 5.10 in production. All those > new features are quite exciting, aren't they? > > Enjoy ! From jay at jays.net Wed Dec 19 14:32:52 2007 From: jay at jays.net (Jay Hannah) Date: Wed, 19 Dec 2007 16:32:52 -0600 Subject: [Omaha.pm] Fwd: Newsletter for O'Reilly UG Program, December 11 Message-ID: <47699C14.7020109@jays.net> http://oreilly.com/emails/ug-dec.html Specifically: http://www.perl.com/pub/a/2007/12/06/soto-11.html *Programming is Hard, Let's Go Scripting...* Larry Wall's annual State of the Onion describes the state of Perl, the language and the community. In his 11th address, he discussed the past, present, and future of scripting languages, including the several dimensions of design decisions important to the development of Perl 6. From dthacker9 at cox.net Fri Dec 21 06:02:57 2007 From: dthacker9 at cox.net (Dave Thacker) Date: Fri, 21 Dec 2007 08:02:57 -0600 Subject: [Omaha.pm] Perl::Install In-Reply-To: <55BC3F0B-B117-4003-A8C1-EEE404A71BAF@jays.net> References: <55BC3F0B-B117-4003-A8C1-EEE404A71BAF@jays.net> Message-ID: <200712210802.58006.dthacker9@cox.net> On Monday 17 December 2007 18:34:18 Jay Hannah wrote: > As seen on #catalyst today... > > Someone was asking for something like this a while back. Was it Dave? > > j Yes, that was me. I may get to try it out in the next few weeks. Dave > > > [16:34] For those interested, I've released > Perl::Install to CPAN > [18:28] <__robkinyon> jrockway: it's a set of scripts that automates > the installation of a specific version of Perl and all the CPAN > modules you specify > [18:28] <__robkinyon> The idea is that you specify a directory and a > list of modules to install from CPAN and go get coffee > [18:28] <__robkinyon> come back in 30min and it's ready to go > [18:29] <__robkinyon> very useful for production systems where you > want to have multiple versions of Perl, each corresponding to a > different installation of the app > [18:29] <__robkinyon> also very useful for authors to have multiple > Perls to test against > [18:29] <__robkinyon> and not just multiple versions of Perl, but > different CPAN installations > > > search.cpan.org should have it indexed by tomorrow(?). Tonight you > can use PAUSE incoming: > > http://pause.perl.org/incoming/ > > _______________________________________________ > Omaha-pm mailing list > Omaha-pm at pm.org > http://mail.pm.org/mailman/listinfo/omaha-pm From jay at jays.net Wed Dec 26 12:51:38 2007 From: jay at jays.net (Jay Hannah) Date: Wed, 26 Dec 2007 14:51:38 -0600 Subject: [Omaha.pm] 49117: Can't fork and $! not set Message-ID: <02DFF8A9-439A-4E15-97A1-A9E38170C43C@jays.net> I submitted a Perl5 bug report today... http://rt.perl.org/rt3/Public/Bug/Display.html?id=49117 j From jay at jays.net Fri Dec 28 14:15:56 2007 From: jay at jays.net (Jay Hannah) Date: Fri, 28 Dec 2007 16:15:56 -0600 Subject: [Omaha.pm] [olug] Bash TCP scripting In-Reply-To: References: Message-ID: On Dec 28, 2007, at 3:32 PM, Travis Owens wrote: > Just out of curiosity, has anyone ever done any scripting with > bash, using > /dev/tcp or some form of socket connections? I'm looking at doing > something > bi-directional, receiving the response after the connection is > established, > parsing it, using a piece to send back and parsing the final response. Why bash? Are you writing a client or a server or both? I'm a big fan of Perl's IO::Multiplex. Here's a chat server in 20 lines of code: http://search.cpan.org/~bbb/IO-Multiplex-1.09/lib/IO/ Multiplex.pm#A_server_example Cheers, j Omaha Perl Mongers: http://omaha.pm.org From TELarson at west.com Mon Dec 31 08:20:47 2007 From: TELarson at west.com (Larson, Timothy E.) Date: Mon, 31 Dec 2007 10:20:47 -0600 Subject: [Omaha.pm] [olug] Bash TCP scripting In-Reply-To: References: Message-ID: Jay Hannah <> wrote: > Why bash? Masochism. :) 10 years ago I often heard the advice to use shell rather than Perl because plenty of machines were still deployed that did not have it installed. That is becoming less true as time goes on and Perl becomes more of a standard tool. Tim -- Tim Larson AMT2 Unix Systems Administrator InterCall, a division of West Corporation Eschew obfuscation! From jay at jays.net Mon Dec 31 09:16:21 2007 From: jay at jays.net (Jay Hannah) Date: Mon, 31 Dec 2007 11:16:21 -0600 Subject: [Omaha.pm] [olug] Bash TCP scripting In-Reply-To: References: Message-ID: <93B2A6DA-E945-46D9-A4BE-85FC62425EAF@jays.net> On Dec 31, 2007, at 10:20 AM, Larson, Timothy E. wrote: > 10 years ago I often heard the advice to use shell rather than Perl > because plenty of machines were still deployed that did not have it > installed. That is becoming less true as time goes on and Perl > becomes > more of a standard tool. Becomes? Wow. If you had sent that email in 1997 I would have agreed. We seem to have different takes on where Perl is on the alpha - production - obsolete bell curve. :) j From topher-pm at zyp.org Mon Dec 31 09:33:43 2007 From: topher-pm at zyp.org (Christopher Cashell) Date: Mon, 31 Dec 2007 11:33:43 -0600 Subject: [Omaha.pm] [olug] Bash TCP scripting In-Reply-To: References: Message-ID: On Dec 31, 2007 10:20 AM, Larson, Timothy E. wrote: > 10 years ago I often heard the advice to use shell rather than Perl > because plenty of machines were still deployed that did not have it > installed. That is becoming less true as time goes on and Perl becomes > more of a standard tool. 10 years ago, I would say that was true. I think your 'becomes' should be 'became', though. Some time ago, now. ;-) I think if you wrote anything non-trivial in "standard" perl (no extra modules that you aren't including with your code), it would probably be more portable[0] across *nix machines than anything else you could do. I would follow this by saying the next most portable would be POSIX compliant shell scripts, but I've been bitten enough times with shell scripts and slight variations in tools and commands across different unix flavors to know that it's a bit of a craps shoot. [0] 'portable' in this e-mail meaning capable of running out of the box on a standard *nix install, with no extra tools, libraries, interpreters, or anything else needing to be installed. These days, it's almost hard to find a Unix install without at least a basic Perl install. > Tim -- Christopher From jay at jays.net Mon Dec 31 14:56:52 2007 From: jay at jays.net (Jay Hannah) Date: Mon, 31 Dec 2007 16:56:52 -0600 Subject: [Omaha.pm] [olug] Bash TCP scripting In-Reply-To: References: Message-ID: <5251EE44-AF48-4F6E-BEBC-58F4F2EBA724@jays.net> On Dec 31, 2007, at 11:33 AM, Christopher Cashell wrote: > These days, it's almost hard to find a Unix install without at > least a basic Perl install. I've been Perl'ing since 1993/1995 (depending on what you count) and I can't remember working on a *nix box didn't have Perl on it. (Except intentionally stripped-down machines.) A few months back I got stuck on an 8 year old Solaris box that had an 8 year old Perl on it (5.0-something). That was pretty painful since I needed to do some pretty recent LDAP stuff. Amazingly, the latest Perl 5.8 built and installed on that box with no problems and I was back in heaven. perl5-porters are magical creatures. :) j From TELarson at west.com Mon Dec 31 15:04:10 2007 From: TELarson at west.com (Larson, Timothy E.) Date: Mon, 31 Dec 2007 17:04:10 -0600 Subject: [Omaha.pm] [olug] Bash TCP scripting In-Reply-To: <93B2A6DA-E945-46D9-A4BE-85FC62425EAF@jays.net> References: <93B2A6DA-E945-46D9-A4BE-85FC62425EAF@jays.net> Message-ID: Jay Hannah <> wrote: > Becomes? Wow. If you had sent that email in 1997 I would have agreed. > We seem to have different takes on where Perl is on the alpha - > production - obsolete bell curve. :) Heh. I was going to grad school that year with CS majors that didn't have a clue what to do at a Unix prompt. I assume they all had DOS/Windows backgrounds. But yeah, I was still hearing that advice in the late 90s. Maybe the profs were just advising that you be really conservative with expectations, or something. Tim -- Tim Larson AMT2 Unix Systems Administrator InterCall, a division of West Corporation Eschew obfuscation! From jay at jays.net Mon Dec 31 16:44:21 2007 From: jay at jays.net (Jay Hannah) Date: Mon, 31 Dec 2007 18:44:21 -0600 Subject: [Omaha.pm] [olug] Bash TCP scripting In-Reply-To: References: <93B2A6DA-E945-46D9-A4BE-85FC62425EAF@jays.net> Message-ID: <1B2D1C06-07F6-49B1-9BF0-9E4B979BD697@jays.net> On Dec 31, 2007, at 5:04 PM, Larson, Timothy E. wrote: > Maybe the profs were just advising that you be really conservative > with expectations, or something. Uh oh. Now I'm going to get in trouble. I just finished a C++ class @ UNO 2 weeks ago. In terms of just solving the problem one of the homework assignments was 400 lines of C ++ or 6 lines of Perl. In the assignment's defense, the point wasn't just to solve the problem -- it was to do it with a specific framework so hopefully the student understands a scalable way to solve much larger, much less trivial problems. It appears to me that CS classes aren't designed to make you the most efficient real-world problem solver.* Instead, I think they're designed to force you through thought processes about how to build things given a certain toolset. So, I suspect many CS profs don't stay on top of the most current specialized tools to solve specific problems. (Except, of course, the faculty members on this mailing list? -grin-) I think they tend towards general, "universal" tools applicable to extremely wide problem domains. (Incidentally, so far in my career C++ has never been the right tool for the jobs I do. But perhaps I'm sheltered / spoiled / cursed? -grin-) Rumor has it UNO is switching some of their courses from C++ to Java in 2008. So I think their CS language menu will be Perl, C, and Java now. I'm not sure if there's any Python left? Bob? How was that for wandering way off topic? :) j * Causing occasional frustrated cursing from yours truly. From georgen at neillnet.com Mon Dec 31 17:24:45 2007 From: georgen at neillnet.com (George Neill) Date: Mon, 31 Dec 2007 19:24:45 -0600 Subject: [Omaha.pm] [olug] Bash TCP scripting In-Reply-To: <1B2D1C06-07F6-49B1-9BF0-9E4B979BD697@jays.net> References: <93B2A6DA-E945-46D9-A4BE-85FC62425EAF@jays.net> <1B2D1C06-07F6-49B1-9BF0-9E4B979BD697@jays.net> Message-ID: Jay, > I just finished a C++ class @ UNO 2 weeks ago. In terms of just > solving the problem one of the homework assignments was 400 lines of C > ++ or 6 lines of Perl. OO PERL :) Just curious ... what was the assignment? Later, George.