Not much of an article here - just some notes about encrypting passwords for Ansible playbooks. All of the examples for adding the encrypted passwords to the ansible playbook are Python (what's up with that?!) :-)
So, I have an example of a playbook to change a user password on all ansible systems and I have translated the password encryption field for Perl (you're welcome!)
Here's my chgUserPW.yml:
---
- hosts: all
sudo: yes
tasks:
- name: Change user1 password
# Created passwd with:
# perl -e 'print crypt("your pw here","\$6\$salt\$")'
# Notes: password, 6 = md5, salt = random string to salt entropy
user: name=user1 update_password=always password=$6$salt$sjuT2.eSTcX/vKwW7RlB1tdLxyB34lJSsndXA5yzC7BZrdAkiAOqtf4NPtHa0tjdFa/5wcS1.vt0LAwzEassr0
All you do is run the Perl one-liner adding your own password and salt string (the word "salt" is probably not a good choice) and you get the format for the password Linux is expecting (salted MD5). Paste that into the password field and you can now change all of your system's user1 passwords to "your pw here".
*Disclaimer - I'd try it on a single system first, preferably one you have a backdoor root account on. It worked for me. Good luck!
Showing posts with label ironman. Show all posts
Showing posts with label ironman. Show all posts
Thursday, January 5, 2017
Tuesday, September 20, 2016
Alternatives to Powerpoint - My Favorite
OpenSource.com just sent me a mailing this morning entitled: 3 open source alternatives to PowerPoint. I immediately thought to myself "Ok, LibreOffice, CalligraOffice ... I wonder what the 3rd is?". I was really surprised it was MY personal favorite: Reveal.js. I've been using that since Perltricks.com had an article on it. I've seen several presentations done using it at YAPCs and Ohio Linuxfest (coming up soon, btw).
Despite the headline, OpenSource.com goes beyond 3 alternatives and also discusses using your console for slide shows with Vimdeck. Very interesting!
The article didn't explain how to use (my favorite) Reveal.js though so if you're curious, check out the Perltricks link above. I think you'll be glad you did.
Despite the headline, OpenSource.com goes beyond 3 alternatives and also discusses using your console for slide shows with Vimdeck. Very interesting!
The article didn't explain how to use (my favorite) Reveal.js though so if you're curious, check out the Perltricks link above. I think you'll be glad you did.
Labels:
Callgra Stage,
CalligraOffice,
ironman,
ironman perl,
KOffice,
LibreOffice,
Linuxfest,
OpenOffice,
perl,
Reveal.js,
YAPC::NA
Alternatives to Powerpoint - My Favorite
OpenSource.com just sent me a mailing this morning entitled: 3 open source alternatives to PowerPoint. I immediately thought to myself "Ok, LibreOffice, CalligraOffice ... I wonder what the 3rd is?". I was really surprised it was MY personal favorite: Reveal.js. I've been using that since Perltricks.com had an article on it. I've seen several presentations done using it at YAPCs and Ohio Linuxfest (coming up soon, btw).
Despite the headline, OpenSource.com goes beyond 3 alternatives and also discusses using your console for slide shows with Vimdeck. Very interesting!
The article didn't explain how to use (my favorite) Reveal.js though so if you're curious, check out the Perltricks link above. I think you'll be glad you did.
Despite the headline, OpenSource.com goes beyond 3 alternatives and also discusses using your console for slide shows with Vimdeck. Very interesting!
The article didn't explain how to use (my favorite) Reveal.js though so if you're curious, check out the Perltricks link above. I think you'll be glad you did.
Wednesday, July 15, 2015
If I HATE web lists so much - why do i click on them?!
I hate web lists. I really do. Especially the ones that list things ONE-AT-TIME so you have to load a page that is 90% ads. Irritating! But, I saw one about "America's Top 100 Colleges". I work at a University - I wondered if we made the top 100. So, I took the bait.
First I am sent to a page telling me what the list is about WITH LOTS OF ADS and a NEXT button. I click NEXT. Ok, number 1, lots of ads another NEXT button. This has already gotten old for me. I was just curious what the top 100 colleges were - can't they just show me a list?!
So, I think to myself "I wonder if I could just harvest the list from the website with Perl. I look at the URL - I see what they're doing - simply incrementing the folder by 1 each time. Easy! Next I look at the source code: TOO EASY! They have only the STRONG tag once per page for the school name. Cool! So, two minutes of code and then: Tah-dah!
#!/usr/bin/perl -w
# Remember - this took two minutes, I know it's not perfect
use LWP::Simple;
my $rank=100;
my $base="http://www3.forbes.com/forbeswoman/americas-top-100-colleges/";
while ($rank >0) {
my $url = $base . "/$rank/";
my $html = get($url);
$html =~ m{<p><strong>(.*)</strong></p>}
} or die "Cannot find school: $rank\n";
$school = $1;
print "$rank: $school\n";
$rank--;
}
I run it. It doesn't work (I think). It isn't changing the name. Hmmm. I keep killing it off before it finishes and examine the code. I cannot see a problem so let it run - this time all the way to the end. It does NOT change the name until it counts down to 50. Wild! I check the site - sure enough - there are no new schools after 50. This is a list of the (alleged) Top 50 Colleges going under the name Top 100 Colleges.
Ha! I guess they never thought anyone would ever have the patience to wade through all of those ads to see all 100 (I sure didn't). This makes me wonder: Is it just a scam to get you to click through ads or did the content creator tell his boss he put all 100 pages up there knowing NO ONE would ever click through all of that. If it's the latter - sorry buddy (or lady) for exposing you.
First I am sent to a page telling me what the list is about WITH LOTS OF ADS and a NEXT button. I click NEXT. Ok, number 1, lots of ads another NEXT button. This has already gotten old for me. I was just curious what the top 100 colleges were - can't they just show me a list?!
So, I think to myself "I wonder if I could just harvest the list from the website with Perl. I look at the URL - I see what they're doing - simply incrementing the folder by 1 each time. Easy! Next I look at the source code: TOO EASY! They have only the STRONG tag once per page for the school name. Cool! So, two minutes of code and then: Tah-dah!
#!/usr/bin/perl -w
# Remember - this took two minutes, I know it's not perfect
use LWP::Simple;
my $rank=100;
my $base="http://www3.forbes.com/forbeswoman/americas-top-100-colleges/";
while ($rank >0) {
my $url = $base . "/$rank/";
my $html = get($url);
$html =~ m{<p><strong>(.*)</strong></p>}
} or die "Cannot find school: $rank\n";
$school = $1;
print "$rank: $school\n";
$rank--;
}
I run it. It doesn't work (I think). It isn't changing the name. Hmmm. I keep killing it off before it finishes and examine the code. I cannot see a problem so let it run - this time all the way to the end. It does NOT change the name until it counts down to 50. Wild! I check the site - sure enough - there are no new schools after 50. This is a list of the (alleged) Top 50 Colleges going under the name Top 100 Colleges.
Ha! I guess they never thought anyone would ever have the patience to wade through all of those ads to see all 100 (I sure didn't). This makes me wonder: Is it just a scam to get you to click through ads or did the content creator tell his boss he put all 100 pages up there knowing NO ONE would ever click through all of that. If it's the latter - sorry buddy (or lady) for exposing you.
Wednesday, April 20, 2011
CPAN to the rescue
I needed a quick tool to change HTML to POD. I coulda sworn I had a html2pod utility at the command line - nope - must've been that other Linux distro. No worries - I just grabbed Pod::HTML2Pod and with very little modification to the example code I had just what I wanted.
Friday, March 4, 2011
Mac OSX and CGI.pm
"I'm NOT a web developer!" I've been saying that a lot lately. Even so, because I have done a bit of LDAP programming and they needed a web interface, I wrote a quick hack which turned into a big, long painful project. The biggest issue is so many things don't work the same (or at all) on Mac OSX. OpenLDAP, for instance (a whole other story). [It should be noted - I'm also not a Mac guy.]

I tried for several days to get CGI.pm redirects and refreshes to work but kept getting Error 302's. I found lots of people with the same issue on the Mac. Finally - someone said "You'll have to write it without CGI.pm because it doesn't 100% work on the Mac (and/or maybe the Apple Apache config was incriminated). Anyway, I rewrote the redirects without CGI.pm (ugly, inelegant Perl 4ish looking code) and it worked fine.
Since I never exactly found the answer - I want to state for future folks looking for an answer - "IT DOESN'T WORK RIGHT ON A MAC" (this phrase can be re-used for a great many things). And, if I'm wrong (because, remember, I'm not a web developer) it'd be great for someone to comment with the right answer.
I'll probably get comments such as "You're using CGI.pm for web development?! Are you from the past?!" To this I would say "Yes I am".

I tried for several days to get CGI.pm redirects and refreshes to work but kept getting Error 302's. I found lots of people with the same issue on the Mac. Finally - someone said "You'll have to write it without CGI.pm because it doesn't 100% work on the Mac (and/or maybe the Apple Apache config was incriminated). Anyway, I rewrote the redirects without CGI.pm (ugly, inelegant Perl 4ish looking code) and it worked fine.
Since I never exactly found the answer - I want to state for future folks looking for an answer - "IT DOESN'T WORK RIGHT ON A MAC" (this phrase can be re-used for a great many things). And, if I'm wrong (because, remember, I'm not a web developer) it'd be great for someone to comment with the right answer.
I'll probably get comments such as "You're using CGI.pm for web development?! Are you from the past?!" To this I would say "Yes I am".
Monday, February 21, 2011
SDL and Perl
I missed this article from Perl.com last month: Visualizing Music with SDL and Perl. It caught my eye because I've just recently read The Book of Xen (great book, btw) and it mentioned SDL as an alternative to, say, vnc, which sent me off looking up more about SDL. Anyhoo, the code looks like fun and uses concepts that could come in handy - especially if I ever get around to writing a video game (kidding - not likely to make it down that far on the list in this lifetime). So check it out - there's still lots of cool things going on with Perl all the time.
Thursday, October 21, 2010
Really good Perl book under a secretive title
Since I've been doing a lot of LDAP programming lately, I finally broke down and bought O'Reilly's LDAP System Administration. I found a used paperback for $4! While I was waiting, I got impatient and bought the Kindle version for my Android phone. I just bought it for the LDAP ACL info but I was thrilled to see chapter 10 was devoted to Perl-LDAP. It explained a lot of things in the Perl-LDAP example code that I hadn't seen explained before (I'm sure it's out there but the author has done a nice job of digging it all up and putting it together). Anyway, if you're looking for a nice LDAP book, this is looking like a good one so far (still reading).
Monday, August 16, 2010
New technology I'm Working On
I find that people often think because I work primarily on UNIX/Linux and still use Perl that I'm not learning anything new or that I do not like learning. Nothing could be further from the truth. I love new technology and I'm always learning something new.
Here's what I've been working on in the last year:
I'm pretty excited about my list (above) and do as much reading and experimenting as time permits. It sure seems to me that I'm learning new stuff - Well, I'm learning things that interest me. I guess because non-Windows things don't interest some I guess it appears that I'm not learning anything (that interests them). Oh well. Can't please everyone and I stopped trying long ago.
Here's what I've been working on in the last year:
- Solaris Zones and Containers
- Solaris Zetabyte File system (ZFS)
- GNU Screen
- Ruby
- More Perl LDAP programming
- More Perl programming in general
- Rakudo (a Perl 6 distro)
- PUGS (another Perl 6 distro)
- SQLite3 and Perl
- RCS (Revision Control System)
- Solaris LDOMs (need a lab experiment)
- See how ZFS is implemented under other OS's (e.g. FreeBSD)
- Use More Ruby! (and I'm looking at a Rails book from the library)
- Juniper's JunOS (I like the XML and the idea of scripting with Perl)
- MORE Rakudo!! (Not so much Pugs) I hope to contribute bug reports
- Sun's Dtrace (especially using Perl and Dtrace)
- Xen and Linux - need a lab experiment
- Btrfs - Linux's answer to ZFS? Need to explore in a lab.
- Lots more SQLite (I really like that tool)
- Python (Because Zope runs on it!)
- Plone (runs on Zope)
- C - need to refreshen my C programming skills - getting rusty
- Java
- Command line Sun VirtualBox
- I'm sure there's a few more...
I'm pretty excited about my list (above) and do as much reading and experimenting as time permits. It sure seems to me that I'm learning new stuff - Well, I'm learning things that interest me. I guess because non-Windows things don't interest some I guess it appears that I'm not learning anything (that interests them). Oh well. Can't please everyone and I stopped trying long ago.
Thursday, August 5, 2010
Perl and SQLite
Finally got around to finishing my little SQLite and Perl program. To speed things up, I used a shell script with remote SSH commands to grab the data, then used Perl to stuff it into SQLite. Very cool! Need to use Perl's Net-SNMP on next version but this was mainly an excuse to use SQLite. Glad I did. There's a lot of strangeness - can't get used to putting a dot in front of commands and many of my favorite SQL commands are missing or renamed. Still - SO COOL to be able to create a database on the fly like that.
Saturday, July 10, 2010
Nifty Perl Hack
I threw together a tiny bit of code with the example code from Net::IMAP::Simple to make a program that watches for Mailman unsubscribe messages, logs them, then deletes the message. It was a 5 minute job (except for the part where my iteration was off by one and kept deleting the wrong message). Perl is so handy for things like this.
Wednesday, February 24, 2010
Love the New System Admin w/Perl book (and RCS)!
I've been doing a bit of Perl-LDAP programming and I had always found the 2000 version of Perl for System Administration to be really helpful - especially the tutorials in the appendix (more on that in a bit). I just got the the new version: Automating System Administration with Perl. I was amazed at how much more useful it was. Not only is there 50% more material, ALL of the older stuff has been reworked and freshened. The LDAP section I was using heavily is MUCH improved. Too much goodness to cover now - check it out yourself!
The reason I decided to make the post was to mention RCS, in the books appendix, the author has a 5 Minute RCS Tutorial which makes a strong case for using RCS instead of all of those other revision control systems. I've tried RSC in the past and I've tried CVS and the guys in the office recently tried to get me to use Mercurial (Wow! Talk about overkill for what I do!!) But the authors argument was, this is so simple and easy for your small scripts lying around - why not use it. I was initially daunted by all of the commands and things you could do when I had looked at it years ago but the author distilled it down to a handful of commands. I am going to distill it down further:
1) Check in and unlock your program (leaving a copy):
$ ci -u program
2) To edit, check out and lock your program:
$ co -l program
3) View your revision logs:
$ rlog program
So far, that works well enough for me. Be sure to read the whole 5 Minute RCS Tutorial (see link above). I wish I had used this on my most recent, arduous LDAP programming job. Instead made numbered versions and left them lying all over. I then had to open them to see why this one was named program-4 and how it differed from program-3, etc. I know - silly. Should've stuck with this when I looked at in in 1997 (Hey! I remember the project that caused me to consider rcs then - that's not weird!)
The reason I decided to make the post was to mention RCS, in the books appendix, the author has a 5 Minute RCS Tutorial which makes a strong case for using RCS instead of all of those other revision control systems. I've tried RSC in the past and I've tried CVS and the guys in the office recently tried to get me to use Mercurial (Wow! Talk about overkill for what I do!!) But the authors argument was, this is so simple and easy for your small scripts lying around - why not use it. I was initially daunted by all of the commands and things you could do when I had looked at it years ago but the author distilled it down to a handful of commands. I am going to distill it down further:
1) Check in and unlock your program (leaving a copy):
$ ci -u program
2) To edit, check out and lock your program:
$ co -l program
3) View your revision logs:
$ rlog program
So far, that works well enough for me. Be sure to read the whole 5 Minute RCS Tutorial (see link above). I wish I had used this on my most recent, arduous LDAP programming job. Instead made numbered versions and left them lying all over. I then had to open them to see why this one was named program-4 and how it differed from program-3, etc. I know - silly. Should've stuck with this when I looked at in in 1997 (Hey! I remember the project that caused me to consider rcs then - that's not weird!)
Friday, November 13, 2009
Newly Updated www.perl.org looks great!
Just saw this on Perlbuzz: www.perl.org just got a total makeover. Very nicely organized. I like the layout a lot. The "Learning Perl" link has a list of resources which includes video! I never even thought about that before. For example, here's a video of a presentation on Perl's Object Oriented Module (Moose).
Labels:
ironman,
ironman perl6 perl,
learning perl,
moose,
perlbuzz,
video,
www.perl.org
Thursday, November 12, 2009
DSEE for Solaris 10x86 on OpenSolaris

