dsnopek / anki-sync-server

A personal Anki sync server (so you can sync against your own server rather than AnkiWeb)
GNU Affero General Public License v3.0
741 stars 95 forks source link

can't connet anki-sync-server #49

Open aipie0066 opened 7 years ago

aipie0066 commented 7 years ago

Hi, first, thank you for your work. I try to get anki-sync-server to run on my linuxmint 17.1. I do it following these steps sudo apt-get install python-pip sudo pip install AnkiServer cd /usr/local/bin cp /usr/local/lib/python2.7/dist-packages/AnkiServer-2.0.6-py2.7.egg/examples/example.ini production.ini ./ankiserverctl.py adduser ./ankiserverctl.py debug ./ankiserverctl.py start it works great.

and then I open port for anki-sync-server

sudo vim /etc/iptables.firewall.rules *filter

Allow all loopback (lo0) traffic and drop all traffic to 127/8 that doesn't use lo0

-A INPUT -i lo -j ACCEPT -A INPUT -d 127.0.0.0/8 -j REJECT

Accept all established inbound connections

-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT

Allow all outbound traffic - you can modify this to only allow certain traffic

-A OUTPUT -j ACCEPT

Allow HTTP and HTTPS connections from anywhere (the normal ports for websites and SSL).

-A INPUT -p tcp --dport 80 -j ACCEPT -A INPUT -p tcp --dport 443 -j ACCEPT

Allow SSH connections

The -dport number should be the same port number you set in sshd_config

-A INPUT -p tcp -m state --state NEW --dport 22 -j ACCEPT

Allow ping

-A INPUT -p icmp --icmp-type echo-request -j ACCEPT

Log iptables denied calls

-A INPUT -m limit --limit 5/min -j LOG --log-prefix "iptables denied: " --log-level 7

Drop all other inbound - default deny unless explicitly allowed policy

-A INPUT -j DROP -A FORWARD -j DROP

Allow anki sever

-A INPUT -p tcp --dport 27701 -j ACCEPT COMMIT

sudo iptables-restore < /etc/iptables.firewall.rules sudo iptables -L Chain INPUT (policy ACCEPT) target prot opt source destination
ACCEPT all -- anywhere anywhere
REJECT all -- anywhere 127.0.0.0/8 reject-with icmp-port-unreachable ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED ACCEPT tcp -- anywhere anywhere tcp dpt:http ACCEPT tcp -- anywhere anywhere tcp dpt:https ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:ssh ACCEPT icmp -- anywhere anywhere icmp echo-request LOG all -- anywhere anywhere limit: avg 5/min burst 5 LOG level debug prefix "iptables denied: " DROP all -- anywhere anywhere
ACCEPT tcp -- anywhere anywhere tcp dpt:27701

Chain FORWARD (policy ACCEPT) target prot opt source destination
DROP all -- anywhere anywhere

Chain OUTPUT (policy ACCEPT) target prot opt source destination
ACCEPT all -- anywhere anywhere

But, I can't connet anki-server from my phone

myphone's parameter

http://192.168.2.128:27701/ http://192.168.2.128:27701/msync/

thanks

aipie0066 commented 7 years ago

My mistake. The problem has been solved sudo vim production.ini and then change all 127.0.0.1 to 192.168.2.128. But I discovered that I always have to syn with all anki's cards in one clients when I make some changes in anther clients.