Skip to content

Idle culler #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 785 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
785 commits
Select commit Hold shift + click to select a range
e66fd2e
Remove dependencies when removing PHP modules
quentinmit Jan 22, 2020
923f2bb
Add amd64_fedora30 as a sysname
quentinmit Jan 22, 2020
1d11244
php-libguestfs has also gotta go
quentinmit Jan 22, 2020
fb09582
We really don't want nfs-utils
quentinmit Jan 22, 2020
b1b2241
Disable rpcbind
quentinmit Jan 22, 2020
2170207
Ignore excludepkgs when removing packages
quentinmit Jan 22, 2020
09fd373
real-hosts: Remove more unnecessary lines from /etc/hosts
andersk Jan 22, 2020
95129c8
Prevent socket activation for rpcbind
quentinmit Jan 22, 2020
f82adf4
export-scripts-certs: Update for Python 3
andersk Jan 22, 2020
b37c309
real-httpd: Run export-script-certs
andersk Jan 22, 2020
cbe4522
scripts-base: Switch from kmod-openafs back to dkms-openafs again
andersk Jan 23, 2020
30db1b0
real-afs: Switch from kmod-openafs back to dkms-openafs
andersk Jan 23, 2020
0b308a4
dkms-openafs doesn’t need to be installonly
andersk Jan 23, 2020
d0809ec
Install kernel-devel so dkms can work
quentinmit Jan 23, 2020
a96bff6
Fetch updates at install time
quentinmit Jan 24, 2020
0a0454a
real-afs: Sever mysterious Before=local-fs.target on afs-000.mount
andersk Jan 24, 2020
3054b26
real-php: Whitelist PHP modules
andersk Jan 24, 2020
2486453
real-httpd: Give mod_vhost_ldap a TCP connection to LDAP
andersk Jan 24, 2020
4d1dd7c
real-spheroids: Add CGI::Fast
andersk Jan 24, 2020
5371c30
httpd-suexec-scripts.patch: Fix hunk header
andersk Jan 24, 2020
1a4c47d
real-php: Add extensions from php-pdo
andersk Jan 24, 2020
becc10c
real-sshd: Allow host-based authentication only from prod servers
andersk Jan 26, 2020
2066a39
Let openssh set SSH_GSSAPI_NAME on F30
Jan 26, 2020
49280f3
Who are you, anyway?
Jan 27, 2020
f5b015f
Update systemd unit path
Jan 27, 2020
ed39047
Here lies whoisd, beloved by family, cherished by friends.
quentinmit Jan 27, 2020
ae79611
Support local inventory information
quentinmit Jan 27, 2020
7222522
Fetch updates at install time
quentinmit Jan 28, 2020
bccd33f
Support haproxy installation on Fedora
quentinmit Jan 28, 2020
5294791
Credit
Jan 29, 2020
8aa608e
Install haproxy from Rawhide on F31
quentinmit Jan 29, 2020
eb4c253
Import tested bind config from scripts-test-proxy-3
Jan 29, 2020
b44836f
Ansibilize BIND from LDAP
quentinmit Jan 28, 2020
3fe0aa4
Initial implementation of Scripts-internal LDAP-backed BIND server/role
Jan 29, 2020
8045628
Create the HAProxy configuration.
miriam-rittenberg Jan 29, 2020
84a48eb
Fedora 31 doesn't have libselinux-python
quentinmit Jan 29, 2020
e2a575e
Fix network configuration for Fedora
quentinmit Jan 29, 2020
51ac946
Use postfix on RedHat distros
quentinmit Jan 29, 2020
c09624c
Move scripts-proxy BIND to port 5353
quentinmit Jan 29, 2020
624c9bc
Fix syntax error
quentinmit Jan 29, 2020
790f0c7
when is a property of the task, not the module
quentinmit Jan 29, 2020
59bc29f
Configure SELinux context for named
quentinmit Jan 30, 2020
ec6705e
Disable grub-boot-success on realservers
quentinmit Jan 30, 2020
f0b13cf
Notes for enabling client IP spoofing
quentinmit Jan 30, 2020
1d5eb51
Configure networking on realservers for proxy path
quentinmit Jan 31, 2020
2467a4a
Change php-blacklist.txt to blacklist.txt and uninstall some python
miriam-rittenberg Feb 1, 2020
9734e32
Fix iptables syntax error
quentinmit Feb 1, 2020
b97ae2b
Updating Postfix conf to forward messages to other server if current …
jkoppel Feb 1, 2020
3796751
Only bind the VIPs for the current codename
quentinmit Feb 1, 2020
1e05673
Adding transport-maps-ldap.cf to template list
jkoppel Feb 1, 2020
0db0158
Emit comments in iptables config
quentinmit Feb 1, 2020
bfb4ddc
Disable virtual_alias_maps for vhosts on another pool. Otherwise the …
quentinmit Feb 1, 2020
85e1d0d
Add iptables and ldirectord rules for sending traffic from
miriam-rittenberg Feb 1, 2020
4b3c96d
Add (commented-out) custom log to haproxy that includes pool IP
miriam-rittenberg Feb 1, 2020
5f3c4b7
sysctl files need to be named .conf
quentinmit Feb 1, 2020
c1d3cc4
Make other pools into relay domains
quentinmit Feb 1, 2020
647945c
cleanup checks virtual_alias_maps before both relay_domains and trans…
quentinmit Feb 1, 2020
2156153
We don't know why this no longer seems necessary
quentinmit Feb 1, 2020
36b5536
Add todo
quentinmit Feb 1, 2020
1057ded
Accept packets from local IPs that originate on the proxies
quentinmit Feb 1, 2020
983a599
Refactor systemd-networkd configuration to be more generic
quentinmit Feb 2, 2020
af39bff
Configure special networking on proxies, and switch to systemd-networkd
quentinmit Feb 2, 2020
548339a
PHP modules are now disabled by default
quentinmit Feb 3, 2020
c42fd0c
Port d_zroot.pl to rsyslogd configuration
quentinmit Feb 3, 2020
8442a0e
Install some real editors on the syslog servers
quentinmit Feb 3, 2020
5f5adf3
We were so close! Sort the k5login
quentinmit Feb 3, 2020
24b577d
Ignore PAM logs from systemd --user
quentinmit Feb 3, 2020
e3e27bd
Close ldirectord status sockets after 60s
quentinmit Feb 3, 2020
85dcc21
Addressed TODO
quentinmit Feb 4, 2020
94402b4
So many ways to spell 'connection closed'
quentinmit Feb 4, 2020
d3a0ad6
do-resolve is not threadsafe, so restrict haproxy to one thread
quentinmit Feb 4, 2020
11e400b
Load the open-vm-tools module on VMware
quentinmit Feb 5, 2020
aa7a5d7
Route mail for user@scripts.mit.edu based on user.scripts.mit.edu's pool
quentinmit Feb 5, 2020
95dde59
added 2 attributes & 1 object class to schema
Mushu0 Feb 5, 2020
a61e41b
Automatically restart haproxy on failure
quentinmit Feb 6, 2020
4a94236
Merge remote-tracking branch 'remotes/origin/master' into ansible-rea…
quentinmit Feb 7, 2020
5e19cd9
Make lvs send traffic to all three proxy servers
miriam-rittenberg Feb 7, 2020
94c06a8
Make HAProxy serve the scripts.mit.edu ip when it fails to look up the
miriam-rittenberg Feb 7, 2020
224357a
Increase max log length limit
quentinmit Feb 10, 2020
ff4219b
Install logwatch on realservers
quentinmit Feb 10, 2020
68d7571
logwatch lowercases config values unless they are enclosed in double …
quentinmit Feb 10, 2020
ce246c9
Update install docs
quentinmit Feb 11, 2020
a46352d
Merge remote-tracking branch 'remotes/origin/master' into ansible-rea…
quentinmit Feb 11, 2020
0578e6a
Add comment with hostname to ldirectord
miriam-rittenberg Feb 9, 2020
bccf4fd
Add TODO
quentinmit Feb 11, 2020
b847f2f
Check heartbeat with codename ANY
miriam-rittenberg Feb 11, 2020
940d78b
Configure prod proxy servers
quentinmit Feb 19, 2020
0ad097c
Proxy servers need to not ARP for vips
quentinmit Feb 19, 2020
78daf9a
Use the newest Python on each machine
quentinmit Feb 22, 2020
0aac03f
Provide an ansible-config-me binary on PATH to trigger an Ansible run
quentinmit Feb 22, 2020
2b8f2d7
Enable new freshclam service
quentinmit Feb 23, 2020
a38eb60
Update clamav-update only if it is too old
quentinmit Feb 24, 2020
968a44e
Add --force to ansible-config-me to force pull
quentinmit Feb 24, 2020
5be4d60
Rely on handlers to start systemd-networkd
quentinmit Feb 24, 2020
55d6140
Disable ARP for lo aliases in systemd-networkd
quentinmit Feb 24, 2020
6e5140a
Update kickstart files to use ansible-config-me, and rename kickstart…
quentinmit Feb 24, 2020
219dd68
Configure an e-mail destination for logwatch
quentinmit Feb 24, 2020
467a0e4
Disable host cache in nscd so shackle can see real queries
quentinmit Feb 24, 2020
ed6295b
Update install instructions
miriam-rittenberg Feb 19, 2020
c1177fc
Make the proxy servers also automatically download (but not install)
miriam-rittenberg Feb 24, 2020
4653420
Use production proxies for scripts-test traffic
miriam-rittenberg Feb 25, 2020
9394452
Permute the LDAP server list so proxy load is split evenly amongst se…
quentinmit Feb 25, 2020
7ad1070
Remove completed TODOs
miriam-rittenberg Feb 25, 2020
745762c
Configure haproxy logging to a separate file
quentinmit Feb 25, 2020
122e122
Configure logrotate on the proxies
miriam-rittenberg Feb 25, 2020
3e8fe44
Configure logrotate to remove haproxy logs
quentinmit Feb 25, 2020
e7eae8a
Depend on syslog-client to get the 'restart syslog' handler
quentinmit Feb 25, 2020
776aa4d
Reorder named-scripts-proxy
quentinmit Feb 25, 2020
56b7031
Remove timestamps from ansible-config-me output
quentinmit Feb 25, 2020
116e7c1
Detect correct Nagios plugin directory
quentinmit Feb 25, 2020
fb6b068
Switch to Python 3 hatop
quentinmit Feb 25, 2020
5c9f51d
Add munin plugin for haproxy
quentinmit Feb 25, 2020
ad5f1ef
Update submodules after pull
quentinmit Feb 25, 2020
c3688ae
Improve haproxyng graphs
quentinmit Feb 25, 2020
819e439
Enable postfix on proxies
miriam-rittenberg Feb 26, 2020
2e4eaa7
Merge remote-tracking branch 'remotes/origin/master' into ansible-rea…
quentinmit Feb 26, 2020
56369bd
Enable systemd-networkd
quentinmit Feb 26, 2020
d19d234
Don't hardcode better-mousetrap name and ip
miriam-rittenberg Feb 26, 2020
dee72e1
Make sure logrotate is installed
miriam-rittenberg Feb 27, 2020
0428d63
Install mailx
miriam-rittenberg Feb 27, 2020
8eeafd8
Replace finger daemon and http realserver list scripts with python
Feb 27, 2020
8efb11a
Remove jkoppel's server
celskeggs Feb 28, 2020
9d16a56
Use gnlpy.ipvs module to fetch LVS information
quentinmit Feb 28, 2020
7d739ff
Use a stable order for ldirectord config
quentinmit Feb 28, 2020
9491084
Install Python packages for doing SAML
dehnert Feb 29, 2020
cdce1d7
Install the mysql client
dehnert Feb 29, 2020
8b78430
Installing mailx should check for RedHat, not postfix
miriam-rittenberg Mar 3, 2020
c741c1e
Move director munin-config into a separate role
quentinmit Mar 4, 2020
4e84e87
Generate Munin graphs for the new LVS pools
quentinmit Mar 4, 2020
df2278c
Explicitly use -m ip. haproxy's docs are wrong and it's actually requ…
quentinmit Mar 4, 2020
eb72282
Set DSCP bits on outgoing traffic from proxies
quentinmit Mar 4, 2020
975da45
Clear external DSCP bits for non-version pools, to prevent trouble fo…
quentinmit Mar 4, 2020
00b4368
Add some TCP and conntrack tuning sysctl values for the proxies
Mar 4, 2020
e61d7ad
Remove TODOne
quentinmit Mar 4, 2020
0eeff61
Start pointing primary traffic explicitly at Fedora 20
quentinmit Mar 4, 2020
6e9d89c
Deploy the proxies in production
quentinmit Mar 4, 2020
74e728b
Increase the available port range on the proxies
Mar 4, 2020
6027f87
Merge remote-tracking branch 'remotes/origin/master' into ansible-rea…
quentinmit Mar 4, 2020
1076085
Disable lingering on connections
quentinmit Mar 4, 2020
93edf37
Avoid sending haproxy logs to remote syslog servers
quentinmit Mar 4, 2020
56f2a3a
Enable tcp_tw_reuse
quentinmit Mar 4, 2020
fdd75f6
Disable conntrack on proxies
quentinmit Mar 4, 2020
5ae3e16
Change usesrc client to usesrc clientip to see if that fixes the no f…
miriam-rittenberg Mar 8, 2020
820afcf
Another new error message variation from sshd
quentinmit Mar 8, 2020
9487962
Add python3-theano, which is already on 3 of the servers
miriam-rittenberg Mar 10, 2020
1703962
Merge remote-tracking branch 'remotes/origin/master' into ansible-rea…
quentinmit Mar 10, 2020
ca40968
Install libnsl for compatibility with old binaries
quentinmit Mar 10, 2020
516343d
Lint and review comments
quentinmit Mar 22, 2020
f030918
Merge remote-tracking branch 'remotes/origin/master' into ansible-rea…
quentinmit Mar 23, 2020
7c29d23
Configure mbash forwarding
quentinmit Mar 23, 2020
0a4d370
Update mbash for Fedora 30
quentinmit Mar 23, 2020
43492f3
Merge remote-tracking branch 'remotes/origin/master' into HEAD
quentinmit Mar 26, 2020
fe9c2d3
Handle scripts-test.mit.edu as an F30-only pool, so the proxies don't…
quentinmit Mar 26, 2020
9f741b6
Merge remote-tracking branch 'remotes/origin/master' into ansible-rea…
quentinmit Mar 26, 2020
7f6d227
Merge remote-tracking branch 'remotes/origin/master' into ansible-rea…
quentinmit Mar 28, 2020
4d27de6
Suppress spew from postfix DNS resolutions
quentinmit Mar 28, 2020
0f3dcaa
Merge remote-tracking branch 'remotes/origin/master' into ansible-rea…
quentinmit Apr 4, 2020
bd51c97
Merge remote-tracking branch 'remotes/origin/master' into ansible-rea…
quentinmit May 5, 2020
7399e78
Merge branch 'master' into ansible-realserver
miriam-rittenberg Jun 2, 2020
62d815d
Bare-bones Ansible configuration
quentinmit Sep 18, 2020
8da877c
Update OpenAFS patch for 1.8.4-pre1
quentinmit Sep 19, 2020
c52ad44
AFS installation for Jupyter
quentinmit Sep 19, 2020
115349a
Install JupyterHub
quentinmit Oct 2, 2020
ff12933
Install virtualenv
quentinmit Oct 2, 2020
d62479d
More dependencies
quentinmit Oct 2, 2020
46c0fa3
More dependencies
quentinmit Oct 2, 2020
94df72e
More dependencies
quentinmit Oct 2, 2020
485b23b
Even more dependencies
quentinmit Oct 3, 2020
9684c86
Configuration that actually does something
quentinmit Oct 3, 2020
a97be1d
Get Athena tokens
quentinmit Oct 3, 2020
2447a38
Update AFS patch for OpenAFS 1.8.4
quentinmit Oct 3, 2020
9d424c6
Install basic user packages
quentinmit Oct 3, 2020
39e5aaa
Run Jupyter as a service and replace login form with a login button
quentinmit Oct 16, 2020
c5c11a7
Button to create ~/Jupyter (not wired up to login flow)
quentinmit Oct 17, 2020
7cff9c7
Support Webathena for login and not just registration
quentinmit Oct 23, 2020
4dcb374
Initial homepage template
kyeb Oct 23, 2020
20bcd7a
Install gssapi module
quentinmit Oct 23, 2020
b16279e
add home template initial
Oct 23, 2020
ef71471
Rename homepage template
quentinmit Oct 23, 2020
ac0e76d
get_argument doesn't default to None
quentinmit Oct 23, 2020
e7efcb7
json_encode isn't a filter?
quentinmit Oct 23, 2020
2dcaeee
Provide json_encode to templates
quentinmit Oct 23, 2020
09ed2db
Add sjcl JavaScript
quentinmit Oct 23, 2020
285ad91
JavaScript typo
quentinmit Oct 23, 2020
65dcc12
Service crypto javascript locally
quentinmit Oct 23, 2020
1332c47
Fix class name
quentinmit Oct 23, 2020
982ef51
Fix static file serving?
quentinmit Oct 23, 2020
8533c7b
Encode GSS token (even though it's base64)
quentinmit Oct 23, 2020
6e2be72
base64-decode GSS tokens
quentinmit Oct 23, 2020
83f64bb
Use Webathena's SJCL because upstream's is subtly broken
quentinmit Oct 24, 2020
390a402
Make system and user packages available in Python
quentinmit Oct 24, 2020
d682f43
Add oauthenticator
quentinmit Oct 24, 2020
0ecd063
Install most of the base Anaconda distribution
quentinmit Oct 24, 2020
9397d47
Install some JupyterLab extensions
quentinmit Oct 24, 2020
781922d
Install more JupyterLab extensions
quentinmit Oct 24, 2020
e621b6a
Install LaTeX
quentinmit Oct 24, 2020
2c2f438
Switch to JupyterLab by default
quentinmit Oct 24, 2020
44558f7
Install JavaScript kernel
quentinmit Oct 24, 2020
99a5791
Install TypeScript kernel
quentinmit Oct 26, 2020
a08ac12
Add registration page with instructions for creating an account
quentinmit Oct 26, 2020
5b5b552
Attempt to redirect users to homepage if not registered
quentinmit Oct 26, 2020
6f88a4b
Show registration info at hub home
quentinmit Oct 26, 2020
a719e3c
Move homepage to /login so logout works right
quentinmit Oct 26, 2020
f461ad3
Tweak formatting of login page
quentinmit Oct 26, 2020
eb52af3
Install an Octave kernel
quentinmit Oct 26, 2020
37c9480
Initial work to expose users to the system
quentinmit Oct 26, 2020
9a19a6e
Monkey-patch varlink.scanner
quentinmit Oct 26, 2020
90d5322
Run userdb server
quentinmit Oct 27, 2020
487ca3a
Upgrade Python packages
quentinmit Oct 27, 2020
4b1642c
Fix UserDB server
quentinmit Oct 27, 2020
1960b29
Fix typo
quentinmit Oct 27, 2020
427ea2b
Spawn servers using systemd
quentinmit Oct 27, 2020
703bd17
Install Julia kernel
quentinmit Oct 27, 2020
a1180ed
Fix Julia depot path
quentinmit Oct 27, 2020
ee78b7e
Track per-user CPU usage
quentinmit Oct 27, 2020
54f861e
Check if keeping the proxy running removes the warning from JupyterLa…
quentinmit Oct 27, 2020
4bccc4b
Install language servers
quentinmit Oct 28, 2020
d4cc3c7
Put cache files on local disk
quentinmit Oct 28, 2020
c84c040
Install IJulia in a separate environment so users can use homedir env…
quentinmit Oct 30, 2020
f3ac7b3
Install PARI/GP kernel
quentinmit Oct 30, 2020
ff00d6d
Set per-user memory throttling and limits
quentinmit Oct 30, 2020
5c3282c
Require AFS tokens to start JupyterHub
quentinmit Oct 30, 2020
f67da4f
Handle missing homedirs
quentinmit Oct 30, 2020
83672b4
start adding R kernel
kyeb Oct 30, 2020
7a84772
fix indentation
kyeb Oct 30, 2020
7101f0e
add R kernelspec installation
kyeb Oct 31, 2020
391e03d
add R kernel dependencies
kyeb Oct 31, 2020
2b53428
give up on ubuntu r-cran-irkernel package
kyeb Oct 31, 2020
e9bfd8f
Configure Apache with Ansible
quentinmit Oct 31, 2020
dc9d6c9
Install Apache configuration
quentinmit Oct 31, 2020
2bc9a99
hopefully fix PATH bug
kyeb Oct 31, 2020
a6b9f25
Preinstall some R libraries
quentinmit Oct 31, 2020
b1d5068
Add Apache module
quentinmit Oct 31, 2020
043911e
Add missing handler
quentinmit Oct 31, 2020
c1069e7
Suppress spurious changed statuses
quentinmit Oct 31, 2020
1d31353
Fix handling of no users
quentinmit Nov 4, 2020
a9161ba
Install renew with an execute bit
quentinmit Nov 4, 2020
eb6e694
Disable auto upgrades
quentinmit Nov 4, 2020
2693277
Add missing client CA file
quentinmit Nov 4, 2020
ea909db
More Apache modules
quentinmit Nov 4, 2020
10272b1
remove touchstone button for now
kyeb Nov 6, 2020
1fed8ad
Update landing page text
kyeb Nov 6, 2020
900f054
Attempt subdomains?
kyeb Nov 6, 2020
c441c2e
Mention AFS on homepage
kyeb Nov 6, 2020
034d189
Enable subdomain-per-user for security
quentinmit Nov 7, 2020
34a14af
Patch to certbot to support CNAMEd challenges
quentinmit Nov 7, 2020
c1a91fc
Enable SSL for internal connections
quentinmit Nov 7, 2020
f5bc356
formatting on homepage
kyeb Nov 13, 2020
eb2656d
small cleanup
kyeb Nov 13, 2020
8765e20
Add idle culler
kyeb Nov 13, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
14 changes: 13 additions & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,19 @@
url = https://github.com/jtyr/ansible-udev_rename_netiface.git
[submodule "ansible/roles/network_interface"]
path = ansible/roles/network_interface
url = https://github.com/MartinVerges/ansible.network_interface.git
url = https://github.com/mit-scripts/ansible.network_interface.git
[submodule "ansible/roles/pacemaker-corosync"]
path = ansible/roles/pacemaker-corosync
url = https://github.com/mit-scripts/ansible-pacemaker-corosync.git
[submodule "ansible/roles/proxy-munin-node/files/monitoring-munin-haproxy"]
path = ansible/roles/proxy-munin-node/files/monitoring-munin-haproxy
url = https://github.com/mit-scripts/monitoring-munin-haproxy.git
[submodule "ansible/roles/ldirectord-status/files/ldirectord-status/gnlpy"]
path = ansible/roles/ldirectord-status/files/ldirectord-status/gnlpy
url = https://github.com/facebook/gnlpy.git
[submodule "ansible/roles/jupyter-jupyter/files/webathena"]
path = ansible/roles/jupyter-jupyter/files/webathena
url = https://github.com/davidben/webathena
[submodule "ansible/collections/community.general"]
path = ansible/collections/community.general
url = https://github.com/ansible-collections/community.general.git
1 change: 1 addition & 0 deletions ansible/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
*.retry
*.pyc
8 changes: 7 additions & 1 deletion ansible/ansible.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
[defaults]
inventory = inventory.yml
inventory = inventory
remote_user = root
force_handlers = True
callback_whitelist = log_plays
stdout_callback = yaml
conditional_bare_variables = False
interpreter_python = auto
collections_paths = ./collections

[ssh_connection]
pipelining = True
1 change: 1 addition & 0 deletions ansible/collections/community.general
Submodule community.general added at 909a98
4 changes: 4 additions & 0 deletions ansible/files/conntrack
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[fw_conntrack]
command /bin/false
[fw_forwarded_local]
command /bin/false
23 changes: 23 additions & 0 deletions ansible/files/dotfiles/.bashrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# .bashrc

# User specific aliases and functions

alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'

DEFAULTVISUAL=emacs
if [ "$SSH_GSSAPI_NAME" = "adehnert/root@ATHENA.MIT.EDU" ]; then
DEFAULTVISUAL=vim
fi
export VISUAL=${VISUAL:-$DEFAULTVISUAL}

# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi

alias vi=vim
alias view='vim -R'

logger -p authpriv.warning -t bash -- "Root bash shell for ${SSH_GSSAPI_NAME:-unknown} from ${SSH_CLIENT:-local}"
24 changes: 24 additions & 0 deletions ansible/files/dotfiles/.emacs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
;; .emacs

(custom-set-variables
;; uncomment to always end a file with a newline
;'(require-final-newline t)
;; uncomment to disable loading of "default.el" at startup
;'(inhibit-default-init t)
;; default to unified diffs
'(diff-switches "-u"))

;;; uncomment for CJK utf-8 support for non-Asian users
;; (require 'un-define)

; show column numbers
(setq column-number-mode t)

; use spaces, not tabs
(setq-default indent-tabs-mode nil)
(setq-default tab-width 4)
(setq indent-line-function 'insert-tab)

; recognize python executables
(add-to-list 'interpreter-mode-alist
'("python2" . python-mode))
11 changes: 11 additions & 0 deletions ansible/files/dotfiles/.ldapvirc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
profile default
host ldap://scripts-ldap.mit.edu/
base dc=scripts,dc=mit,dc=edu
# kinit -k -t /etc/signup.keytab daemon/scripts-signup.mit.edu
bind sasl
sasl-mech GSSAPI

profile local
host ldapi://%2fvar%2frun%2fslapd-scripts.socket/
bind sasl
sasl-mech EXTERNAL
6 changes: 6 additions & 0 deletions ansible/files/dotfiles/.screenrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
startup_message off
msgwait 1
hardstatus string "[screen %n*%f %t] %h"
caption always "%{= bW}%H %{+ c}%-Lw%50>%?%F%{+b W}%:%{+ w}%?%n*%f %t%{-}%+Lw%<%-010=%{+ W}"
altscreen on
defbce on
3 changes: 3 additions & 0 deletions ansible/files/dotfiles/.vimrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
set background=dark
set nocompatible
syntax on
7 changes: 0 additions & 7 deletions ansible/files/nrpe_local.cfg

This file was deleted.

120 changes: 106 additions & 14 deletions ansible/files/scripts-syslog.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,24 @@
if \
ruleset(name="zpublic") {
|/run/zephyr-syslog-public;RSYSLOG_SyslogProtocol23Format
stop
}
ruleset(name="zprivate") {
|/run/zephyr-syslog-private;RSYSLOG_SyslogProtocol23Format
stop
}

# Putting zroot in a queue means we can use the "stop" operator
# without affecting file output.
# See https://www.rsyslog.com/doc/v8-stable/rainerscript/rainerscript_call.html
ruleset(name="zroot" queue.type="Direct") {
# https://www.rsyslog.com/doc/v8-stable/rainerscript/control_structures.html
# https://rainer.gerhards.net/2012/10/how-to-use-rsyslogs-ruleset-and-call-statements.html
# https://www.rsyslog.com/doc/v8-stable/configuration/filters.html

# $msg always has a leading space: https://www.rsyslog.com/log-normalization-and-the-leading-space/

# First, audit-related messages go to scripts-auto
if \
($programname == 'sshd' and ( \
$msg startswith ' Authorized to root, ' \
or \
Expand All @@ -8,21 +28,93 @@ if \
or \
$msg == ' pam_unix(sshd:session): session closed for user root' \
)) \
then |/run/zephyr-syslog-public;RSYSLOG_SyslogProtocol23Format
then {
call zpublic
}
# TODO: Look up ssh keys and annotate with whose key it is
# Publicly log all root sessions, except cron or sudo
if (re_match($msg, '^ pam_unix\\([^:]+:session\\): session \\S+ for user root')) then {
# Ignore all PAM session messages from cron
if ($programname == 'CRON') then stop
# sudo logs invocations itself with more information; ignore the
# PAM messages it generates.
if ($programname == 'sudo') then stop
# systemd --user can arbitrarily start PAM sessions; the
# underlying login session will trigger its own PAM logs so no
# need to report it twice.
if ($programname == 'systemd') then stop
call zpublic
}
if (re_match($msg, 'Root (\\S+) shell')) then call zpublic
if ($msg startswith ' Out of memory:') then call zpublic
if ($programname == 'admof') then call zpublic
# TODO: Spew when root runs su or sudo?

# Next, ignore known-safe chatty messages (list taken from the old
# d_zroot.pl, with some F30 rewordings added)
if (re_match($msg, '^ pam_unix\\([^:]+:session\\): session')) then stop
if ($programname == 'sshd') then {
if ($msg startswith ' Authorized to ') then stop
if ($msg startswith ' Accepted ') then stop
if ($msg startswith ' Connection closed') then stop
if ($msg startswith ' Closing connection to') then stop
if ($msg startswith ' Starting session: ') then stop
if ($msg startswith ' Close session: ') then stop
if (re_match($msg, '^ Connection from \\S+ port \\S+')) then stop
if ($msg startswith ' Invalid user') then stop
if ($msg startswith ' Disconnecting invalid user') then stop
if ($msg startswith ' input_userauth_request: invalid user') then stop
if ($msg startswith ' userauth_hostbased mismatch: ') then stop
if ($msg startswith ' Received disconnect from ') then stop
if ($msg startswith ' Disconnected from ') then stop
if ($msg startswith ' Postponed keyboard-interactive') then stop
if ($msg startswith ' Postponed gssapi-with-mic for ') then stop
if ($msg startswith ' Failed keyboard-interactive/pam') then stop
if ($msg startswith ' fatal: Read from socket failed: Connection reset by peer') then stop
if ($msg startswith ' error: kex_exchange_identification: read: Connection reset by peer') then stop
if ($msg startswith ' error: kex_exchange_identification: read: Connection closed by remote host') then stop
if ($msg startswith ' error: kex_exchange_identification: Connection closed by remote host') then stop
if ($msg startswith ' Connection reset by ') then stop
if ($msg startswith ' reverse mapping checking getaddrinfo') then stop
if ($msg startswith ' pam_succeed_if(sshd:auth):') then stop
if ($msg startswith ' error: PAM: Authentication failure') then stop
if ($msg startswith ' pam_unix(sshd:auth): authentication failure') then stop
if ($msg startswith ' pam_unix(sshd:auth): check pass; user unknown') then stop
if (re_match($msg, '^ Address \\S+ maps to \\S+, but this does not map back to the address')) then stop
if (re_match($msg, '^ Nasty PTR record .* is set up for .*, ignoring')) then stop
if ($msg startswith ' User child is on pid ') then stop
if (re_match($msg, '^ Accepted \\S+ public key \\S+ from \\S+$')) then stop
if ($msg startswith ' error: maximum authentication attempts exceeded for ') then stop
}
if (re_match($msg, '^ Transferred: sent \\d+, received \\d+ bytes$')) then stop
if ($msg == ' Setting tty modes failed: Invalid argument') then stop
if ($programname == 'sudo') then {
if (re_match($msg, '^ *nrpe .* COMMAND=/etc/nagios/check_ldap_mmr.real$')) then stop
if (re_match($msg, '^ *scripts : .*; USER=root ; COMMAND=/etc/httpd/export-scripts-certs$')) then stop
if (re_match($msg, '^ *pony : .*; USER=root ; COMMAND=/etc/pki/tls/gencsr-pony ')) then stop
if (re_match($msg, '^ *root : TTY=')) then stop
}
if ($msg startswith ' Set /proc/self/oom_adj to ') then stop
if ($msg startswith ' Set /proc/self/oom_score_adj to ') then stop
if ($msg == ' selinux sandbox not useful [preauth]') then stop
if ($programname == 'postfix') then {
if (re_match($msg, '^ warning: hostname .* does not resolve to address .*:')) then stop
}

# Everything else goes to scripts-spew
call zprivate
}

# Send errors, authpriv, and OOM events to the zroot queue
if \
$syslogseverity <= '4' \
and \
not ($programname == 'sshd' and ( \
$msg == ' pam_unix(sshd:auth): check pass; user unknown' \
or \
$msg startswith ' PAM service(sshd) ignoring max retries; ' \
or \
$msg startswith ' error: maximum authentication attempts exceeded for ' \
or \
$msg startswith ' error: Received disconnect from ' \
)) \
then |/run/zephyr-syslog-private;RSYSLOG_SyslogProtocol23Format
$syslogseverity <= '4' \
or \
$syslogfacility-text == 'authpriv' \
or \
($syslogfacility-text == 'kern' and ($msg contains 'Out of memory:' or $msg contains 'Killed process')) \
then {
call zroot
}

$ModLoad imrelp
$InputRELPServerRun 2514
16 changes: 8 additions & 8 deletions ansible/files/zephyr-syslog
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,14 @@ facilities = [
]

severity_symbols = [
'@b(@color(magenta))',
'@b(@color(magenta))',
'@b(@color(magenta))',
'@b(@color(red))',
'@b(@color(yellow))',
'@b(@color(blue))',
'@b(@color(cyan))',
'@b(@color(green))'
'@b(@color(magenta)EMERG)',
'@b(@color(magenta)ALERT)',
'@b(@color(magenta)CRIT)',
'@b(@color(red)ERR)',
'@b(@color(yellow)WARN)',
'@b(@color(blue)NOTICE)',
'@b(@color(cyan)INFO)',
'@b(@color(green)DEBUG)'
]

syslog_re = re.compile(r'''^<(?P<pri>\d+)>(?P<version>1) (?P<timestamp>\S*) (?P<hostname>\S*) (?P<app_name>\S*) (?P<procid>\S*) (?P<msgid>\S*) (?P<sd>(?:\[[^]= "]+(?: [^]= "]+="(?:[^]"\\]|\\.)*")*\])*|-) (?P<msg>.*)$''')
Expand Down
13 changes: 13 additions & 0 deletions ansible/filter_plugins/permute.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Make coding more python3-ish
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type

def permute(value, shift):
shift %= len(value)
return value[shift:] + value[:shift]

class FilterModule(object):
def filters(self):
return {
'permute': permute,
}
88 changes: 88 additions & 0 deletions ansible/filter_plugins/subnetmath.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# Make coding more python3-ish
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type

import netaddr
from itertools import groupby

def _round_prefixes(value):
"""Takes a list of subnets, and produces a new list of subnets that are /8, /16, or /24."""
_ret = []
for net in netaddr.cidr_merge(netaddr.IPNetwork(v) for v in value):
newprefix = ((net.prefixlen+7)//8)*8
_ret.extend(net.subnet(newprefix))
return _ret

def inaddr_zones(value):
"""inaddr_zones converts a list of IP subnets into a list of in-addr.arpa zone names that cover the subents."""
nets = _round_prefixes(value)
_ret = []
for net in nets:
val = "in-addr.arpa"
addr = int(net.network)
for i in range(0, net.prefixlen, 8):
val = str((addr >> (24-i)) & 0xff) + '.' + val
_ret.append(val)
return _ret

def ipsubnets_regex(value):
"""ipsubnets_regex converts a list of IP subnets into a regex that matches IP addresses on those subnets."""
nets = _round_prefixes(value)
prefixes = [net.network.ipv4().format().split('.')[:net.prefixlen//8] for net in nets]
return '^' + _prefixes_to_regex(prefixes) + r'\.'

def _prefixes_to_regex(prefixes):
"""
Convert a list of tuples containing IP prefixes into a regex that matches them.

Args:
prefixes: list of prefixes like [(10,), (18, 1), (18, 2)]

Returns:
regex like "(10|18\.[1-2])"
"""
out = []
if max(len(x) for x in prefixes) == 1:
# Last component, try to use character classes
return _numbers_regex(x[0] for x in prefixes)
for octet, g in groupby(prefixes, lambda x: x[0]):
sub = [x[1:] for x in g if len(x) > 1]
match = str(octet)
if sub:
match += r'\.' + _prefixes_to_regex(sub)
out.append(match)
return '(' + '|'.join(out) + ')'

def _numbers_regex(numbers):
"""Find a simplified regex for matching a list of numbers"""
def key(x): return (x[0], len(x[1]), x[1][:-1])
numbers = sorted((('', str(x)) for x in numbers), key=key)
simplified = False
while not simplified:
simplified = True
out = []
for (suffix, _, prefix), g in groupby(numbers, key):
g = list(g)
if len(g) == 1 and not g[0][1]:
out.append(g[0])
continue
simplified = False
digits = sorted(x[1][-1] for x in g)
if len(digits) == 1:
match = digits[0]
elif len(digits) == 10:
match = r'\d'
else:
match = '['+''.join(digits)+']'
out.append((match+suffix, prefix))
numbers = out
if len(numbers) == 1:
return numbers[0][0]
return '('+ '|'.join(x[0] for x in numbers) + ')'

class FilterModule(object):
def filters(self):
return {
'inaddr_zones': inaddr_zones,
'ipsubnets_regex': ipsubnets_regex,
}
Loading