user/alex/software/my-snippets.git
10 years agoclassify-users: determine type of Athena accounts master
Alex Dehnert [Fri, 8 Nov 2013 06:36:04 +0000 (01:36 -0500)]
classify-users: determine type of Athena accounts

This script takes a list of usernames (or email addresses, or whatever) and
classifies each as student, staff, etc., or unknown.

10 years agorblanche: allow checking deactivations (-d)
Alex Dehnert [Sat, 12 Oct 2013 18:06:19 +0000 (14:06 -0400)]
rblanche: allow checking deactivations (-d)

This is the final feature that consult's Perl rblanche has, I believe.

10 years agorblanche: avoid crashing on deactivated users
Alex Dehnert [Sat, 12 Oct 2013 18:03:23 +0000 (14:03 -0400)]
rblanche: avoid crashing on deactivated users

When chpoboxing (-c), we get_pobox for each user. moira returns an error for
(some) deactivated users, so we should catch that error and report it inline,
rather than erroring out entirely. This was discovered by rblanche'ing
sipb-prospectives.

10 years agorblanche: add support for -c (chpobox)
Alex Dehnert [Thu, 10 Oct 2013 05:04:28 +0000 (01:04 -0400)]
rblanche: add support for -c (chpobox)

10 years agorblanche.py: update Makefile and README
Alex Dehnert [Wed, 9 Oct 2013 16:08:10 +0000 (12:08 -0400)]
rblanche.py: update Makefile and README

10 years agorblanche: add optional authentication
Alex Dehnert [Wed, 9 Oct 2013 16:06:54 +0000 (12:06 -0400)]
rblanche: add optional authentication

10 years agoAdd python implementation of consult's rblanche
Alex Dehnert [Wed, 9 Oct 2013 15:03:35 +0000 (11:03 -0400)]
Add python implementation of consult's rblanche

This isn't complete yet, but it includes the key functionality and (for deeply
nested lists) is much faster. It also handles member lists that start with
hyphens.

Missing features include:
- auth support
- most of rblanche's options

10 years agodiff-memberships: add it to Makefile, README
Alex Dehnert [Fri, 27 Sep 2013 21:58:01 +0000 (17:58 -0400)]
diff-memberships: add it to Makefile, README

10 years agodiff-memberships: cleanup to make it more useable
Alex Dehnert [Fri, 27 Sep 2013 21:56:51 +0000 (17:56 -0400)]
diff-memberships: cleanup to make it more useable

Use an absolute path to the data directory, not a relative one; loop inside the
script, not outside; etc..

10 years agodiff-memberships: add list diffing script
Alex Dehnert [Fri, 27 Sep 2013 21:37:36 +0000 (17:37 -0400)]
diff-memberships: add list diffing script

This is the list-diffing script that I've used for a while, in its original
version. It has not yet been cleaned up for others to use.

10 years agomail-merge: usability improvements
Alex Dehnert [Tue, 3 Sep 2013 02:09:58 +0000 (22:09 -0400)]
mail-merge: usability improvements

- open files in "universal newlines" mode
- give a better error when the "email" field is missing

10 years agoldapfinger: set safer shell options
Alex Dehnert [Fri, 9 Aug 2013 14:08:41 +0000 (10:08 -0400)]
ldapfinger: set safer shell options

10 years agoldapfinger: fix quoting
Alex Dehnert [Fri, 9 Aug 2013 14:06:42 +0000 (10:06 -0400)]
ldapfinger: fix quoting

10 years agoldapfinger: frob some settings so LDAP works
Alex Dehnert [Fri, 9 Aug 2013 14:05:40 +0000 (10:05 -0400)]
ldapfinger: frob some settings so LDAP works

Not really sure why this helps...

10 years agokrbroot: Handle unset ATHENA_USER
Alex Dehnert [Fri, 17 May 2013 20:42:53 +0000 (16:42 -0400)]
krbroot: Handle unset ATHENA_USER

10 years agoAdd URL to the README
Alex Dehnert [Fri, 17 May 2013 06:37:06 +0000 (02:37 -0400)]
Add URL to the README

10 years agoBump the copyright date
Alex Dehnert [Fri, 17 May 2013 06:36:08 +0000 (02:36 -0400)]
Bump the copyright date

10 years agokrbroot: harden the shell settings
Alex Dehnert [Fri, 17 May 2013 06:31:04 +0000 (02:31 -0400)]
krbroot: harden the shell settings

See https://sipb.mit.edu/doc/safe-shell/ for the logic.

