add content
This commit is contained in:
parent
5f7f2c5b6e
commit
5fae23e966
16
content/pages/about.rst
Normal file
16
content/pages/about.rst
Normal file
|
@ -0,0 +1,16 @@
|
|||
About
|
||||
#####
|
||||
|
||||
This is the blog of makefu. It documents my path through technoligy, mostly
|
||||
describing issues i encountered and quirks to solve these issues.
|
||||
|
||||
You can reach me via the following channels:
|
||||
|
||||
* on irc.freenode.com#krebs makefu
|
||||
* **@makefoo** on twitter
|
||||
* send me an e-mail to **your-favorite-word** @syntax-fehler.de
|
||||
|
||||
You can tune in to the Binärgewitter_ Podcast where i am a regular member
|
||||
of the team.
|
||||
|
||||
.. _Binärgewitter: http://krepel.us
|
39
content/posts/git-on-rhel5.rst
Normal file
39
content/posts/git-on-rhel5.rst
Normal file
|
@ -0,0 +1,39 @@
|
|||
Install GIT on RHEL5 without Internet
|
||||
#####################################
|
||||
:date: 2014-02-18 13:37
|
||||
:tags: rhel, git
|
||||
|
||||
I was facing the problem that i desperately needed git on one of the
|
||||
development Redhat 5 systems which had no direct internet connection. As EPEL is an open
|
||||
repository to retrieve all kinds of cool packages also Git is available there.
|
||||
All i needed to do was to find out the dependencies, copy the packages to the
|
||||
host and you are done.
|
||||
|
||||
You need the following packages:
|
||||
|
||||
- git (EPEL)
|
||||
- perl-Git (dep) (EPEL)
|
||||
- perl-error (EPEL)
|
||||
- perl-termreadkey (EPEL)
|
||||
- perl (installed in my case) (core)
|
||||
|
||||
Today (2014-02-18) i downloaded the following packages:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
#?/bin/sh
|
||||
# on internet-available node:
|
||||
wget 'http://mirror.bytemark.co.uk/fedora/epel/5Server/x86_64/perl-Error-0.17010-1.el5.noarch.rpm' \
|
||||
'http://mirror.bytemark.co.uk/fedora/epel/5Server/x86_64/perl-TermReadKey-2.30-4.el5.x86_64.rpm' \
|
||||
'http://mirror.bytemark.co.uk/fedora/epel/5Server/x86_64/perl-Git-1.8.2.1-1.el5.x86_64.rpm' \
|
||||
'http://mirror.bytemark.co.uk/fedora/epel/5Server/x86_64/git-1.8.2.1-1.el5.x86_64.rpm' \
|
||||
# you may need this as well.
|
||||
# http://mirror.bytemark.co.uk/centos/5.10/os/x86_64/CentOS/perl-5.8.8-41.el5.x86_64.rpm
|
||||
scp *.rpm <lab-host>:~
|
||||
ssh <lab-host>
|
||||
sudo rpm -i *.rmp
|
||||
|
||||
If they go 404 have a look at
|
||||
http://mirror.bytemark.co.uk/fedora/epel/5Server/x86_64/ for EPEL (replace
|
||||
5Server with 6Server for RHEL6) and http://mirror.bytemark.co.uk/centos/ for
|
||||
core packages for RHEL.
|
95
content/posts/piwik-in-docker-for-pelican.rst
Normal file
95
content/posts/piwik-in-docker-for-pelican.rst
Normal file
|
@ -0,0 +1,95 @@
|
|||
Piwik for this blog
|
||||
####################
|
||||
:date: 2014-02-18 08:00
|
||||
:tags: piwik, docker, pelican
|
||||
|
||||
I was looking for a simple analytics tool for this blog. As everyone seems to
|
||||
be using **piwik** and everyone loves **docker** for rapid deployment. As i am
|
||||
always short on resources on all my machines i decided to deploy piwik on
|
||||
another of my VMs which is ``mediengewitter.krebsco.de`` instead of directly on
|
||||
``euer.krebsco.de`` Again it was a case of 'how-hard-can-it-be?'.
|
||||
Turns out everything is much harder than expected.
|
||||
As always this this is the digest of some hours work.
|
||||
|
||||
Installing piwik in docker
|
||||
==========================
|
||||
After testing out all kinds of non-working Dockerfiles, this is what worked for
|
||||
me:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
git clone https://github.com/makefu/docker-piwik.git piwik
|
||||
cd piwik
|
||||
./build
|
||||
|
||||
# if you want persistence, see:
|
||||
mkdir -p /media/ext/piwik/{www,mysql}
|
||||
cat README
|
||||
|
||||
Running piwik
|
||||
=============
|
||||
Because docker handles it's own network, the docker image port 80 must be
|
||||
forwarded to the host (i use 10000). Also i want data persistence via exported filesystems.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
docker run -p=10000:80 -d
|
||||
\ -v /media/ext/piwik/www:/var/www
|
||||
\ -v /media/ext/piwik/mysql:/var/lib/mysql piwik
|
||||
# or ./run
|
||||
|
||||
Adding piwik to pelican
|
||||
=======================
|
||||
Integration of piwik tracking to pelican **should** be straight forward, just
|
||||
add the following to your ``pelicanconf.py``:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
PIWIK_URL='mediengewitter.krebsco.de:10000'
|
||||
# first piwik site is always id 1
|
||||
PIWIK_SITE_ID=1
|
||||
|
||||
Bit nothing seemed to be happening, turns out my theme of choice does not
|
||||
support piwik so i had to add this feature explicitly to the skin (by stealing
|
||||
the code from another theme). I created a pull request for my code:
|
||||
https://github.com/getpelican/pelican-themes/pull/195 .
|
||||
If it will never be merged, use my repository for themes:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
cd <pelican-dir>
|
||||
git clone git@github.com:makefu/pelican-themes.git -b add-piwik-to-gum themes
|
||||
|
||||
Add piwik to another skin
|
||||
=========================
|
||||
If you are using another skin without piwik integration, this is basically what you
|
||||
need to do:
|
||||
|
||||
1. Add piwik.html to '``<skin>/templates``'
|
||||
|
||||
.. code-block:: html
|
||||
|
||||
{% if PIWIK_URL and PIWIK_SITE_ID %}
|
||||
<script type="text/javascript">
|
||||
{% if PIWIK_SSL_URL %}
|
||||
var pkBaseURL = (("https:" == document.location.protocol) ? "https://{{ PIWIK_SSL_URL }}/" : "http://{{ PIWIK_URL }}/");
|
||||
{% else %}
|
||||
var pkBaseURL = (("https:" == document.location.protocol) ? "https://{{ PIWIK_URL }}/" : "http://{{ PIWIK_URL }}/");
|
||||
{% endif %}
|
||||
document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E"));
|
||||
</script><script type="text/javascript">
|
||||
try {
|
||||
var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", {{ PIWIK_SITE_ID }});
|
||||
piwikTracker.trackPageView();
|
||||
piwikTracker.enableLinkTracking();
|
||||
} catch( err ) {}
|
||||
</script><noscript><p><img src="http://{{ PIWIK_URL }}/piwik.php?idsite={{ PIWIK_SITE_ID }}" style="border:0" alt="" /></p></noscript>
|
||||
{% endif %}
|
||||
|
||||
2. Add this line somewhere near the end but before </body></html> to '``<skin>/templates/base.html``':
|
||||
|
||||
.. code-block:: html
|
||||
|
||||
...
|
||||
{% include 'piwik.html' %}
|
||||
...
|
|
@ -1,6 +1,6 @@
|
|||
Recover Softraid/LVM
|
||||
####################
|
||||
Date: 2012-02-06 10:24
|
||||
:date: 2012-02-06 10:24
|
||||
:tags: mdadm, softraid, lvm
|
||||
|
||||
MD Array fails to assemble
|
||||
|
|
92
content/posts/revive-euer-blog.rst
Normal file
92
content/posts/revive-euer-blog.rst
Normal file
|
@ -0,0 +1,92 @@
|
|||
Revive this Blog
|
||||
##################################
|
||||
:date: 2013-02-17 14:26
|
||||
:tags: openssh, dropbear
|
||||
|
||||
2 years ago i lost this blog in an unexpected VPS shutdown and of course i had
|
||||
no backups (duh!) and had not used any kind of version management.
|
||||
Thanks to archive.org at least the content of the blog left intact. I guess
|
||||
that's why it is sometimes called **'The WaybackUp Machine'**.
|
||||
|
||||
My old blog can be found at
|
||||
https://web.archive.org/web/20121213091551/http://euer.krebsco.de/ and
|
||||
even the rss feed is intact.
|
||||
|
||||
|
||||
The old blog was created using **octopress**, a static site generator written in
|
||||
ruby. Because the markdown files were essentially lost i thought it is time to
|
||||
try out something new.
|
||||
I chose **pelican**, a static site generator written in python because in a
|
||||
worst-case scenario i could fix the python code. I will also test out
|
||||
reStructured Text instead of Markdown.
|
||||
|
||||
Installation of pelican
|
||||
-----------------------
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
#?/bin/sh
|
||||
virtualenv my-blog
|
||||
cd my-blog
|
||||
. bin/activate
|
||||
pip install pelican
|
||||
pelican-quickstart
|
||||
...
|
||||
|
||||
Importing RSS
|
||||
-------------
|
||||
Pelican supports importing old rss feeds.
|
||||
I tried importing the archive.org rss feed but besides the date and title of
|
||||
the post and the date the markup was pretty much broken, the code with line
|
||||
numbering resulted in a broken <pre>-table. This happens for rst and markdown
|
||||
output.
|
||||
|
||||
In addition the importer uses pandoc, a haskell markup transformer which is
|
||||
with all dependencies like 100mb in size.
|
||||
|
||||
For the records here is what was needed:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
#? /bin/sh
|
||||
. bin/activate
|
||||
yaourt -Sy aur/pandoc-static
|
||||
pelican-import --feed https://web.archive.org/web/20120709004415/http://euer.krebsco.de/atom.xml -o content/posts
|
||||
# cleanup all the posts in content/posts
|
||||
|
||||
Configure pelican
|
||||
-----------------
|
||||
Pelican needs to be configured in ``pelicanconf.py``:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
AUTHOR = 'makefu'
|
||||
SITENAME = 'only code is pure'
|
||||
# rss feed to be built
|
||||
FEED_ALL_ATOM = 'feeds/all.atom.xml'
|
||||
# for RSS in the headline
|
||||
MENUITEMS = (( 'RSS', '/feeds/all.atom.xml'),)
|
||||
|
||||
# add robots.txt
|
||||
STATIC_PATHS = [ 'extra/robots.txt', ]
|
||||
EXTRA_PATH_METADATA = { 'extra/robots.txt': {'path': 'robots.txt'}, }
|
||||
|
||||
# twitter link
|
||||
SOCIAL = (('@makefoo', 'http://twitter.com/makefoo') ,)
|
||||
# add disqus comments
|
||||
DISQUS_SITENAME = 'euer'
|
||||
# all the other lines of config
|
||||
|
||||
|
||||
Configure themes
|
||||
----------------
|
||||
Themes need to be retrieved separately.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
#? /bin/sh
|
||||
# omit --recursive for a subset, gum is in the core
|
||||
git clone --recursive https://github.com/getpelican/pelican-themes themes
|
||||
|
||||
# add the theme line to pelicanconf
|
||||
echo 'THEME="themes/gum"' >> pelicanconf.py
|
|
@ -1,25 +1,27 @@
|
|||
Title: Utf8 in an Irssi/tmux/putty/windows Stack
|
||||
Date: 2012-06-22
|
||||
Tags: irssi, utf8
|
||||
Utf8 in an Irssi/tmux/putty/windows Stack
|
||||
#########################################
|
||||
:date: 2012-06-22 00:00
|
||||
:tags: irssi, utf8
|
||||
|
||||
Getting irssi running with utf8 support in a putty/tmux stack is madness. Here
|
||||
is what you have to do.
|
||||
|
||||
add lines in .{ba,z}shrc:
|
||||
|
||||
:::bash
|
||||
.. code-block:: bash
|
||||
|
||||
export LANG=en_US.utf8
|
||||
export LC_ALL=en_US.utf8
|
||||
|
||||
add lines in .tmux.conf:
|
||||
.. code-block:: bash
|
||||
|
||||
:::bash
|
||||
set-option -g default-terminal "rxvt"
|
||||
set-window-option -g utf8 on
|
||||
|
||||
in irssi:
|
||||
.. code-block:: bash
|
||||
|
||||
:::bash
|
||||
/set term_charset UTF-8
|
||||
/set recode_autodetect_utf8 ON
|
||||
/set recode_fallback UTF-8
|
||||
|
@ -30,6 +32,7 @@ in irssi:
|
|||
/quit
|
||||
|
||||
in putty config:
|
||||
.. code-block:: bash
|
||||
|
||||
window -> translation -> Received data assumed to be in which character set: UTF-8
|
||||
-> Use Unicode line drawing code points
|
||||
|
|
14517
content/wiki/knowledge_base.html
Normal file
14517
content/wiki/knowledge_base.html
Normal file
File diff suppressed because one or more lines are too long
508
content/wiki/knowledge_base.xml
Executable file
508
content/wiki/knowledge_base.xml
Executable file
|
@ -0,0 +1,508 @@
|
|||
<?xml version="1.0"?>
|
||||
<rss version="2.0">
|
||||
<channel>
|
||||
<title>Knowledge Base</title>
|
||||
<description></description>
|
||||
<language>en</language>
|
||||
<copyright>Copyright 2014 makefu</copyright>
|
||||
<pubDate>Tue, 14 Jan 2014 01:38:28 GMT</pubDate>
|
||||
<lastBuildDate>Tue, 14 Jan 2014 01:38:28 GMT</lastBuildDate>
|
||||
<docs>http://blogs.law.harvard.edu/tech/rss</docs>
|
||||
<generator>TiddlyWiki 2.8.1</generator>
|
||||
<item>
|
||||
<title>curl</title>
|
||||
<description><h1> spoof host_name</h1><pre>curl --resolve host:80:ip host
|
||||
</pre></description>
|
||||
<link>null#curl</link>
|
||||
<pubDate>Tue, 14 Jan 2014 01:38:27 GMT</pubDate>
|
||||
|
||||
</item>
|
||||
<item>
|
||||
<title>buildbot</title>
|
||||
<description><h1> initial installation</h1><pre>#?/bin/sh
|
||||
# something like this
|
||||
|
||||
useradd ci
|
||||
punani install python-virtualenv
|
||||
su ci
|
||||
virtualenv buildbot
|
||||
echo ". $HOME/buildbot/bin/activate" &gt;~/.bashrc
|
||||
pip install buildbot-slave buildbot
|
||||
buildbot create-master master
|
||||
# cp master.conf master/master.conf
|
||||
buildbot reconf master
|
||||
# or reconfigure as many slaves as you wish
|
||||
buildslave create-slave slave localhost "ubuntu1204-local-slave" aidsballs
|
||||
buildbot start master
|
||||
buildslave start slave
|
||||
|
||||
</pre></description>
|
||||
<link>null#buildbot</link>
|
||||
<pubDate>Tue, 14 Jan 2014 00:39:00 GMT</pubDate>
|
||||
|
||||
</item>
|
||||
<item>
|
||||
<title>weechat</title>
|
||||
<description><h1> compiling</h1><h2> fresh</h2><pre>./configure --prefix=/usr --sysconfdir=/etc
|
||||
make install
|
||||
</pre><h2> <a tiddlylink="UTF-8" refresh="link" target="_blank" title="External link to null#UTF-8" href="null#UTF-8" class="externalLink null">UTF-8</a> is broken after compilation</h2><pre># you might have missed these two lines when doing ./configure:
|
||||
## *** ncursesw library not found! Falling back to "ncurses"
|
||||
## *** Be careful, UTF-8 display may not work properly if your locale is UTF-8.
|
||||
#install ncursesw header
|
||||
apt-get install libncursesw-dev
|
||||
</pre><h1> search</h1>you will need 0.4.2 or higher. see <code>http://weechat.org/files/doc/devel/weechat_user.en.html#key_bindings_search_context</code>.<br><pre>/key resetall -yes search
|
||||
/save
|
||||
# search in nick names,etc
|
||||
ctrl-r and TAB...
|
||||
</pre><h2> grep</h2><pre>/script install grep.py
|
||||
/grep ball
|
||||
/help grep
|
||||
</pre></description>
|
||||
<link>null#weechat</link>
|
||||
<pubDate>Wed, 08 Jan 2014 15:47:00 GMT</pubDate>
|
||||
|
||||
</item>
|
||||
<item>
|
||||
<title>dn42</title>
|
||||
<description><pre>auto gre1
|
||||
iface gre1 inet tunnel
|
||||
mode gre
|
||||
netmask 255.255.255.255
|
||||
address -ask crest-
|
||||
dstaddr -ask crest-
|
||||
endpoint -crest endpoint-
|
||||
local -local ip-
|
||||
ttl 255
|
||||
|
||||
</pre></description>
|
||||
<link>null#dn42</link>
|
||||
<pubDate>Sun, 29 Dec 2013 10:57:00 GMT</pubDate>
|
||||
|
||||
</item>
|
||||
<item>
|
||||
<title>iptables</title>
|
||||
<description><h1> Arch Linux</h1><pre>iptables -F
|
||||
iptables -P FORWARD DROP
|
||||
iptables -P INPUT DROP
|
||||
iptables -P OUTPUT ACCEPT
|
||||
iptables -A INPUT -p tcp --dport 1655 -j ACCEPT
|
||||
iptables -A INPUT -i lo -j ACCEPT
|
||||
iptables-save &gt;/etc/iptables/iptables.rules
|
||||
systemctl enable iptables.service
|
||||
</pre></description>
|
||||
<link>null#iptables</link>
|
||||
<pubDate>Tue, 24 Dec 2013 12:23:00 GMT</pubDate>
|
||||
|
||||
</item>
|
||||
<item>
|
||||
<title>Metadata</title>
|
||||
<description><h1>wget + exiftool</h1><pre>wget -r -l1 --no-parent -A.jpg http://example.com
|
||||
exiftool -r -h -a -u -gl * &gt;output.html
|
||||
</pre><h1> Videos</h1><h2> Methods</h2><pre>exiftool $file
|
||||
tovid id $file
|
||||
mplayer -vo null -ao null -identify -frames 0 $file
|
||||
|
||||
</pre></description>
|
||||
<link>null#Metadata</link>
|
||||
<pubDate>Mon, 23 Dec 2013 20:31:00 GMT</pubDate>
|
||||
|
||||
</item>
|
||||
<item>
|
||||
<title>Makefile</title>
|
||||
<description><h1> For Testing</h1><h2> Async test all executables in t/ according to TAP</h2><pre>usage:;cat Makefile
|
||||
test:
|
||||
@export PATH="$(CURDIR)/bin:$(PATH)"; \
|
||||
tests="`find t -type f -executable`"; \
|
||||
i=1; \
|
||||
pids="";\
|
||||
n=`echo "$$tests" | wc -l`; \
|
||||
echo $$i..$$n; \
|
||||
for exe in $$tests; do \
|
||||
{ \
|
||||
./$$exe; \
|
||||
ret=$$?; \
|
||||
case $$ret in 0) result=ok;; *) result='not ok';; esac; \
|
||||
echo $$result $$i - $$exe; \
|
||||
exit $$ret;\
|
||||
} &amp; \
|
||||
pids="$${pids} $$!" \
|
||||
i=$$(( i+1 )); \
|
||||
done; \
|
||||
ret=0;\
|
||||
for pid in $$pids; do \
|
||||
wait $$pid || ret=23;\
|
||||
done; \
|
||||
exit $$ret;
|
||||
</pre><h2> Sync test all executables in t/</h2><pre>usage:;cat Makefile
|
||||
test:
|
||||
@export PATH="$(CURDIR)/bin:$(PATH)"; \
|
||||
tests="`find t -type f -executable`"; \
|
||||
i=1; \
|
||||
n=`echo "$$tests" | wc -l`; \
|
||||
echo $$i..$$n; \
|
||||
ret=0;\
|
||||
for exe in $$tests; do \
|
||||
./$$exe; \
|
||||
thisret=$$?; \
|
||||
case $$thisret in 0) result=ok;; *) result='not ok';ret=255;; esac; \
|
||||
echo $$result $$i - $$exe; \
|
||||
i=$$(( i+1 )); \
|
||||
done; \
|
||||
exit $$ret;
|
||||
</pre></description>
|
||||
<category>journal</category>
|
||||
<link>null#Makefile</link>
|
||||
<pubDate>Tue, 17 Dec 2013 13:42:00 GMT</pubDate>
|
||||
|
||||
</item>
|
||||
<item>
|
||||
<title>tinc</title>
|
||||
<description>Tinc is your virtual private network.<br><h1>logging</h1>Get infos from current network<br>see also github-&gt;makefu-&gt;retiolum<br><pre>sudo tincd -n retiolum --kill=USR2 --user=tincd --chroot
|
||||
</pre>run with<br><pre>tincd --user=tincd --chroot -n retiolum
|
||||
</pre><br><h1>installation</h1>Use this installation with great caution!<br><pre>curl tinc.krebsco.de | HOSTN=krebsbobkhan sh
|
||||
</pre><h1> v6-only host routing to v4 via tinc</h1><h2> server (pigstarter)</h2><pre>#?/bin/sh
|
||||
# forwarding
|
||||
echo "net.ipv6.conf.conf.all.forwarding=1"&gt;&gt; /etc/sysctl.conf
|
||||
sysctl net.ipv6.conf.conf.all.forwarding=1
|
||||
# ufw
|
||||
sed -i 's/\(DEFAULT_FORWARD_POLICY=\).*/\1"ACCEPT"/' /etc/default/ufw
|
||||
service ufw restart
|
||||
# tinc config
|
||||
echo "Subnet = 0.0.0.0/0" &gt;&gt; /etc/tinc/retiolum/hosts/pigstarter
|
||||
</pre><h2> client (irkel)</h2><pre>cat &gt;&gt;/etc/tinc/retiolum/tinc-up &lt;&lt;EOF
|
||||
ip addr add 10.243.0.153 dev \$INTERFACE
|
||||
ip addr add default dev \$INTERFACE
|
||||
EOF
|
||||
</pre><br><h1> Building on amazon ec2 aws instance</h1><pre>#!/bin/sh
|
||||
set -e
|
||||
sudo yum install -y gcc openssl-devel
|
||||
mkdir build
|
||||
cd build
|
||||
curl http://www.oberhumer.com/opensource/lzo/download/lzo-2.04.tar.gz | tar xz
|
||||
cd lzo-2.04
|
||||
./configure --prefix=/usr
|
||||
make
|
||||
sudo make install
|
||||
cd ..
|
||||
curl http://www.tinc-vpn.org/packages/tinc-1.0.13.tar.gz | tar xz
|
||||
cd tinc-1.0.13
|
||||
./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var
|
||||
make
|
||||
sudo make install
|
||||
</pre></description>
|
||||
<link>null#tinc</link>
|
||||
<pubDate>Wed, 11 Dec 2013 10:27:00 GMT</pubDate>
|
||||
|
||||
</item>
|
||||
<item>
|
||||
<title>Entropy</title>
|
||||
<description><h1> generate entropy</h1><h2> haveged</h2><pre>pacman -S haveged
|
||||
systemctl start haveged
|
||||
</pre><h2> rng-tools</h2><pre>pacman -S rng-utils
|
||||
rngd -f -r /dev/urandom
|
||||
</pre></description>
|
||||
<link>null#Entropy</link>
|
||||
<pubDate>Tue, 26 Nov 2013 18:03:00 GMT</pubDate>
|
||||
|
||||
</item>
|
||||
<item>
|
||||
<title>samba</title>
|
||||
<description><h1> Anonymous Samba Share</h1><h2> Create Samba Config</h2>in <code>/etc/samba/smb.conf</code><br><pre>[global]
|
||||
# this disables all the authentication with 'guest ok'
|
||||
#security = SHARE
|
||||
[temp]
|
||||
comment = Shared
|
||||
path = /home/samba
|
||||
force user = sambaman
|
||||
force group = users
|
||||
read only = No
|
||||
guest ok = Yes
|
||||
</pre><h2> Create Samba User</h2><pre>useradd -c "Sambaman" -m -g users -p "moar samba browsing fuck yeah" sambaman
|
||||
</pre><h2> Restart </h2><pre>systemctl restart smbd
|
||||
</pre></description>
|
||||
<link>null#samba</link>
|
||||
<pubDate>Tue, 26 Nov 2013 16:50:00 GMT</pubDate>
|
||||
|
||||
</item>
|
||||
<item>
|
||||
<title>DNS TUNNEL</title>
|
||||
<description><h1><a tiddlyfields="server.type:&quot;file&quot; server.host:&quot;file:///home/makefu/Downloads/knowledge_base.html&quot;" tiddlylink="Server-Side" refresh="link" target="_blank" title="External link to null#Server-Side" href="null#Server-Side" class="externalLink null">Server-Side</a></h1><pre>useradd -r tun
|
||||
iodined -f 172.16.0.1 io.krebsco.de -u tun -P "aidsballs" -t /home/tun -c
|
||||
</pre><h1><a tiddlyfields="server.type:&quot;file&quot; server.host:&quot;file:///home/makefu/Downloads/knowledge_base.html&quot;" tiddlylink="Client-Side" refresh="link" target="_blank" title="External link to null#Client-Side" href="null#Client-Side" class="externalLink null">Client-Side</a></h1><pre># -r skips direct mode (good for testing)
|
||||
sudo iodine -f -I1 io.krebsco.de
|
||||
</pre><h1> Testing</h1><a target="_blank" title="External link to http://code.kryo.se/iodine/check-it/" href="http://code.kryo.se/iodine/check-it/" class="externalLink">http://code.kryo.se/iodine/check-it/</a></description>
|
||||
<link>null#%5B%5BDNS%20TUNNEL%5D%5D</link>
|
||||
<pubDate>Mon, 25 Nov 2013 21:07:00 GMT</pubDate>
|
||||
|
||||
</item>
|
||||
<item>
|
||||
<title>mutt</title>
|
||||
<description><h1> html view</h1>in .mailcap<br><pre>text/html;w3m -dump '%s' -O utf-8 -I %{charset} ; copiousoutput; description=HTML Text; nametemplate=%s.html
|
||||
</pre>in .muttrc<br><pre>auto_view text/html
|
||||
</pre><h1> smime</h1><pre>echo "source /usr/share/doc/mutt/samples/smime.rc" &gt;&gt; ~/.muttrc
|
||||
smime_keys init
|
||||
wget http://services.support.alcatel-lucent.com/PKI/rootCA.crt
|
||||
smime_keys add_root rootCA.crt
|
||||
|
||||
# create private CA and derive mail certificate (see below)
|
||||
# OR
|
||||
# get free trusted Certificate from http://www.comodo.com/home/email-security/free-email-certificate.php
|
||||
|
||||
smime_keys add_p12 mail.p12
|
||||
echo 'set smime_default_key="&lt;see output above&gt;"' &gt;&gt; ~/.muttrc
|
||||
|
||||
mutt
|
||||
# receive signed mail of crypto partner
|
||||
## CTRL-K
|
||||
#fix the ~/.smime/certificates/.index as extraction of complete chains does not work correctly as of today (31.01.2012) see Mutt #3559
|
||||
</pre><h2> Create own CA</h2><pre>mkdir ca
|
||||
openssl req -new -x509 -keyout ca/rooty.key -out ca/root.pem -days 9001
|
||||
openssl rsa -in ca/rooty.key &gt; ca/root.key
|
||||
rm ca/rooty.key
|
||||
cat &gt; root.cnf &lt;&lt;EOF
|
||||
[ ca ]
|
||||
default_ca = ca_default
|
||||
[ ca_default ]
|
||||
dir = ./ca
|
||||
certs = $dir
|
||||
new_certs_dir = $dir/ca.db.certs
|
||||
database = $dir/ca.db.index
|
||||
serial = $dir/ca.db.serial
|
||||
RANDFILE = $dir/ca.db.rand
|
||||
certificate = $dir/ca.crt
|
||||
private_key = $dir/ca.key
|
||||
default_days = 365
|
||||
default_crl_days = 30
|
||||
default_md = md5
|
||||
preserve = no
|
||||
policy = generic_policy
|
||||
[ generic_policy ]
|
||||
countryName = optional
|
||||
stateOrProvinceName = optional
|
||||
localityName = optional
|
||||
organizationName = optional
|
||||
organizationalUnitName = optional
|
||||
commonName = supplied
|
||||
emailAddress = optional
|
||||
EOF
|
||||
|
||||
echo '100001' &gt;ca/ca.db.serial
|
||||
touch ./ca/ca.db.index
|
||||
mkdir ./ca/ca.db.certs
|
||||
|
||||
openssl req -new -keyout mail.key -out mail.csr -days 9001
|
||||
openssl ca -config root.cnf -out mail.crt -infiles mail.csr
|
||||
openssl pkcs12 -export -inkey mail.key -certfile ca/root.crt -out mail.p12 -in mail.crt
|
||||
|
||||
smime_keys add_root ca/root.crt
|
||||
smime_keys add_cert ca/root.crt
|
||||
# add private certificate
|
||||
|
||||
</pre><br><h1> <a tiddlyfields="server.type:&quot;file&quot; server.host:&quot;file:///home/makefu/Downloads/knowledge_base.html&quot;" tiddlylink="offlineimap" refresh="link" target="_blank" title="External link to null#offlineimap" href="null#offlineimap" class="externalLink null">offlineimap</a></h1></description>
|
||||
<link>null#mutt</link>
|
||||
<pubDate>Mon, 18 Nov 2013 21:28:00 GMT</pubDate>
|
||||
|
||||
</item>
|
||||
<item>
|
||||
<title>swapdisk</title>
|
||||
<description><h1>create swap from file</h1><pre>truncate --size 8G /swapfile
|
||||
mkswap /swapfile
|
||||
swapon /swapon
|
||||
</pre><h2> /etc/fstab</h2><pre>echo "/swapfile none swap defaults 0 0" &gt;&gt; /etc/fstab
|
||||
</pre><h1>minimize swappiness</h1><pre>echo 0 &gt; /proc/sys/vm/swappiness
|
||||
</pre><br><h2> after reboot</h2>in <code>/etc/sysctl.conf</code><br><pre>vm.swappiness=1
|
||||
</pre></description>
|
||||
<link>null#swapdisk</link>
|
||||
<pubDate>Sun, 17 Nov 2013 23:30:00 GMT</pubDate>
|
||||
|
||||
</item>
|
||||
<item>
|
||||
<title>MainMenu</title>
|
||||
<description><a tiddlyfields="server.type:&quot;file&quot; server.host:&quot;file:///home/makefu/Downloads/knowledge_base.html&quot;" tiddlylink="GettingStarted" refresh="link" target="_blank" title="External link to null#GettingStarted" href="null#GettingStarted" class="externalLink null">GettingStarted</a><br><a tiddlyfields="server.type:&quot;file&quot; server.host:&quot;file:///home/makefu/Downloads/knowledge_base.html&quot;" tiddlylink="Security" refresh="link" target="_blank" title="External link to null#Security" href="null#Security" class="externalLink null">Security</a><br><a tiddlyfields="server.type:&quot;file&quot; server.host:&quot;file:///home/makefu/Downloads/knowledge_base.html&quot;" tiddlylink="Hardware" refresh="link" target="_blank" title="External link to null#Hardware" href="null#Hardware" class="externalLink null">Hardware</a><br><a tiddlyfields="server.type:&quot;file&quot; server.host:&quot;file:///home/makefu/Downloads/knowledge_base.html&quot;" tiddlylink="Programming" refresh="link" target="_blank" title="External link to null#Programming" href="null#Programming" class="externalLink null">Programming</a><br><a tiddlyfields="server.type:&quot;file&quot; server.host:&quot;file:///home/makefu/Downloads/knowledge_base.html&quot;" tiddlylink="Hacking" refresh="link" target="_blank" title="External link to null#Hacking" href="null#Hacking" class="externalLink null">Hacking</a><br><h1> Misc</h1><a tiddlyfields="server.type:&quot;file&quot; server.host:&quot;file:///home/makefu/Downloads/knowledge_base.html&quot;" tiddlylink="TODO" refresh="link" target="_blank" title="External link to null#TODO" href="null#TODO" class="externalLink null">TODO</a><br><a tiddlyfields="server.type:&quot;file&quot; server.host:&quot;file:///home/makefu/Downloads/knowledge_base.html&quot;" tiddlylink="Fun" refresh="link" target="_blank" title="External link to null#Fun" href="null#Fun" class="externalLink null">Fun</a><br><a target="_blank" title="External link to http://euer.krebsco.de/atom.xml" href="http://euer.krebsco.de/atom.xml" class="externalLink">RSS of this Blog</a><br></description>
|
||||
<link>null#MainMenu</link>
|
||||
<pubDate>Thu, 07 Nov 2013 14:12:00 GMT</pubDate>
|
||||
|
||||
</item>
|
||||
<item>
|
||||
<title>VPN</title>
|
||||
<description><h1> Default route via SSH</h1>see more <a target="_blank" title="External link to https://wiki.archlinux.org/index.php/VPN_over_SSH#OpenSSH.27s_built_in_tunneling" href="https://wiki.archlinux.org/index.php/VPN_over_SSH#OpenSSH.27s_built_in_tunneling" class="externalLink">https://wiki.archlinux.org/index.php/VPN_over_SSH#OpenSSH.27s_built_in_tunneling</a><br><h2> using pvpn</h2><h3> prepreqs</h3><pre>GNU/Linux
|
||||
OpenSSH
|
||||
pppd
|
||||
bash
|
||||
iproute2
|
||||
dnsutils (dig(1))
|
||||
asciidoc
|
||||
(make)
|
||||
(binutils)
|
||||
</pre><br><h3> server side</h3><pre>echo "PermitTunnel yes" &gt;&gt; /etc/ssh/sshd_config
|
||||
# deploy client pubkey for root
|
||||
echo "PermitRootLogin without-password" &gt;&gt; /etc/ssh/sshd_config
|
||||
echo "net.ipv4.ip_forward=1" &gt;&gt; /etc/sysctl.conf
|
||||
echo "iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE" &gt;&gt; /etc/rc.local
|
||||
</pre><h3> client side</h3><pre>yaourt -S pvpn
|
||||
ssh-copy-id root@host
|
||||
pvpn -t ssh-3 root@host default
|
||||
</pre></description>
|
||||
<link>null#VPN</link>
|
||||
<pubDate>Tue, 22 Oct 2013 22:28:00 GMT</pubDate>
|
||||
|
||||
</item>
|
||||
<item>
|
||||
<title>systemd</title>
|
||||
<description><h1> run shit in tmux</h1>in <code>/etc/systemd/system/start-shit.service</code><br><pre>[Unit]
|
||||
Description=start shit
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
RemainAfterExit=yes
|
||||
KillMode=none
|
||||
User=root
|
||||
ExecStart=/usr/bin/tmux new-session -s %u -d '&lt;my cool script&gt;'
|
||||
ExecStop=/usr/bin/tmux kill-session -t %u
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
</pre><h1> call rc.local</h1>in <code>/etc/systemd/system/rc-local.service</code><br><pre>[Unit]
|
||||
Description=/etc/rc.local Compatibility
|
||||
ConditionPathExists=/etc/rc.local
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/etc/rc.local start
|
||||
StandardOutput=tty
|
||||
RemainAfterExit=yes
|
||||
SysVStartPriority=99
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
</pre></description>
|
||||
<link>null#systemd</link>
|
||||
<pubDate>Tue, 22 Oct 2013 22:22:00 GMT</pubDate>
|
||||
|
||||
</item>
|
||||
<item>
|
||||
<title>File Systems</title>
|
||||
<description><h1> umount</h1><pre>fuser -amuv /path/to/mount
|
||||
kill dat-shit
|
||||
</pre><h1> umount nfs</h1><pre>umount -l /path/to/nfs
|
||||
</pre></description>
|
||||
<link>null#%5B%5BFile%20Systems%5D%5D</link>
|
||||
<pubDate>Tue, 22 Oct 2013 17:37:00 GMT</pubDate>
|
||||
|
||||
</item>
|
||||
<item>
|
||||
<title>/etc/network/interfaces</title>
|
||||
<description><h1>static network</h1><pre>auto eth1 # come up automatically
|
||||
iface et1 inet static
|
||||
address 192.168.0.24
|
||||
netmask 255.255.255.0
|
||||
# gateway 192.168.0.23
|
||||
</pre><h1> for wpa_supplicant</h1><pre>auto wlan0
|
||||
allow-hotplug wlan0
|
||||
iface wlan0 inet dhcp
|
||||
wpa-ssid meinessid
|
||||
wpa-psk meinpasswort
|
||||
</pre></description>
|
||||
<category>network</category>
|
||||
<link>null#%2Fetc%2Fnetwork%2Finterfaces</link>
|
||||
<pubDate>Wed, 16 Oct 2013 23:54:00 GMT</pubDate>
|
||||
|
||||
</item>
|
||||
<item>
|
||||
<title>solaris</title>
|
||||
<description><h1> gnu alternatives</h1><h2> readlink -f</h2><pre>canonicalpath() {
|
||||
if [ -d $1 ]; then
|
||||
pushd $1 &gt; /dev/null 2&gt;&amp;1
|
||||
echo $PWD
|
||||
elif [ -f $1 ]; then
|
||||
pushd $(dirname $1) &gt; /dev/null 2&gt;&amp;1
|
||||
echo $PWD/$(basename $1)
|
||||
else
|
||||
echo "Invalid path $1"
|
||||
fi
|
||||
popd &gt; /dev/null 2&gt;&amp;1
|
||||
}
|
||||
</pre><pre>canonicalize(){
|
||||
cd -P -- "$(dirname -- "$1")" &amp;&amp;
|
||||
printf '%s\n' "$(pwd -P)/$(basename -- "$1")"
|
||||
}
|
||||
</pre><h2> mount -o bind</h2><pre>mount -F lofs DIR1 DIR2
|
||||
</pre></description>
|
||||
<link>null#solaris</link>
|
||||
<pubDate>Wed, 16 Oct 2013 10:59:00 GMT</pubDate>
|
||||
|
||||
</item>
|
||||
<item>
|
||||
<title>Python Advanced</title>
|
||||
<description><h1> Python for the user</h1>in ~/.profile <br><pre>export PYTHONPATH=~/.local/lib/python2.7/site-packages
|
||||
export PATH=$PATH:~/.local/lbin
|
||||
</pre>then do<br><pre>pip install --user &lt;stuff&gt;
|
||||
</pre><h1> Interactive Shell</h1><h2> Activate Tab Completion</h2><pre>import rlcompleter,readline;readline.parse_and_bind("tab: complete")
|
||||
</pre><h1> Single file Python</h1><h2> py2zip</h2>from <a target="_blank" title="External link to http://people.canonical.com/~roman.yepishev/us/src/" href="http://people.canonical.com/~roman.yepishev/us/src/" class="externalLink">http://people.canonical.com/~roman.yepishev/us/src/</a><br><pre>#!/bin/bash
|
||||
|
||||
ORIG_PWD=$PWD
|
||||
|
||||
set -ex
|
||||
|
||||
TARGET="$1"
|
||||
TARGET_BASENAME=`basename "$TARGET"`
|
||||
shift
|
||||
|
||||
MAIN=$1
|
||||
shift
|
||||
|
||||
FILES="$*"
|
||||
TEMPDIR=`mktemp -d /tmp/XXXXXXXX`
|
||||
|
||||
cp "$MAIN" "$TEMPDIR/__main__.py"
|
||||
cp --parents -r $FILES "$TEMPDIR/"
|
||||
|
||||
cd "$TEMPDIR"
|
||||
zip -q -r build.zip *
|
||||
cd "$ORIG_PWD"
|
||||
echo "#!/usr/bin/python" &gt; "$TEMPDIR/build.header"
|
||||
cat "$TEMPDIR/build.header" "$TEMPDIR/build.zip" &gt; "$TEMPDIR/$TARGET_BASENAME"
|
||||
chmod +x "$TEMPDIR/$TARGET_BASENAME"
|
||||
mv "$TEMPDIR/$TARGET_BASENAME" $TARGET
|
||||
</pre><br><h1>Conditionals</h1><pre>&gt;&gt;&gt; x = 5
|
||||
&gt;&gt;&gt; 1 &lt; x &lt; 10
|
||||
True
|
||||
&gt;&gt;&gt; 10 &lt; x &lt; 20
|
||||
False
|
||||
&gt;&gt;&gt; x &lt; 10 &lt; x*10 &lt; 100
|
||||
True
|
||||
&gt;&gt;&gt; 10 &gt; x &lt;= 9
|
||||
True
|
||||
&gt;&gt;&gt; 5 == x &gt; 4
|
||||
True
|
||||
</pre><h1>Random</h1><pre>from random import random
|
||||
seed() # which seed to use
|
||||
randint(a,b) # int between a and b
|
||||
randrange(start,stop,step) # like choice(range(start,stop,step))
|
||||
hoice(seq) # random choice from sequence
|
||||
shuffle(x) # shuffles sequence
|
||||
sample(seq,num) # choose num samples
|
||||
uniform() # float between a and b
|
||||
</pre><h1>Decorators</h1><pre>
|
||||
def print_args(function):
|
||||
def wrapper(*args, **kwargs):
|
||||
print 'Arguments:', args, kwargs
|
||||
return function(*args, **kwargs)
|
||||
return wrapper
|
||||
|
||||
@print_args
|
||||
def write(text):
|
||||
print text
|
||||
|
||||
&gt;&gt;&gt; write('foo')
|
||||
Arguments: ('foo',){}
|
||||
foo
|
||||
</pre><h1>Advanced Regexes</h1><pre>re.compile("^\[font(?:=(?P&lt;size&gt;[-+][0-9]{1,2}))?\](.*?)[/font]",
|
||||
re.DEBUG)
|
||||
</pre></description>
|
||||
<link>null#%5B%5BPython%20Advanced%5D%5D</link>
|
||||
<pubDate>Fri, 11 Oct 2013 10:00:00 GMT</pubDate>
|
||||
|
||||
</item>
|
||||
</channel>
|
||||
</rss>
|
Loading…
Reference in a new issue