2016-01-01から1年間の記事一覧

sshuttle でssh使って簡単vpn

ssh

https://github.com/apenwarr/sshuttle ポートフォワードだと個別にport設定したり、 ブラウザのプロキシ設定いじらないとダメだけど sshuttle の場合、iptables(macだとpfctl ?)で特定のnetwork宛の通信を ssh経由にねじまげてくれるのでvpnのように使える…

VMWareの仮想マシンのdiskを縮小してpartitionを削除する

https://www.experts-exchange.com/articles/12938/HOW-TO-Shrink-a-VMware-Virtual-Machine-Disk-VMDK-in-15-minutes.htmlvCenterからいじっただけでは縮小されないので。 linux VMの対応。N GBからM GBに縮小する例。 1. 削除するpartitionをumountしてfst…

共用サーバの接続制限で良さげなapache module - mod_vhost_maxclients

ペパボの中の人さまさま。 https://speakerdeck.com/matsumoto_r/virtualhosting-security-performance-operasion http://hb.matsumoto-r.jp/entry/2015/08/29/151920 https://github.com/matsumoto-r/mod_vhost_maxclients virtualhostごとに同時アクセス数…

SSLアクセラレータ(reverse proxy)配下のnginxのcache_key

SSLアクセラレータ配下のnginxで http、httpsで個別のキャッシュにしたいときに、 この設定をいれると、一見$schemeでhttp/httpsに振り分けられて 出来そうに見えますが、このままだと同じキャッシュになります。 proxy_cache_key "$scheme://$host$request_…

SSLアクセラレータ(reverse proxy)配下のnginxで"/"なしのディレクトリにアクセスされたときのredirect

hogem.hatenablog.comだいぶ前のだけど。どうしてもSSLのままredirectさせたい場合の解決方法。やや強引だけど。-dでrequestがdirectoryに来て、かつ "/"がない場合はrewriteしてhttpsに飛ばす設定 if (-d $request_filename) { rewrite ^/(.*[^/])$ https:/…

big-ip ipv6 nat memo

VirtualServerにipv6 Poolにはipv4で作成したものを割り当てた場合、 通信失敗にはならなくて、自動的にbig-ipのv4のaddressでnatされてserverに送信される (snat automapしたときと同じ)

big-ip virtualserverに適用しているdefaultのSNIを入れ替える

やや面倒?clientssl-foo: foo.example.com sni default clientssl-bar: bar.example.com これを virtualserver example.com-httpsに適用している状態で bar.example.com をsniのdefaultにしたい前提: virtualserverに設定する段階では 複数のclient sslprof…

abとh2load の違い

ubuntu 14 LTS abはOSのapt h2loadは公式のsourceから取ってきたもの。 serverはHTTP/2対応ではなくて、HTTP/1.0、HTTP/1.1対応のserverで実験 abはHTTP/1.0で接続 keepaliveなし "Connection: close" よってnginxのdefaultだと圧縮されない - http://nginx.…

http benchmark ツール h2load

nghttp2 に含まれるh2load が便利らしい http://hb.matsumoto-r.jp/entry/2016/01/14/114048 https://nghttp2.org/ https://github.com/nghttp2/nghttp2 https://nghttp2.org/documentation/h2load-howto.html gitからとってきてコンパイルする。 libev、lib…

Big-IPでsorry serverにredirectする

poolが全滅、あるいはconnectioin limitにひっかかった場合にsorryサーバにリダイレクトさせたい場合。 connection limit入れたい場合 sorryサーバにリダイレクトしたい時に接続数制限をする場合はPoolのconnection limitを設定する。VirtualServerでConnect…

linuxでVMwareのvmdkイメージをmountする話

ストレージの機能で仮想マシンのイメージをsnapshotでとっていても、 実際にそのvmdkから特定のファイルを復旧する場合は、 そのsnapshotのファイルをコピーしてインベントリに登録、、、などまあまあ面倒。 だったらいっそのことvmdkを直接mountしたらええ…

RedHat/CentOS のphp/curlでGMO決済にsslで蹴られる現象の対応

GMO側がPCI DSS対応でTLS 1.2のみでの接続となってる。で、CentOS6でcurlで接続すると、 rpmでinstallされているcurl/opensslはtls 1.2に対応しているにも関わらずSSL Connect Errorで弾かれる。 (正確にはcurl直叩きではなくてphpから呼び出すcurl)curl-7.1…

stunnel でtlsで鍵認証をした上でsshする

http://qiita.com/albatross/items/390bf14db8b57c5a42f4 ずばり探し求めてたの発見。wifiなどでoutboundが80,443だけに制限されている場合、 aws上のサーバなどにsshが出来ない。てっとり早い対応はsshのportを443に変えてしまう。 sshdの設定で鍵認証だけ…

rsyncはdefaultでcopy時にsparse fileを作らない

ということを知った。 cpは元がsparse fileならcopy先もsparseになるから rsyncもそうだと思ってたけど違った。 rsyncは-S(--sparse) を指定しない場合はdefaultでsparseにしない。

古いlinux(fedora core、centos)をp2vする

mdadmを使っているためvmware converterが使えなくて、ssh+tarでp2vする場合の注意点。参考: http://hogem.hatenablog.com/entry/2016/02/12/233000 inode size 移行先の仮想マシンで何も考えずにmkfsしてinode sizeが256になっていると、 移行元のgrubのバ…

ansibleで牛がしゃべるようになってた

久々に触ったら突然牛が出てきてうけた。 正確にいうとansibleは何も変わってなくて、サーバにcowsayがinstallされたからだった。 _____________ < PLAY [hoge] > ------------- \ ^__^ \ (oo)\_______ (__)\ )\/\ ||----w | || || https://support.ansible.…

