'Programming > ffmpeg' 카테고리의 다른 글
ffplay.c (0) | 2017.03.06 |
---|---|
ffmpeg 예제 소스 분석 (0) | 2017.02.10 |
ffmpeg - vlc cache 설정관련 (0) | 2017.02.10 |
ffmpeg + opengl (0) | 2017.02.09 |
ffmpeg / ffplay 딜레이 관련 분석 (0) | 2017.02.09 |
ffplay.c (0) | 2017.03.06 |
---|---|
ffmpeg 예제 소스 분석 (0) | 2017.02.10 |
ffmpeg - vlc cache 설정관련 (0) | 2017.02.10 |
ffmpeg + opengl (0) | 2017.02.09 |
ffmpeg / ffplay 딜레이 관련 분석 (0) | 2017.02.09 |
도대체 vlc의 :network-caching 설정은 어디를 적용하는거야?!?!?
일단 구조적으로
rtsp 쪽 네트워크 버퍼
ffmpeg avcodec decoder쪽 버퍼
sdl등의 비디오 버퍼
버퍼만 해도 세개인데 어느녀석을 건드려야 레이턴시가 줄어들까?
[링크 : https://wiki.videolan.org/..HowTo/Advanced_Streaming_Using_the_Command_Line/]
[링크 : http://stackoverflow.com/.../which-functions-of-live555-is-used-in-vlc-for-network-caching-option]
ffmpeg 예제 소스 분석 (0) | 2017.02.10 |
---|---|
ffmpeg 3.2 소스관련 (0) | 2017.02.10 |
ffmpeg + opengl (0) | 2017.02.09 |
ffmpeg / ffplay 딜레이 관련 분석 (0) | 2017.02.09 |
ffmpeg 예제 (sdl / live555) (0) | 2017.02.06 |
[링크 : http://aslike.egloos.com/category/└%20FFMPEG] // 연재 중단으로 openGL 관련내용 x
[링크 : http://sijoo.tistory.com/82]
ffmpeg 예제 소스 분석 (0) | 2017.02.10 |
---|---|
ffmpeg 3.2 소스관련 (0) | 2017.02.10 |
ffmpeg - vlc cache 설정관련 (0) | 2017.02.10 |
ffmpeg / ffplay 딜레이 관련 분석 (0) | 2017.02.09 |
ffmpeg 예제 (sdl / live555) (0) | 2017.02.06 |
sdl 이라는 녀석으로 한번 해봐야 하려나..
윈도우에서는 DirectDraw를 쓴다고 하니 일단 Platformsdk 안깔아도 되서 편할듯
[링크 : http://prog3.com/sbdm/blog/hjl240/article/details/47857175] sdl + mfc
[링크 : http://dranger.com/ffmpeg/] // ffmpeg + sdl + mfc
sdl tutorial (0) | 2022.05.27 |
---|---|
SDL - Simple DirectMedia Layer (0) | 2021.07.06 |
SDL - Simple DirectMedia Layer (0) | 2011.12.12 |
vlc 에서 rtsp 추가 옵션을 보면
캐쉬로 기본 1000ms 가 설정되는데 이걸 어디서 설정하나 검색중..
ffplay의 max_delay?
ffplay -max_delay 500000 -rtsp_transport udp -v trace "rtsp://user:pass@CamIP:Port/URL" |
[링크 : https://github.com/ZoneMinder/ZoneMinder/issues/811]
-max_delay <int> ED... maximum muxing or demuxing delay in microseconds |
다시 읽어 보니.. 레이턴시에 영향을 주긴 하지만.. TCP에는 적용사항이 없고
UDP에서 패킷 재조합시간에 대한 내용이라 일단 패스~
When receiving data over UDP, the demuxer tries to reorder received packets (since they may arrive out of order, or packets may get lost totally). This can be disabled by setting the maximum demuxing delay to zero (via the max_delay field of AVFormatContext). |
[링크 : https://ffmpeg.org/ffmpeg-protocols.html#rtsp]
[링크 : https://ffmpeg.org/doxygen/2.7/structAVFormatContext.html#a58422ed3d461b3440a15cf057ac5f5b7]
AVFormatContext의 buffer_size
cache 버퍼 크기
av_dict_set(&options, "buffer_size", "655360", 0); |
[링크 : http://stackoverflow.com/questions/29075467/set-rtsp-udp-buffer-size-in-ffmpeg-libav]
[링크 : https://git.libav.org/?p=libav.git;a=commit;h=e3ec6fe7bb2a622a863e3912181717a659eb1bad] commit log
[링크 : https://git.libav.org/?p=libav.git;a=blob;f=libavformat/rtsp.c;h...d] rtsp whole source
[링크 : https://git.libav.org/?p=libav.git;a=blobdiff;f=libavformat/rtsp.c;h...f] diff
1547 AVDictionary *metadata;
[링크 : https://ffmpeg.org/doxygen/trunk/avformat_8h_source.html#l01331] AVFormatContext structure
int av_dict_set (AVDictionary ** pm, const char * key, const char * value, int flags ) |
[링크 : https://www.ffmpeg.org/doxygen/2.7/group__lavu__dict.html#ga8d9c2de72b310cef8e6a28c9cd3acbbe]
AVCodecContext의 rc_buffer_size
int AVCodecContext::rc_buffer_size decoder bitstream buffer size encoding: Set by user. decoding: unused Definition at line 2291 of file avcodec.h. |
[링크 : https://www.ffmpeg.org/doxygen/2.5/structAVCodecContext.html#a15000607a7e2371162348bb35b0184c1]
일단... 두개 옵션을 줘서 어느 구간에서 지연시간들이 생기는지 검사할 수 있는 듯?
Also setting -probesize and -analyzeduration to low values may help your stream start up more quickly (it uses these to scan for "streams" in certain muxers, like ts, where some can appears "later", and also to estimate the duration, which, for live streams, the latter you don't need anyway). This should be unneeded by dshow input. |
ffmpeg 예제 소스 분석 (0) | 2017.02.10 |
---|---|
ffmpeg 3.2 소스관련 (0) | 2017.02.10 |
ffmpeg - vlc cache 설정관련 (0) | 2017.02.10 |
ffmpeg + opengl (0) | 2017.02.09 |
ffmpeg 예제 (sdl / live555) (0) | 2017.02.06 |
auth.log에서 정규표현식으로 아이피 빼내니 편하긴 하네
공부해봐야지 ㅠㅠ
.*?((?:\d{1,3}\.){3}\d{1,3})|.+
$1
[링크 : http://stackoverflow.com/questions/23707270/notepad-keep-only-ip-addresses]
notepad++ XML 인덴트 적용하기 (0) | 2017.07.26 |
---|---|
notepad++ ascii만 검색하기 (0) | 2017.06.15 |
notepad++ 접은 라인 빼고 복사하기 (0) | 2016.10.25 |
notepad++ timestamp 찍기 (0) | 2016.08.10 |
notepad++ 플러그인(ctags/vi) (0) | 2015.01.08 |
밴하고 있을 시간을 -1로 하면 영구 차단이라고 한다.
bantime = -1
[링크 : http://serverfault.com/questions/415040/permanent-block-of-ip-after-n-retries-using-fail2ban]
그런데 fail2ban 설정을 바꾼다고 재시작 해버리니 밴이 풀리네?!
그걸 유지할 방법이 없을려나
192.168.0.xxx 이런식으로 대역을 전체 막는 방법
$ vi /etc/fail2ban/jail.conf banaction = iptables-multiport |
$ vi /etc/fail2ban/action.d/iptables-multiport.conf actionban = iptables -I fail2ban-<name> 1 -s <ip>/24 -j <blocktype> actionunban = iptables -D fail2ban-<name> -s <ip>/24 -j <blocktype> |
$ man iptables [!] -s, --source address[/mask][,...] Source specification. Address can be either a network name, a hostname, a network IP address (with /mask), or a plain IP address. Hostnames will be resolved once only, before the rule is submitted to the kernel. Please note that specifying any name to be resolved with a remote query such as DNS is a really bad idea. The mask can be either an ipv4 network mask (for iptables) or a plain number, specifying the number of 1's at the left side of the network mask. Thus, an iptables mask of 24 is equivalent to 255.255.255.0. A "!" argument before the address specification inverts the sense of the address. The flag --src is an alias for this option. Multiple addresses can be specified, but this will expand to multiple rules (when adding with -A), or will cause multiple rules to be deleted (with -D). |
[링크 : https://www.righter.ch/index.php/2014/12/10/block-a-whole-ip-range-with-fail2ban/]
블랙리스트 파일
[링크 : http://looke.ch/wp/list-based-permanent-bans-with-fail2ban]
수동 ban
$ fail2ban-client set <JAIL> banip <IP> manually Ban <IP> for <JAIL> set <JAIL> unbanip <IP> manually Unban <IP> in <JAIL> |
하나만 차단하기
$ sudo fail2ban-client set ssh banip 221.194.44.252 |
대역 차단하기
$ sudo fail2ban-client set ssh banip 221.194.44.252/24 |
$ sudo iptables -L Chain fail2ban-ssh (1 references) target prot opt source destination REJECT all -- 221.194.44.0/24 anywhere reject-with icmp-port-unreachable REJECT all -- 221.194.44.252 anywhere reject-with icmp-port-unreachable RETURN all -- anywhere anywhere |
[링크 : https://www.howtoforge.com/community/threads/how-to-manually-unban-ip-blocked-by-fail2ban.51366/]
fail2ban ssh 차단 실패??? (0) | 2017.03.06 |
---|---|
fail2ban phpmyadmin (0) | 2017.02.28 |
fail2ban 재시작을 위한 차단목록 추가? (0) | 2017.02.15 |
ssh 로그인 보안 - fail2ban (4) | 2017.02.08 |
apache ip deny (0) | 2017.02.08 |
간단하게 요약하면..
이번 로그 파일을 합치고
/etc/webalizer/webalizer.conf를 복사해서
새로운 설정파일을 만든 후
아래와 같이 설정파일을 지정해서(-c) 돌리는 방법이라고 해야하나?
$ sudo webalizer -c /etc/webalizer/webalizer.conf.old |
[링크 : http://www.pc-freak.net/blog/linux-generating-web-statistics-apache-logs-webalizer/]
실험을 해보니.. incremental이나 history 적용하니
옛날 버전이 되지 않아서, 두개 설정 데이터를 지우거나 구버전 설정파일에서는 해당 기능을 꺼야
이전 버전들이 새로 생성된다.
webalizer에서 로그가 공유기 아이피로 찍힐때.. (0) | 2019.02.26 |
---|---|
webalizer 와 logrotate를 위한 설정? (0) | 2017.03.21 |
webalizer 위치정보 조회(geodb) (0) | 2017.02.08 |
webalizer 정리 (0) | 2017.01.05 |
webalizer 설치하기 + 한글문제 (2) | 2010.11.14 |
webalizer 보다가 웬지 불안해서 ssh 로그인 내역을 찾는다고
/var/log/auth.log* 파일을 보는데.. 일단은 5회 실패시 자동 접속 종료니까 그걸 기준으로 검색해보니
하루 한번씩은 꼭 누군가가 시도를 했네 -_-
$ grep "PAM 5 more authentication" /var/log/auth.log* |
혹시나 해서 로그인 실패로 뒤져보니.. 헉... -_-
$ grep "Failed password for" /var/log/auth.log* |
시도하다 실패한 아이디 목록
[링크 : http://serverfault.com/questions/130482/how-to-check-sshd-log]
root 로그인 자체를 막는 방법. 인증에서 거부하지 root 로그인 시도를 거부하진 않는다.
$ sudo vi /etc/ssh/sshd_config
28 #PermitRootLogin without-password
29 PermitRootLogin no
30 DenyUsers root
[링크 : https://mediatemple.net/community/products/dv/204643810/how-do-i-disable-ssh-login-for-the-root-user]
[링크 : http://askubuntu.com/questions/27559/how-do-i-disable-remote-ssh-login-as-root-from-a-server]
[링크 : http://superuser.com/questions/478341/automatically-deny-hacking-attempts-in-centos]
아무튼 검색을 해보니. fail2ban 이라는 패키지가 있나 보다.
[링크 : http://askubuntu.com/questions/178016/how-do-i-keep-track-of-failed-ssh-log-in-attempts]
[링크 : http://superuser.com/questions/476231/ban-ip-on-multiple-faild-ssh-login-attempts]
$ sudo apt-cache search fail2ban fail2ban - ban hosts that cause multiple authentication errors |
설치는 항상 그렇듯 아래 복붙하면되고
$ sudo apt-get install fail2ban |
차단할 녀석들 찾으려고 로그를 보니
그리고 로그인 시도가 2~3초 간격으로 시도를 하는데 기본 ssh가 5번 까지 허용을 해주는 것 같은데
일부 한두번만 시도하고 도망가는 놈들까지 잡으려다가는 내가 오타내서 로그인 못하다가 잡힐수도 있으니
이거 참 고민이네 -_-
auth.log.1:Jan 23 10:50:45 raspberrypi sshd[2616]: Failed password for invalid user gopher from 106.247.230.226 port 39683 ssh2 auth.log.1:Jan 23 10:50:47 raspberrypi sshd[2616]: Failed password for invalid user gopher from 106.247.230.226 port 39683 ssh2 auth.log.1:Jan 23 10:52:14 raspberrypi sshd[2622]: Failed password for invalid user nfsnobody from 106.247.230.226 port 49373 ssh2 auth.log.1:Jan 23 10:52:16 raspberrypi sshd[2622]: Failed password for invalid user nfsnobody from 106.247.230.226 port 49373 ssh2 auth.log.1:Jan 23 10:52:18 raspberrypi sshd[2622]: Failed password for invalid user nfsnobody from 106.247.230.226 port 49373 ssh2 auth.log.1:Jan 23 10:52:58 raspberrypi sshd[2629]: Failed password for games from 106.247.230.226 port 49461 ssh2 auth.log.1:Jan 23 10:53:00 raspberrypi sshd[2629]: Failed password for games from 106.247.230.226 port 49461 ssh2 auth.log.1:Jan 23 10:53:02 raspberrypi sshd[2629]: Failed password for games from 106.247.230.226 port 49461 ssh2 auth.log.1:Jan 23 10:55:12 raspberrypi sshd[2638]: Failed password for invalid user teamspeak2 from 106.247.230.226 port 52864 ssh2 auth.log.1:Jan 23 10:55:15 raspberrypi sshd[2638]: Failed password for invalid user teamspeak2 from 106.247.230.226 port 52864 ssh2 auth.log.1:Jan 23 10:56:38 raspberrypi sshd[2647]: Failed password for invalid user teamspeak2 from 106.247.230.226 port 50460 ssh2 auth.log.1:Jan 23 10:57:21 raspberrypi sshd[2653]: Failed password for invalid user ts4 from 106.247.230.226 port 60900 ssh2 auth.log.1:Jan 23 11:00:14 raspberrypi sshd[2662]: Failed password for invalid user offline from 106.247.230.226 port 54433 ssh2 auth.log.1:Jan 23 11:00:56 raspberrypi sshd[2668]: Failed password for invalid user webdesign from 106.247.230.226 port 52505 ssh2 auth.log.1:Jan 23 11:02:19 raspberrypi sshd[2673]: Failed password for invalid user reddragon from 106.247.230.226 port 56955 ssh2 |
설정은 집에서는 차단 안되도록 사용하는 아이피 대역을 추가해 주었고(lg u+ 공유기라 그런가?)
한번 걸리면 차단 시간 30일(60초*60분*24시간*30일)로 일단 설정해 주었다.
그리고 차단할 녀석을 찾는 시간은 1분내 5번 실패하는 녀석! 너무 좁혀놨을려나?
$ sudo vi /etc/fail2ban/jail.conf [DEFAULT] ignoreip = 127.0.0.1/8 192.168.219.1/24 ignorecommand = bantime = 2592000 findtime = 60 maxretry = 5 [ssh] enabled = true port = ssh filter = sshd logpath = /var/log/auth.log maxretry = 5 [apache] enabled = false port = http,https filter = apache-auth logpath = /var/log/apache*/*error.log maxretry = 5 |
[링크 : https://blog.lael.be/post/1209]
[링크 : https://www.conory.com/note_linux/11720]
일단 자고 나면 내일 한마리(!) 정도는 낚여 있을려나?
+
175.224.0.0/11 대역은 KT wibro 일려나?
+
2017.02.09
아싸 하나 낚았고 ㅋㅋㅋ
$ sudo iptables -L Chain INPUT (policy ACCEPT) target prot opt source destination fail2ban-ssh tcp -- anywhere anywhere multiport dports ssh Chain FORWARD (policy ACCEPT) target prot opt source destination Chain OUTPUT (policy ACCEPT) target prot opt source destination Chain fail2ban-ssh (1 references) target prot opt source destination REJECT all -- 221.194.44.252 anywhere reject-with icmp-port-unreachable RETURN all -- anywhere anywhere |
Feb 9 04:48:52 raspberrypi sshd[3342]: Invalid user admin from 221.194.44.252 Feb 9 04:48:52 raspberrypi sshd[3342]: input_userauth_request: invalid user admin [preauth] Feb 9 04:48:52 raspberrypi sshd[3342]: pam_unix(sshd:auth): check pass; user unknown Feb 9 04:48:52 raspberrypi sshd[3342]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=221.194.44.252 Feb 9 04:48:53 raspberrypi sshd[3342]: Failed password for invalid user admin from 221.194.44.252 port 2815 ssh2 Feb 9 04:48:53 raspberrypi sshd[3342]: pam_unix(sshd:auth): check pass; user unknown Feb 9 04:48:55 raspberrypi sshd[3342]: Failed password for invalid user admin from 221.194.44.252 port 2815 ssh2 Feb 9 04:48:55 raspberrypi sshd[3342]: pam_unix(sshd:auth): check pass; user unknown Feb 9 04:48:57 raspberrypi sshd[3342]: Failed password for invalid user admin from 221.194.44.252 port 2815 ssh2 Feb 9 04:48:57 raspberrypi sshd[3342]: pam_unix(sshd:auth): check pass; user unknown Feb 9 04:48:59 raspberrypi sshd[3342]: Failed password for invalid user admin from 221.194.44.252 port 2815 ssh2 Feb 9 04:48:59 raspberrypi sshd[3342]: pam_unix(sshd:auth): check pass; user unknown Feb 9 04:49:01 raspberrypi sshd[3342]: Failed password for invalid user admin from 221.194.44.252 port 2815 ssh2 Feb 9 04:49:01 raspberrypi sshd[3342]: fatal: Read from socket failed: Connection reset by peer [preauth] Feb 9 04:49:01 raspberrypi sshd[3342]: PAM 4 more authentication failures; logname= uid=0 euid=0 tty=ssh ruser= rhost=221.194.44.252 Feb 9 04:49:01 raspberrypi sshd[3342]: PAM service(sshd) ignoring max retries; 5 > 3 |
아파치 까지 적용하고 서비스 재시작했더니 밴이 풀려버리네?!?!
2017-02-09 04:49:01,756 fail2ban.actions[31809]: WARNING [ssh] Ban 221.194.44.252 2017-02-09 08:50:18,961 fail2ban.server [31809]: INFO Stopping all jails 2017-02-09 08:50:19,255 fail2ban.actions[31809]: WARNING [ssh] Unban 221.194.44.252 |
fail2ban ssh 차단 실패??? (0) | 2017.03.06 |
---|---|
fail2ban phpmyadmin (0) | 2017.02.28 |
fail2ban 재시작을 위한 차단목록 추가? (0) | 2017.02.15 |
fail2ban 차단 관련... (0) | 2017.02.09 |
apache ip deny (0) | 2017.02.08 |
webalizer를 보다 보니 이상한 접속이 보여서 차단할 방법 찾는중
그런데.. 이건 자동화 된거 없나? 일일이 apache.conf 손대고 apache를 재시작 하긴 좀 그런데...
<Directory /var/www/> Options FollowSymLinks MultiViews AllowOverride None Order deny,allow Allow from xxx.xxx.xxx.xxx Allow from xxx.xxx.xxx.xxx Allow from xxx.xxx.xxx.xxx Deny from all </Directory> |
[링크 : http://ngee.tistory.com/209]
[링크 : https://httpd.apache.org/docs/2.4/mod/mod_access_compat.html]
[링크 : https://httpd.apache.org/docs/2.4/howto/access.html]
mod_rewrite를 이용해서 외부 파일을 이용하는 방법.. 이건 좀 나아 보이긴 하네..
#Required set of rewrite rules RewriteEngine on RewriteMap hosts-deny txt:/etc/apache/banned-hosts RewriteCond ${hosts-deny:%{REMOTE_ADDR}|NOT-FOUND} !=NOT-FOUND [OR] RewriteCond ${hosts-deny:%{REMOTE_HOST}|NOT-FOUND} !=NOT-FOUND RewriteRule ^ /why-am-i-banned.html |
## inside our banned hosts file, we have: ## /etc/apache2/banned-hosts (maintain the format .. its not just a plain text file) ## 193.102.180.41 - 192.168.111.45 - www.example.com - www.sumwia.net - |
[링크 : http://stackoverflow.com/questions/23157707/apache-2-4-x-ip-blacklist]
다른것들을 찾아봐도.. 결론은 fail2ban을 이용한 ipfilter인데..
fail2ban ssh 차단 실패??? (0) | 2017.03.06 |
---|---|
fail2ban phpmyadmin (0) | 2017.02.28 |
fail2ban 재시작을 위한 차단목록 추가? (0) | 2017.02.15 |
fail2ban 차단 관련... (0) | 2017.02.09 |
ssh 로그인 보안 - fail2ban (4) | 2017.02.08 |