Ha! Well, not sure how far I'll get bu the first snag was I couldn't proceed because I didn't have SUNWpl5u installed. It turns out SUNWpl5u is Perl 5.8.4 and I do have it installed: It's just called SUNWperl584core. A simple symbolic link and it passes (for now). We'll see how far we get...
Labels:
ironman,
ironman perl6 perl,
opensolaris,
sun directory server
Thursday, September 10, 2009
Off Topic Post Today
It's also a bit of a cross-posting. I'm a UNIX systems administrator - a computer geek. I also raise and race pigeons. So, this article really grabbed my attention! It was an article about racing pigeons on SlashDot. Evidently, someone wrote an RFC for the Standard for the Transmission of IP Datagrams on Avian Carriers. That is, sending data using racing pigeons! Of course, this has been done (for a couple millennium) but they are now applying the standards of TCP/IP (the Internet Protocol) to the data. That is, how do you handle packet loss? (Such as interception by Prairie Falcon). Although, it was meant as a joke, they were able to use it. In one example they sent a 4GB SD card by pigeon in 48 minutes.
Okay, I posted this to my pigeon blog but it was not well received. Confused people asked me what it meant. I found the results of this years race on BBC this morning which state it more plainly:
Wait - I've got it. This blog is for the Perl Ironman - right? That reminds me - "Ironman" Mike Tyson raises pigeons. [sound of crickets] That's all I've got.
Okay, I posted this to my pigeon blog but it was not well received. Confused people asked me what it meant. I found the results of this years race on BBC this morning which state it more plainly:
Winston the pigeon took two hours to carry the data 60 miles - in the same time the ADSL had sent 4% of the data.Okay, it's got nothing to do with Perl but my racing pigeon buddies don't see the humor in the RFC for TCP/IP using Pigeons so I had to post it here. :-)
Wait - I've got it. This blog is for the Perl Ironman - right? That reminds me - "Ironman" Mike Tyson raises pigeons. [sound of crickets] That's all I've got.
Labels:
ironman,
ironman perl6 perl,
mike tyson,
racing pigeons
Friday, September 4, 2009
Cheap Books!
Wow! This is pretty neat! Too bad I already own both of those. If you didn't catch it - use Perl; says O'Reilly has dropped the price of Learning Perl and Mastering Perl to $9.99 - before other discounts! I have all of the Learning Perl editions! Some are signed by the Author(s). :-p
So what does this mean? I hope it means a 6th edition of Learning Perl is coming out and not something else (remember "cut-out albums"?).
Tuesday, August 25, 2009
It's tough to say something EVERY WEEK
Man! This is harder than I thought. I don't have any trouble blogging about my racing pigeon training or my catch-all blog (that has revolved around beekeeping lately) . I've got ideas for a couple of other blogs too. But, what to say about my baby-talk Perl that won't be ridiculed? Well, one thing, in response to the co-workers who said "Perl is dead", I thought this news about the new Android phone using Perl spoke for itself!
Monday, August 17, 2009
Am I the only one NOT using "strict"?
An old friend came to town the other day. He's quite a Perl guru. Like me, he was a Perl user prior to Perl 5 and I figured he'd be someone who, like me, NEVER uses 'use strict'; in their code. I was wrong! Man, that's one of the things I like about Perl. It'll let me ride a motorcycle without a helmet. Drive without a seat belt. Go swimming in less than 30 minutes after I've eaten or even run with scissors! I know! I know! These are not good ideas - but short cuts seldom are. It's the price you pay and as long as you know the risks, it's nice that Perl lets you use a variable that has not been declared or invoke $_ with the notion that both Perl and yourself know what you're talking about (in that context). I like that freedom. I guess the other side of the coin is you're also allowed to add "use strict" and "use warnings". I'm just glad it's not the default (yet).
Friday, July 24, 2009
use Net::LDAP::LDIF - no, really, use it!
It took me a while to figure this one out. I guess if I had a better grasp of hashes, this would've been more obvious. The LDIF I was reading was HUGE. I found a good example on PerlMonks that showed this VERY useful line:
$uid = $entry->get_value("uid");
I used DataDumper to find the key names of the other values and then I was off and running: parsing an LDIF filled with 40,000 users and running reports on anything I wanted. On my workstation, it only took 24 seconds to generate multiple reports! VERY COOL!
$uid = $entry->get_value("uid");
I used DataDumper to find the key names of the other values and then I was off and running: parsing an LDIF filled with 40,000 users and running reports on anything I wanted. On my workstation, it only took 24 seconds to generate multiple reports! VERY COOL!
Tuesday, July 21, 2009
Joining The Perl Iron Man Program
Just noticed the Iron Man blogging Challenge at Enlightened Perl. Sounds fun - promoting Perl by blogging about it. Funny - that came up at work recently. The younger guys at work here are convinced Perl died a long time ago and I should be learning Python. "Have you noticed NO ONE is talking about Perl anymore?!" they chided. One thing that lead them to believe that (I think) was my homepage which had a programming republic of Perl icon which had been linked to perl.com for years. Since I force my web page to be the homepage for every server I manage, they see this site a lot (and they like it!). The Perl icon used to take you to this stale website that had all of the really old post dates plainly in view. (Funny - they have removed the post dates now.) But I wanted to convince them Perl wasn't dead (just Perl.com), so I changed my programming republic of Perl icon to point at a custom page of Perl links I threw together. It had active sites like Perl Buzz, Perl Monks, Planet Perl and Use Perl. I also included the [somewhat] nearby and very active Perl Monger Groups: St.Louis Perl Mongers and Purdue Perl Mongers. The guys here are not convinced yet, but maybe the Iron Man competition will throw Perl back on their radar and make it "fashionable" (to them) once again. Meanwhile, I'll still use it to "get things done". :-p
Subscribe to:
Posts (Atom)