diff --git a/atlantislaptop/active b/atlantislaptop/active new file mode 100644 index 0000000..24dcd35 --- /dev/null +++ b/atlantislaptop/active @@ -0,0 +1,19 @@ +wpa +wpa-peap +wpa-peap-wo-domain +wpa-psk +wpa-psk-hex +wpa2-leap +wpa2-peap +wpa2-peap-wo-domain +wep-hex +wep-passphrase +wep-shared +leap +ttls +eap +peap +peap-tkip +eap-tls +psu +edurom diff --git a/atlantislaptop/auth.txt.gpg b/atlantislaptop/auth.txt.gpg new file mode 100755 index 0000000..1bd7cc9 --- /dev/null +++ b/atlantislaptop/auth.txt.gpg @@ -0,0 +1 @@ + )vgneS&_}$TfE&[qbN*2Six[gcR7HHFd');<* J 6YZV>̋Z \ No newline at end of file diff --git a/atlantislaptop/copyfiles.sh b/atlantislaptop/copyfiles.sh new file mode 100644 index 0000000..9ec77cd --- /dev/null +++ b/atlantislaptop/copyfiles.sh @@ -0,0 +1,15 @@ +CONF_DIR=~/.config/atlantislaptop + +#system config +cp $CONF_DIR/openvpn /etc/default/ +cp $CONF_DIR/ssh_config /etc/ssh/ +cp $CONF_DIR/sudoers /etc/ +cp $CONF_DIR/active /etc/wicd/encryption/templates/ +cp $CONF_DIR/edurom /etc/wicd/encryption/templates/ + +#scripts in path +cp $CONF_DIR/openvpn_cip.sh /usr/bin/ +cp $CONF_DIR/stopvpn.sh /usr/bin/ + +gpg --output /etc/openvpn/auth.txt -d auth.txt.gpg +chmod 500 /etc/openvpn/auth.txt diff --git a/atlantislaptop/edurom b/atlantislaptop/edurom new file mode 100644 index 0000000..7cc9885 --- /dev/null +++ b/atlantislaptop/edurom @@ -0,0 +1,20 @@ +name = eduroam +author = wlan-support@rrze.fau.de +version = 1 +require identity *Identity anonymous_identity *Anonymous_identity password *Password ca_cert *Path_to_CA_Cert +----- +ctrl_interface=/var/run/wpa_supplicant +network={ + ssid="$_ESSID" + scan_ssid=$_SCAN + key_mgmt=WPA-EAP + pairwise=CCMP TKIP + group=CCMP + eap=TTLS + identity="$_IDENTITY" + anonymous_identity="$_ANONYMOUS_IDENTITY" + password="$_PASSWORD" + ca_cert="$_CA_CERT" + phase1="peaplabel=0" + phase2="auth=PAP" +} diff --git a/atlantislaptop/openvpn b/atlantislaptop/openvpn new file mode 100644 index 0000000..058107d --- /dev/null +++ b/atlantislaptop/openvpn @@ -0,0 +1,36 @@ +# This is the configuration file for /etc/init.d/openvpn + +# +# Start only these VPNs automatically via init script. +# Allowed values are "all", "none" or space separated list of +# names of the VPNs. If empty, "all" is assumed. +# The VPN name refers to the VPN configutation file name. +# i.e. "home" would be /etc/openvpn/home.conf +# +# If you're running systemd, changing this variable will +# require running "systemctl daemon-reload" followed by +# a restart of the openvpn service (if you removed entries +# you may have to stop those manually) +# +#AUTOSTART="all" +AUTOSTART="none" +#AUTOSTART="home office" +# +# WARNING: If you're running systemd the rest of the +# options in this file are ignored. +# +# Refresh interval (in seconds) of default status files +# located in /var/run/openvpn.$NAME.status +# Defaults to 10, 0 disables status file generation +# +#STATUSREFRESH=10 +#STATUSREFRESH=0 +# Optional arguments to openvpn's command line +OPTARGS="" +# +# If you need openvpn running after sendsigs, i.e. +# to let umountnfs work over the vpn, set OMIT_SENDSIGS +# to 1 and include umountnfs as Required-Stop: in openvpn's +# init.d script (remember to run insserv after that) +# +OMIT_SENDSIGS=0 diff --git a/atlantislaptop/openvpn_cip.sh b/atlantislaptop/openvpn_cip.sh new file mode 100755 index 0000000..c07de06 --- /dev/null +++ b/atlantislaptop/openvpn_cip.sh @@ -0,0 +1 @@ +openvpn --config /etc/openvpn/openfaupn.conf --auth-user-pass /etc/openvpn/auth.txt diff --git a/atlantislaptop/ssh_config b/atlantislaptop/ssh_config new file mode 100644 index 0000000..12ee7d6 --- /dev/null +++ b/atlantislaptop/ssh_config @@ -0,0 +1,54 @@ + +# This is the ssh client system-wide configuration file. See +# ssh_config(5) for more information. This file provides defaults for +# users, and the values can be changed in per-user configuration files +# or on the command line. + +# Configuration data is parsed as follows: +# 1. command line options +# 2. user-specific file +# 3. system-wide file +# Any configuration value is only changed the first time it is set. +# Thus, host-specific definitions should be at the beginning of the +# configuration file, and defaults at the end. + +# Site-wide defaults for some commonly used options. For a comprehensive +# list of available options, their meanings and defaults, please see the +# ssh_config(5) man page. + +Host * +# ForwardAgent no +# ForwardX11 no +# ForwardX11Trusted yes +# RhostsRSAAuthentication no +# RSAAuthentication yes +# PasswordAuthentication yes +# HostbasedAuthentication no +# GSSAPIAuthentication no +# GSSAPIDelegateCredentials no +# GSSAPIKeyExchange no +# GSSAPITrustDNS no +# BatchMode no +# CheckHostIP yes +# AddressFamily any +# ConnectTimeout 0 +# StrictHostKeyChecking ask + IdentityFile ~/.ssh/identity +# IdentityFile ~/.ssh/id_rsa +# IdentityFile ~/.ssh/id_dsa +# Port 22 + Protocol 2 +# Cipher 3des +# Ciphers aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc +# MACs hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160 +# EscapeChar ~ +# Tunnel no +# TunnelDevice any:any +# PermitLocalCommand no +# VisualHostKey no +# ProxyCommand ssh -q -W %h:%p gateway.example.com +# RekeyLimit 1G 1h + SendEnv LANG LC_* + HashKnownHosts yes + GSSAPIAuthentication yes + GSSAPIDelegateCredentials no diff --git a/atlantislaptop/stopvpn.sh b/atlantislaptop/stopvpn.sh new file mode 100755 index 0000000..8022a50 --- /dev/null +++ b/atlantislaptop/stopvpn.sh @@ -0,0 +1 @@ +pkill openvpn diff --git a/atlantislaptop/sudoers b/atlantislaptop/sudoers new file mode 100755 index 0000000..ece9208 --- /dev/null +++ b/atlantislaptop/sudoers @@ -0,0 +1,31 @@ +# +# This file MUST be edited with the 'visudo' command as root. +# +# Please consider adding local content in /etc/sudoers.d/ instead of +# directly modifying this file. +# +# See the man page for details on how to write a sudoers file. +# +Defaults env_reset +Defaults mail_badpass +Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" + +# Host alias specification + +# User alias specification + +# Cmnd alias specification + +# User privilege specification +root ALL=(ALL:ALL) ALL + +# Allow members of group sudo to execute any command +%sudo ALL=(ALL:ALL) ALL +#ik15ydit ALL=(ALL) NOPASSWD: /sys/class/backlight/intel_backlight/brightness +ik15ydit ALL=(ALL) NOPASSWD: /bin/mount +ik15ydit ALL=(ALL) NOPASSWD: /bin/umount +ik15ydit ALL=(ALL) NOPASSWD: /usr/bin/openvpn_cip.sh +ik15ydit ALL=(ALL) NOPASSWD: /usr/bin/stopvpn.sh +# See sudoers(5) for more information on "#include" directives: + +#includedir /etc/sudoers.d diff --git a/herbstluftwm/autostart b/herbstluftwm/autostart index 21cb842..cd6b309 100755 --- a/herbstluftwm/autostart +++ b/herbstluftwm/autostart @@ -37,7 +37,9 @@ if [[ "$HOST" == "atlantislaptop" ]]; then hc keybind XF86MonBrightnessDown spawn /bin/bash -c 'tee /sys/class/backlight/intel_backlight/brightness <<< "$(expr $(cat /sys/class/backlight/intel_backlight/brightness) - 5)"' xautolock -time 15 -locker /home/ik15ydit/.config/i3lock/piclock.sh & /usr/bin/dunst & - hc keybind $Mod-o spawn /bin/bash -c "systemctl hibernate" + hc keybind $Mod-o spawn /bin/bash -c "/home/ik15ydit/.config/i3lock/piclock.sh & systemctl hibernate" + hc keybind $Mod-c spawn /bin/bash -c "sudo /usr/bin/openvpn_cip.sh & ~/.config/herbstluftwm/hl_status_deamon.py --refresh" + hc keybind $Mod-Shift-c spawn /bin/bash -c "sudo stopvpn.sh && ~/.config/herbstluftwm/hl_status_deamon.py --refresh" fi @@ -57,7 +59,7 @@ hc keybind $Mod-q close #spawn shit hc keybind $Mod-Return spawn urxvt -hc keybind $Mod-Shift-Return spawn ~/.config/herbstluftwm/cwd_helper.py +hc keybind $Mod-Shift-Return spawn ~/.config/herbstluftwm/hl_start_urxvt_cwd.py hc keybind $Mod-i spawn urxvt -e nohup zsh -c "chromium &" #need to reliably use the zshconf chromium if [[ $HOST =~ atlantis* ]]; then hc keybind $Mod-l spawn i3lock -i ~/.config/i3lock/bg.png -t @@ -166,7 +168,7 @@ hc mousebind $Mod-Button3 resize hc keybind $Mod-BackSpace cycle_monitor hc keybind $Mod-Tab cycle_all +1 hc keybind $Mod-Shift-Tab cycle_all -1 -hc keybind $Mod-c cycle +#hc keybind $Mod-c cycle #hc keybind $Mod-i jumpto urgent #pulseaudio diff --git a/herbstluftwm/panel_content.py b/herbstluftwm/hl_panel_content.py similarity index 91% rename from herbstluftwm/panel_content.py rename to herbstluftwm/hl_panel_content.py index 4726e38..54f704f 100755 --- a/herbstluftwm/panel_content.py +++ b/herbstluftwm/hl_panel_content.py @@ -25,6 +25,8 @@ def color_panel(s,hex_code,seper=True): return "^fg(#" + hex_code + ") " + s + "^bg()"+sep def get_color(nr,start,end): + if nr == 88: + return hex(GREEN) if end == start or nr >= end: return hex(GREEN) else: @@ -71,6 +73,14 @@ def guthaben(): guthaben = color_panel(guthaben,col) return guthaben; +def vpn(): + vpn = '' + if not hl_utils.is_cip(): + tmp = -1 + with open(hl_utils.hlpath("vpn_status.log")) as f: + tmp = f.read() + tmp = ' '+tmp + return tmp; def battery(): if hl_utils.is_laptop(): @@ -88,7 +98,7 @@ def battery(): if bat.startswith("Charging"): return color_panel("Charging",GREEN,seper=False) + color_panel(bat.lstrip("Charging ,").strip('\n'),get_color(plain,0,100)) - elif bat.startswith("Full"): + elif bat.startswith("Full") or bat.startswith('Unknown'): return color_panel("On Supply and fully charged",GREEN) elif plain <= 1: return color_panel(">>>>>>>>>>>>>>>> --------------- WARNING BATTER FAILURE IMMINENT --------------- <<<<<<<<<<<<<",RED) @@ -125,5 +135,5 @@ def irc(): pass else: return '' - -print(irc(),guthaben(),battery(),sep='') +if __name__ == "__main__": + print(vpn(),guthaben(),battery(),sep='') diff --git a/herbstluftwm/hl_pracct_deamon.py b/herbstluftwm/hl_pracct_deamon.py deleted file mode 100755 index 6c36aae..0000000 --- a/herbstluftwm/hl_pracct_deamon.py +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/python3 -import os -import sys -import time -from hl_utils import error, is_cip, shexec, color_remove, hlpath - -#Druckerguthaben -if is_cip(): - while(True): - path = hlpath("pracct.log") - out = color_remove(shexec("pr_acct").split("\n")[0]).split(' ')[-1] - with open(path,'w+') as f: - f.write(out) - time.sleep(30) -sys.exit() diff --git a/herbstluftwm/cwd_helper.py b/herbstluftwm/hl_start_urxvt_cwd.py similarity index 89% rename from herbstluftwm/cwd_helper.py rename to herbstluftwm/hl_start_urxvt_cwd.py index 5342a8c..2dbc4ea 100755 --- a/herbstluftwm/cwd_helper.py +++ b/herbstluftwm/hl_start_urxvt_cwd.py @@ -25,7 +25,8 @@ if window==-1: ############ IF URXVT GET PID ########### pid = -1 -out = shexec('xprop -id '+hex(window)).split('\n') +out = subprocess.check_output(['xprop','-id',hex(window)]).decode().split('\n') +#out = shexec('xprop -id '+hex(window)).split('\n') #not working for l in out: if l.startswith('WM_CLASS(STRING)') and 'urxvt' in l: break; diff --git a/herbstluftwm/hl_status_deamon.py b/herbstluftwm/hl_status_deamon.py new file mode 100755 index 0000000..9e26b60 --- /dev/null +++ b/herbstluftwm/hl_status_deamon.py @@ -0,0 +1,53 @@ +#!/usr/bin/python3 +import os +import sys +import time +import sys +import subprocess +from hl_panel_content import color_panel +from hl_utils import error, is_cip, shexec, color_remove, hlpath + +RED = 0xff0000 +GREEN = 0x32CD32 +YELLOW = 0xffff00 + +#Druckerguthaben +def pr_acct_status(): + if is_cip(): + path = hlpath("pracct.log") + out = color_remove(shexec("pr_acct").split("\n")[0]).split(' ')[-1] + with open(path,'w+') as f: + f.write(out) +def vpn_status(): + if not is_cip(): + vpn_path = hlpath("vpn_status.log") + out_vpn = subprocess.check_output(["ps","-ef"]).decode().split('\n') + #filter(lambda x: not 'openvpn' in x,out_vpn) + ret = 0 + #worst case thats about 1k lines + for l in out_vpn: + if 'openvpn' in l and not 'sudo' in l and not 'grep' in l and not 'cip.sh' in l: + ret += 1; + #print(ret) + if ret == 0: + out_vpn = color_panel("VPN: Link Down",RED) + elif ret == 1: + out_vpn = color_panel("VPN: In Use",GREEN) + elif ret > 1: + out_vpn = color_panel("multiple VPNs connected",YELLOW) + else: + out_vpn = color_panel("VPN: ret was "+str(ret)+" ??",RED) + #print(out_vpn) + with open(vpn_path,'w+') as g: + g.write(out_vpn) + +if __name__ == '__main__': + #print('"'+sys.argv[-1]+'"') + if sys.argv[-1]=='--refresh': + vpn_status() + pr_acct_status() + sys.exit() + while(True): + vpn_status() + pr_acct_status() + time.sleep(30) diff --git a/herbstluftwm/panel.sh b/herbstluftwm/panel.sh index 8998e2e..564ffba 100755 --- a/herbstluftwm/panel.sh +++ b/herbstluftwm/panel.sh @@ -118,7 +118,7 @@ hc pad $monitor $panel_height echo -n "^bg()^fg() ${windowtitle//^/^^}" ####################### Interface to python layer ######################### - right="30. Mai 14 Kobras |$($HOME/.config/herbstluftwm/panel_content.py) $date" + right="30. Mai 14 Kobras |$($HOME/.config/herbstluftwm/hl_panel_content.py) $date" right_text_only=$(echo -n "$right" | sed 's.\^[^(]*([^)]*)..g') # get width of right aligned text.. and add some space.. diff --git a/herbstluftwm/wsbar.sh b/herbstluftwm/wsbar.sh deleted file mode 100755 index a4142bb..0000000 --- a/herbstluftwm/wsbar.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash -FG='white' -BG='black' -FONT="-*-fixed-medium-*-*-*-12-*-*-*-*-*-*-*" - -function uniq_linebuffered() { - awk '$0 != l { print ; l=$0 ; fflush(); }' "$@" -} - -{ - conky -c ~/.conkyrc_herbstluft | while read -r; do - echo -e "conky $REPLY"; - #break - done > >(uniq_linebuffered) & - childpid=$! - herbstclient --idle - kill $childpid -} | { - TAGS=( $(herbstclient tag_status $monitor) ) - conky="" - separator="^fg(#1793D0)^ro(1x16)^fg()" - while true; do - for i in "${TAGS[@]}" ; do - echo -n "^ca(1,herbstclient use ${i:1}) " - case ${i:0:1} in - '#') - echo -n "^fg(#1793D0)[^fg(#FFFFFF)${i:1}^fg(#1793D0)]" - ;; - ':') - echo -n "^fg(#FFFFFF) ${i:1} " - ;; - *) - echo -n "^fg(#123456) ${i:1} " - ;; - esac - echo -n "^ca()" - done - echo -n " $separator" - conky_text_only=$(echo -n "$conky"|sed 's.\^[^(]*([^)]*)..g') - width=$(textwidth "$FONT" "$conky_text_only ") - echo -n "^p(_RIGHT)^p(-$width)$conky" - echo - read line || break - cmd=( $line ) - case "$cmd[0]" in - tag*) - TAGS=( $(herbstclient tag_status $monitor) ) - ;; - conky*) - conky="${cmd[@]:1}" - ;; - esac - done -} 2> /dev/null |dzen2 -ta l -y 0 -x 0 -h 16 -w 1286 -fg $FG -bg $BG -fn $FONT & diff --git a/i3lock/piclock.sh b/i3lock/piclock.sh new file mode 100755 index 0000000..b950aa4 --- /dev/null +++ b/i3lock/piclock.sh @@ -0,0 +1 @@ +i3lock -i ~/.config/i3lock/bg.png -t diff --git a/other/package_list_full.txt b/other/package_list_full.txt index d3a988e..873bd4f 100644 --- a/other/package_list_full.txt +++ b/other/package_list_full.txt @@ -57,6 +57,7 @@ pulseaudio ;#sound python ;#python python-pdfminer ;#needed for markingbird python-pip ;#install python modules +python-psutils ;#needed for hl_start_urxvt_cwd.py (hlconfig) qemu-kvm ;#virtual machine rofi ;#easier find/switch between open windows rxvt-unicode-256color ;#terminal-emulator diff --git a/zshrc b/zshrc index 352e919..1f4005a 100644 --- a/zshrc +++ b/zshrc @@ -114,6 +114,7 @@ if [[ $HOST =~ atlantis* ]]; then alias telegram-plain='ssh uni -t "/proj/ciptmp/ik15ydit/Zeug/Telegram/tg/bin/telegram-cli --disable-colors --disable-readline -k tg-server.pub"' alias x='exec startx' + alias vpn='sudo /usr/bin/openvpn_cip.sh' else alias telegram='/proj/ciptmp/ik15ydit/Zeug/Telegram/tg/bin/telegram-cli -k tg-server.pub' alias burp=/home/cip/2013/ik15ydit/ciptmp/reps/WebScan/burpsuite/BurpSuiteFree @@ -124,6 +125,7 @@ function qfind { } alias pcolor='for i in {0..255} ; do printf "\x1b[38;5;${i}mcolour${i} "; if [[ $(((($i+3)/6)*6)) -eq $(($i+3)) ]]; then echo; fi; done' alias "ipconf"="ip addr show" +alias 'vpn?'='ps -ef | grep openvpn | grep -v grep' ## General ## if [[ $HOST =~ atlantis* ]]; then