This is a quick guide to mounting a qcow2 disk images on your host server. This is useful to reset passwords, edit files, or recover something without the virtual machine running.
Step 1 - Enable NBD on the Host
modprobe nbd max_part=8
SELECT user, pid, client_addr, waiting, query, query_start, NOW() - query_start AS elapsed | |
FROM pg_stat_activity | |
WHERE query != '<IDLE>' | |
-- AND EXTRACT(EPOCH FROM (NOW() - query_start)) > 1 | |
ORDER BY elapsed DESC; |
# Set pid of nginx master process here | |
pid=8192 | |
# generate gdb commands from the process's memory mappings using awk | |
cat /proc/$pid/maps | awk '$6 !~ "^/" {split ($1,addrs,"-"); print "dump memory mem_" addrs[1] " 0x" addrs[1] " 0x" addrs[2] ;}END{print "quit"}' > gdb-commands | |
# use gdb with the -x option to dump these memory regions to mem_* files | |
gdb -p $pid -x gdb-commands | |
# look for some (any) nginx.conf text |
func ip2int(ip net.IP) uint32 { | |
if len(ip) == 16 { | |
return binary.BigEndian.Uint32(ip[12:16]) | |
} | |
return binary.BigEndian.Uint32(ip) | |
} | |
func int2ip(nn uint32) net.IP { | |
ip := make(net.IP, 4) | |
binary.BigEndian.PutUint32(ip, nn) |
_log_pskb(date_created,link_id,logname,log) | |
account(id,uid,sum) | |
account_attach(account_id,file_id,name,orig_name) | |
account_transaction(user_id,yd) | |
activate_service(code,email,data) | |
admin_log_users(user_id,log_id,last_comment_view) | |
annoy(ip,last_req) | |
articles(title,short,msgtext,sign,logo,link) | |
articles_comments(from_id,parent_id,from_ip,created_time,article_id,msgtext,youtube_link) | |
articles_comments_files(comment_id,file_id,small,inline,temp) |
nadeem@myznc:~/go/src$ ls -al dummy | |
total 12 | |
drwxrwxr-x 2 nadeem nadeem 4096 Jul 20 18:46 . | |
drwxrwxr-x 6 nadeem nadeem 4096 Jul 20 18:45 .. | |
-rw-rw-r-- 1 nadeem nadeem 129 Jul 20 18:46 hello.go | |
nadeem@myznc:~/go/src/dummy$ cat hello.go | |
// Package dummy contains hello world library. | |
package dummy |
#### CentOS: yum install pip ; pip install linode-python ; pip install chube | |
#### | |
- hosts: localhost | |
connection: local | |
gather_facts: false | |
tasks: | |
- name: Create linode server | |
linode: | |
api_key: '---LINODE-API-KEY-HERE---' |
sudo yum install -y pam-devel | |
sudo yum install -y rpm-build | |
sudo yum install -y zlib-devel | |
mkdir -p ~/rpmbuild/SOURCES | |
cd ~/rpmbuild/SOURCES | |
wget -c http://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-6.7p1.tar.gz | |
wget -c http://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-6.7p1.tar.gz.asc | |
# verify the file | |
# update the pam ssd from the one included on the system |
http { | |
log_format bodylog '$remote_addr - $remote_user [$time_local] ' | |
'"$request" $status $body_bytes_sent ' | |
'"$http_referer" "$http_user_agent" $request_time ' | |
'<"$request_body" >"$resp_body"'; | |
lua_need_request_body on; | |
set $resp_body ""; | |
body_filter_by_lua ' |
# | |
# Name: nginx-tls.conf | |
# Auth: Gavin Lloyd <[email protected]> | |
# Desc: Nginx SSL/TLS configuration for "A+" Qualys SSL Labs rating | |
# | |
# Enables HTTP/2, PFS, HSTS and OCSP stapling. Configuration options not related | |
# to SSL/TLS are not included here. | |
# | |
# Additional tips: | |
# |