syslogで受けとったメッセージをアプリケーションで直接読む

久々の更新。 man 5 rsyslog.conf Named pipes This version of rsyslogd(8) has support for logging output to named pipes (fifos). A fifo or named pipe can be used as a destination for log messages by prepending a pipe symbol (’|’) to the name…

big-ip apm IP Geolocation Match memo

EndPoint Security (Server-Side) - IP Geolocation Match手動で記述する場合こんなん expr { [mcget {session.user.ipgeolocation.country_code}] == "JP" || [mcget {session.user.ipgeolocation.country_code}] == "US"

BIG-IP IP Geolocationで地域判別

AFMやAPMで許可する場合にipではなく地域を使ってアクセス許可/拒否したいときにgeolocation使うけど、Databaseが古いと想定外の地域で判定されてしまう。どやって判定してるねん?と調べて辿り着いたのがここ https://support.f5.com/kb/en-us/solutions/pu…

VMware vCenter Converter Standalone でconvert出来ないsoftware raid(mdadm)のlinuxをddかssh+tarでP2Vする

タイトルの通りvcenter converterではmdadmをsupportしてないのでdeviceを見つけられず、p2v出来ない。 例えば/bootが見つけられなくてエラーが出るなどで。 There is no '/boot' directory mounted on the source machine. It is required to create a boot…

big-ip APMのセッション数 取得

GUI Access Policy - Manage Sessions SNMP https://support.f5.com/kb/en-us/solutions/public/15000/000/sol15032.html 1.3.6.1.4.1.3375.2.6.1.4.3.0 F5-BIGIP-APM-MIB::apmAccessStatCurrentActiveSessions.0 = Counter64: 16ただ、手元の環境だとGUIのM…

big-ip ltm current connectionをsnmpで取る

昔諦めた気がしたけど、snmpwalk一覧眺めたらあっさり解決した。 virtualserver F5-BIGIP-LOCAL-MIB::ltmVirtualServStatClientCurConns .1.3.6.1.4.1.3375.2.2.10.2.3.1.12 pool F5-BIGIP-LOCAL-MIB::ltmPoolStatServerCurConns .1.3.6.1.4.1.3375.2.2.5.2.…

nginxでproxy_cacheしてもcacheされない条件

http://nginx.org/en/docs/http/ngx_http_proxy_module.html backendサーバからExpires、Cache-Controlなど特定のheaderが返ってくるとcacheされない。 Disables processing of certain response header fields from the proxied server. The following fiel…

big-ip persistence match acrossメモ

virtualserverを跨って同一のnodeに振り分けたいときのpersistenceのoption cookieでmatch acrossする場合はbig-ipが発行するinsert cookieは使えない。 cookie hashが必要(webアプリケーション側で発行するcookie名を指定) Cookie Nameは PHPSESSIDなど。ア…