10 years agokrbroot: Support non-default instances
Alex Dehnert [Fri, 17 May 2013 06:17:06 +0000 (02:17 -0400)]
krbroot: Support non-default instances

Also, non-default principals more generally and non-default KRB5CCNAME values.

10 years agoFinish ripping out krb4 support
Alex Dehnert [Fri, 17 May 2013 05:47:12 +0000 (01:47 -0400)]
Finish ripping out krb4 support

Modern systems don't support krb4, and we haven't kinit'd with krb4 tickets for
ages. Given that, don't try to (unsupportedly) kdestroy our (non-existent) krb4
tickets.

10 years agoScript to turn hostnames into their moira contacts
Alex Dehnert [Fri, 17 May 2013 05:45:46 +0000 (01:45 -0400)]
Script to turn hostnames into their moira contacts

11 years agoAdd a "screen" subcommand to krbroot
Alex Dehnert [Sun, 21 Apr 2013 20:26:59 +0000 (16:26 -0400)]
Add a "screen" subcommand to krbroot

I have screen profiles for "all scripts web servers", "all scripts hosts",
etc., which means I often want to run screen with root tickets and pass it some
options. This makes that easy.

This uses the technique from ASA DB commit
08d4fa6744d2785023666d10a1936460811fcdb2
(https://asa.scripts.mit.edu/trac/changeset/08d4fa6744d2785023666d10a1936460811fcdb2)
to pass commands possibly containing metacharacters through pagsh without
quoting issues.

11 years agomail-merge: Bail if sendmail fails
Alex Dehnert [Thu, 14 Mar 2013 03:15:16 +0000 (23:15 -0400)]
mail-merge: Bail if sendmail fails

11 years agomail-merge: allow sending to multiple emails
Alex Dehnert [Wed, 13 Mar 2013 09:26:28 +0000 (05:26 -0400)]
mail-merge: allow sending to multiple emails

This adds an option, --split=SPLIT, that allows splitting the "email" field to
send to several recipients.

11 years agomail-merge: document RT setup better
Alex Dehnert [Sun, 10 Mar 2013 23:34:24 +0000 (19:34 -0400)]
mail-merge: document RT setup better

11 years agomail-merge: Add example command-line for RT
Alex Dehnert [Sun, 10 Mar 2013 22:58:42 +0000 (18:58 -0400)]
mail-merge: Add example command-line for RT

11 years agomail-merge: import rtkit from ~adehnert if needed
Alex Dehnert [Sat, 23 Feb 2013 21:47:31 +0000 (16:47 -0500)]
mail-merge: import rtkit from ~adehnert if needed

If rtkit can't be found on the normal path, add my locker to sys.path and try
again.

11 years agoMakefile: use common/bin/ for scripts
Alex Dehnert [Sat, 23 Feb 2013 21:46:01 +0000 (16:46 -0500)]
Makefile: use common/bin/ for scripts

Previously we used common/ directly.

11 years agomail-merge: Add instructions for using with RT
Alex Dehnert [Mon, 18 Feb 2013 06:07:12 +0000 (01:07 -0500)]
mail-merge: Add instructions for using with RT

11 years agomail-merge: only send one copy with RT
Alex Dehnert [Mon, 18 Feb 2013 06:00:40 +0000 (01:00 -0500)]
mail-merge: only send one copy with RT

Previously, the RT mode for mail-merge would send one copy directly to the
recipient, and one to the user through RT. This changes mail-merge to only send
through RT, so the user only gets one copy.

11 years agoAdd option to create and set up RT ticket
Alex Dehnert [Mon, 18 Feb 2013 05:34:44 +0000 (00:34 -0500)]
Add option to create and set up RT ticket

If your organization uses RT, it may be helpful to mail-merge a message that
you send out through RT, and create corresponding RT tickets for each email.
We now support a --rt-queue option, allowing specifying a queue to create a
ticket in, and --rt-owner, to specify a owner (and AdminCC) for each created
ticket.

11 years agoChange the sample recipient email for mail-merge
Alex Dehnert [Mon, 18 Feb 2013 05:28:18 +0000 (00:28 -0500)]
Change the sample recipient email for mail-merge

11 years agoRefactor mail-merge slightly
Alex Dehnert [Mon, 18 Feb 2013 00:43:49 +0000 (19:43 -0500)]
Refactor mail-merge slightly

11 years agosshroot: use set -e
Alex Dehnert [Sat, 15 Dec 2012 13:20:57 +0000 (08:20 -0500)]
sshroot: use set -e

Also, set -e doesn't cause failures when passing the output of a subshell
directly to eval, so use an intermediate variable instead.

11 years agosshroot: handle unknown args correctly
Alex Dehnert [Sat, 15 Dec 2012 11:51:05 +0000 (06:51 -0500)]
sshroot: handle unknown args correctly

11 years agoMerge remote branch 'origin/master'
Alex Dehnert [Sat, 15 Dec 2012 10:10:38 +0000 (05:10 -0500)]
Merge remote branch 'origin/master'

* origin/master:
  mail-merge: remind people to cd to the examples
  ldapfinger: show how to use ldaps and ldap-too
  Instructions for using mail-merge
  Install scripts read-only
  Update Makefile and README to reflect removed scripts
  Remove list-members
  Remove check-host script
  Remove card-access script
  Optionally show queries used in list-of-lists-updater
  Remove pag-screen, since it's maintained elsewhere
  Add sendmail-based mail merger
  Refactor out the actual mail-sending

11 years agoAdd various sshroot options
Alex Dehnert [Sat, 15 Dec 2012 10:02:34 +0000 (05:02 -0500)]
Add various sshroot options

-l  key lifetime (default: 15 minutes)
-k  key suffix to use (default: "root")
-H  hostname to use (default: local hostname, as derived by various checks)

11 years agomail-merge: remind people to cd to the examples
Alex Dehnert [Tue, 20 Nov 2012 08:57:29 +0000 (03:57 -0500)]
mail-merge: remind people to cd to the examples

11 years agoldapfinger: show how to use ldaps and ldap-too
Alex Dehnert [Tue, 20 Nov 2012 08:56:58 +0000 (03:56 -0500)]
ldapfinger: show how to use ldaps and ldap-too

11 years agoInstructions for using mail-merge
Alex Dehnert [Mon, 19 Nov 2012 10:45:17 +0000 (05:45 -0500)]
Instructions for using mail-merge

11 years agoInstall scripts read-only
Alex Dehnert [Sun, 18 Nov 2012 23:37:28 +0000 (18:37 -0500)]
Install scripts read-only

Switch from using cp to using install to install scripts, and install them 555
to reduce the risk of accidentally changing the installed scripts and not this
repo.

11 years agoUpdate Makefile and README to reflect removed scripts
Alex Dehnert [Sun, 18 Nov 2012 23:32:13 +0000 (18:32 -0500)]
Update Makefile and README to reflect removed scripts

11 years agoRemove list-members
Alex Dehnert [Sun, 18 Nov 2012 23:30:25 +0000 (18:30 -0500)]
Remove list-members

This is pretty much equivalent to blanche -l, plus I don't think I've used it
in ages.

11 years agoRemove check-host script
Alex Dehnert [Sun, 18 Nov 2012 23:28:44 +0000 (18:28 -0500)]
Remove check-host script

Now that Scripts Pony exists, checking host existence by hand isn't really a
thing any more.

11 years agoRemove card-access script
Alex Dehnert [Sun, 18 Nov 2012 23:27:12 +0000 (18:27 -0500)]
Remove card-access script

The ASA DB now includes similar functionality (given list of usernames, produce
stuff to send to CAC).

11 years agoOptionally show queries used in list-of-lists-updater
Alex Dehnert [Sun, 18 Nov 2012 23:17:00 +0000 (18:17 -0500)]
Optionally show queries used in list-of-lists-updater

Copied in from ~/bin/.

11 years agoRemove pag-screen, since it's maintained elsewhere
Alex Dehnert [Sun, 18 Nov 2012 23:15:03 +0000 (18:15 -0500)]
Remove pag-screen, since it's maintained elsewhere

pag-screen is now maintained in the SIPB locker (/mit/sipb/src/pag-screen/) and
on GitHub (https://github.com/sipb/pag-screen/). This version is now redundant,
and liable to become desynced (as it already has).

11 years agomail-merge: support sending mail with sendmail
Alex Dehnert [Thu, 21 Jun 2012 08:55:02 +0000 (04:55 -0400)]
mail-merge: support sending mail with sendmail

This adds a /usr/lib/sendmail backend, to allow running mail-merge
on machines that do not run an SMTP server.

12 years agosshroot: minor cleanup, feature, and bugfixes
Alex Dehnert [Mon, 12 Mar 2012 18:37:13 +0000 (14:37 -0400)]
sshroot: minor cleanup, feature, and bugfixes

* delete some kerberos-related lines
* don't default to root for ssh'ing
* set an environment variable to indicate running under sshroot
* allowing passing arguments to the shell subcommand
* display the command being run

12 years agosshroot: store the timeout in minutes
Alex Dehnert [Mon, 12 Mar 2012 18:36:54 +0000 (14:36 -0400)]
sshroot: store the timeout in minutes

12 years agoscript to ~build out a list of lists
Alex Dehnert [Mon, 12 Mar 2012 18:28:52 +0000 (14:28 -0400)]
script to ~build out a list of lists

In particular, given a starting list, this computes the transitive closure
under the operations:
* get the lists this list owns
* get the lists this list contains
* (disabled) get the lists that contain this list

It allows specifying a list whose members should be skipped, as well.

The code is easy to configure for which of those operations to use, and
whether to do it recursively or not. At the moment, this isn't exposed to
the command line, though that would be a reasonable feature to add.

12 years agoScript to sort lines into different files
Alex Dehnert [Thu, 2 Feb 2012 04:33:55 +0000 (23:33 -0500)]
Script to sort lines into different files

12 years agoAdd sendmail-based mail merger
Alex Dehnert [Fri, 16 Sep 2011 00:08:45 +0000 (20:08 -0400)]
Add sendmail-based mail merger

12 years agoRefactor out the actual mail-sending
Alex Dehnert [Thu, 15 Sep 2011 23:38:02 +0000 (19:38 -0400)]
Refactor out the actual mail-sending

12 years agoMake mail-merge slightly more generic
Alex Dehnert [Thu, 28 Apr 2011 05:17:14 +0000 (01:17 -0400)]
Make mail-merge slightly more generic

13 years agopag-screen: report more errors
Alex Dehnert [Thu, 21 Apr 2011 23:33:59 +0000 (19:33 -0400)]
pag-screen: report more errors

13 years agoPrint the LDAP command-line
Alex Dehnert [Mon, 24 Jan 2011 06:28:27 +0000 (01:28 -0500)]
Print the LDAP command-line

Some large fraction of the times I use ldapfinger, I'm using it instead of
reading the ldapsearch man page. Consequently, printing the commandline instead
of requiring me to run "cat $(which ldapfinger)" would be convenient.

13 years agoAdd README with license and ~history
Alex Dehnert [Wed, 6 Oct 2010 21:45:41 +0000 (17:45 -0400)]
Add README with license and ~history

13 years agomake-zcrypt-key: Punt 2>/dev/null
Alex Dehnert [Tue, 20 Jul 2010 02:09:06 +0000 (22:09 -0400)]
make-zcrypt-key: Punt 2>/dev/null

Anders suggests that it isn't necessary and might be a bad idea. I can't
remember why it was ever there, so I'll try punting it...

13 years agoAvoid early termination of the key
Alex Dehnert [Tue, 20 Jul 2010 02:04:28 +0000 (22:04 -0400)]
Avoid early termination of the key

Newlines will end a zcrypt key early, which is bad. So delete them.

Thanks to Anders on -c rye -i ask-zephyr.d.

13 years agoMakefile: similar treatment for arch list
Alex Dehnert [Fri, 25 Jun 2010 08:26:06 +0000 (04:26 -0400)]
Makefile: similar treatment for arch list

13 years agoMakefile: sort list of scripts
Alex Dehnert [Fri, 25 Jun 2010 08:23:35 +0000 (04:23 -0400)]
Makefile: sort list of scripts

13 years agoMakefile: Nicer line breaks in script list
Alex Dehnert [Fri, 25 Jun 2010 08:20:53 +0000 (04:20 -0400)]
Makefile: Nicer line breaks in script list

13 years agoSplit list of scripts onto multiple lines
Alex Dehnert [Fri, 25 Jun 2010 08:16:50 +0000 (04:16 -0400)]
Split list of scripts onto multiple lines

13 years agoAdd pag-screen script
Alex Dehnert [Fri, 28 May 2010 07:34:49 +0000 (03:34 -0400)]
Add pag-screen script

Based on owl-screen (from kchen), this creates a screen in a new PAG
with a new kerberos ticket cache.

13 years agosshroot: better handling of getting keys
Alex Dehnert [Fri, 25 Jun 2010 07:51:16 +0000 (03:51 -0400)]
sshroot: better handling of getting keys

* Rename with-keys to with-agent to better reflect what it does
* Make a new with-keys that does the same thing as with-agent, except
  that it passes $keys to keychain so that those keys are actually
  unlocked
* Divide between using with-keys and with-agent more-or-less
  reasonably

13 years agoBetter sshroot script
Alex Dehnert [Fri, 25 Jun 2010 07:48:12 +0000 (03:48 -0400)]
Better sshroot script

14 years agoAdd get-emails and mail-merge scripts to Makefile
Alex Dehnert [Wed, 21 Apr 2010 16:18:02 +0000 (12:18 -0400)]
Add get-emails and mail-merge scripts to Makefile

14 years agoAdd get-emails and mail-merge scripts
Alex Dehnert [Wed, 21 Apr 2010 16:16:23 +0000 (12:16 -0400)]
Add get-emails and mail-merge scripts

* get-emails: search LDAP by last name, and write out all possible results
  with name and username to a CSV file for further fiddling
* mail-merge: given a CSV file and an email, merge the two

14 years agoAdd (non-functional) rt-merge script
Alex Dehnert [Wed, 21 Apr 2010 16:15:47 +0000 (12:15 -0400)]
Add (non-functional) rt-merge script

14 years agoAdd make-zcrypt-key script
Alex Dehnert [Wed, 21 Apr 2010 16:15:23 +0000 (12:15 -0400)]
Add make-zcrypt-key script

14 years agoAdd sshroot --- krbroot for ssh-agent
Alex Dehnert [Fri, 5 Mar 2010 00:34:55 +0000 (19:34 -0500)]
Add sshroot --- krbroot for ssh-agent

The goal here is to make it easy to have one set
of ssh keys that you use frequently and want to
be able to not expire and stuff, and have one
set that you use for root or otherwise sensitive
access.

This version has a bunch of issue --- prominently,
it doesn't try to unlock keys particularly --- but
does mostly work.

14 years agoAdded nelhage's (?) krbroot
Alex Dehnert [Thu, 4 Mar 2010 22:17:37 +0000 (17:17 -0500)]
Added nelhage's (?) krbroot

14 years agoupdate-officers should be executable
Alex Dehnert [Mon, 8 Feb 2010 05:17:29 +0000 (00:17 -0500)]
update-officers should be executable

14 years agoMore functional card-access script
Alex Dehnert [Mon, 8 Feb 2010 05:16:57 +0000 (00:16 -0500)]
More functional card-access script

14 years agoNew script to ease updating officer lists
Alex Dehnert [Mon, 8 Feb 2010 05:16:42 +0000 (00:16 -0500)]
New script to ease updating officer lists

14 years agoConvert username to lower automatically
Alex Dehnert [Wed, 20 Jan 2010 05:36:03 +0000 (00:36 -0500)]
Convert username to lower automatically

14 years agocheck-host: Also display the ~text for jweiss
Alex Dehnert [Mon, 21 Dec 2009 01:30:49 +0000 (20:30 -0500)]
check-host: Also display the ~text for jweiss

14 years agolist-of-lists-updater: don't try to add the l-o-l
Alex Dehnert [Fri, 18 Dec 2009 17:01:09 +0000 (12:01 -0500)]
list-of-lists-updater: don't try to add the l-o-l

14 years agoAdd check-host to facilitate scripts tickets
Alex Dehnert [Fri, 18 Dec 2009 17:00:45 +0000 (12:00 -0500)]
Add check-host to facilitate scripts tickets

14 years agolist-of-lists-updater: mostly: use egrep and gaus
Alex Dehnert [Fri, 18 Dec 2009 01:20:07 +0000 (20:20 -0500)]
list-of-lists-updater: mostly: use egrep and gaus

14 years agoAdd rt-resolve to Makefile
Alex Dehnert [Wed, 16 Dec 2009 20:18:06 +0000 (15:18 -0500)]
Add rt-resolve to Makefile

14 years agoAdd bores-me
Alex Dehnert [Wed, 16 Dec 2009 20:17:40 +0000 (15:17 -0500)]
Add bores-me

14 years agort-resolve script to mass-resolve tickets
Alex Dehnert [Tue, 1 Dec 2009 22:36:18 +0000 (17:36 -0500)]
rt-resolve script to mass-resolve tickets

14 years agoAdd #! line to card-access
Alex Dehnert [Sat, 28 Nov 2009 00:38:56 +0000 (19:38 -0500)]
Add #! line to card-access

14 years agoAdd rt-set to change status etc on RT tickets
Alex Dehnert [Sat, 28 Nov 2009 00:38:29 +0000 (19:38 -0500)]
Add rt-set to change status etc on RT tickets

14 years agoMakefile for the scripts
Alex Dehnert [Thu, 29 Oct 2009 15:26:58 +0000 (11:26 -0400)]
Makefile for the scripts

14 years agoInitial commit of various scripts
Alex Dehnert [Thu, 29 Oct 2009 15:08:26 +0000 (11:08 -0400)]
Initial commit of various scripts