{"id":186,"date":"2019-02-07T23:49:02","date_gmt":"2019-02-07T22:49:02","guid":{"rendered":"http:\/\/blog.brunocsmartin.fr\/?p=186"},"modified":"2019-10-14T16:30:31","modified_gmt":"2019-10-14T15:30:31","slug":"openvpn-and-co","status":"publish","type":"post","link":"https:\/\/blog.brunocsmartin.fr\/index.php\/2019\/02\/07\/openvpn-and-co\/","title":{"rendered":"Openvpn and Co"},"content":{"rendered":"<p>openvpn to create a vpn or to connect<\/p>\n<p>yum install openvpn easy-rsa<\/p>\n<p><a href=\"http:\/\/damiengustave.fr\/mise-en-place-dun-vpn-avec-openvpn-2-3-et-easy-rsa-3\/\">http:\/\/damiengustave.fr\/mise-en-place-dun-vpn-avec-openvpn-2-3-et-easy-rsa-3\/<\/a><\/p>\n<p>for server :<\/p>\n<p><code>cd \/etc\/openvpn\/<\/code><\/p>\n<p>Choose TCP (mobile connection issue with udp)<\/p>\n<p>copy easy_rsa scripts<\/p>\n<p><code>cp -Rp \/usr\/share\/easy-rsa\/3\/ easy-rsa<\/code><\/p>\n<p>generate pki and CA:<\/p>\n<p><code>.\/easyrsa init-pki<\/code><\/p>\n<p><code>.\/easyrsa build-ca<\/code><\/p>\n<p>generate tsl key for connection :<code><br \/>\nopenvpn --genkey --secret ta.key<\/code><\/p>\n<p>generate server key :<\/p>\n<p><code>.\/easyrsa gen-req server nopass<\/code><\/p>\n<p>generate sign server key :<\/p>\n<p><code>.\/easyrsa sign-req server server<\/code><\/p>\n<p>for clients :<\/p>\n<p><code>.\/easyrsa gen-req client1 nopass<\/code><\/p>\n<p><code>.\/easyrsa sign-req client client<\/code><\/p>\n<p><code>.\/easyrsa gen-crl<\/code><\/p>\n<p>for another key :<\/p>\n<p><code>openssl dhparam -out \/etc\/openvpn\/ssl\/dh.pem 2048<\/code><\/p>\n<p>Once all set up, mount cifs partition to linux :<\/p>\n<p><code>mount -t cifs \/\/10.8.0.1\/public \/mnt\/cifs -o username=bmartin,password=XXX<\/code><\/p>\n<p>Create user just for samba :<\/p>\n<p>adduser &#8211;disabled-login &#8211;ingroup impacte acdremont<\/p>\n<p>Give it a samba password :<\/p>\n<p>smbpasswd -a acdremont<\/p>\n<p>create a group impacte, add users to it, chown main:impacte \/home\/impacte<\/p>\n<p>give group write permision<\/p>\n<p>chmod -R g+w \/home\/impacte\/<\/p>\n<p>add this to smb.conf :<\/p>\n<p><code><br \/>\n[impacte]<br \/>\ncomment = Imp'Acte<br \/>\npath = \/home\/impacte<br \/>\nvalid users = bmartin acdremont jpereira<br \/>\nwritable = yes<br \/>\nprintable = no<br \/>\ngroup = impacte<br \/>\n<\/code><\/p>\n<p>if bad named files, use this command at root of share :<\/p>\n<p>find . -exec rename -v &lsquo;s\/[^\\x00-\\x7F]\/\/g&rsquo; \u00ab\u00a0{}\u00a0\u00bb \\;<\/p>\n<p>find . -name \u00ab\u00a0*&rsquo;*\u00a0\u00bb -exec rename \u00ab\u00a0s\/\\&rsquo;\/_\/\u00a0\u00bb {} \\;<\/p>\n<p>&nbsp;<\/p>\n<p>server config file :<code><br \/>\n~#cat \/etc\/openvpn\/server.conf | egrep -v \"(^#.*|^;.*|^$)\"<br \/>\nport 1196<br \/>\nproto udp<br \/>\ndev tun<br \/>\nca ca.crt<br \/>\ncert server.crt<br \/>\nkey server.key  # This file should be kept secret<br \/>\ndh dh2048.pem<br \/>\ntopology subnet<br \/>\nserver 10.8.0.0 255.255.255.0<br \/>\nifconfig-pool-persist ipp.txt<br \/>\npush \"redirect-gateway def1 bypass-dhcp\"<br \/>\npush \"dhcp-option DNS 8.8.8.8\"<br \/>\npush \"dhcp-option DNS 8.8.4.4\"<br \/>\nclient-to-client<br \/>\nkeepalive 10 120<br \/>\ntls-auth ta.key 0 # This file is secret<br \/>\ncipher AES-256-CBC<br \/>\nuser nobody<br \/>\ngroup nobody<br \/>\npersist-key<br \/>\npersist-tun<br \/>\nstatus openvpn-status.log<br \/>\nlog-append  \/var\/log\/openvpn.log<br \/>\nverb 3<br \/>\nexplicit-exit-notify 1<br \/>\nremote-cert-eku \"TLS Web Client Authentication\"<br \/>\npersist-key<br \/>\npersist-tun<br \/>\nca ca.crt<br \/>\ncert server.crt<br \/>\ncomp-lzo adaptive<br \/>\ndev tun<br \/>\nifconfig-pool-persist server-ipp.txt 0<br \/>\nkeepalive 10 120<br \/>\nkey server.key<br \/>\ntls-auth ta.key 0<br \/>\ncipher AES-256-CBC<br \/>\nauth SHA512<br \/>\ntls-version-min 1.2<br \/>\ntls-cipher TLS-DHE-RSA-WITH-AES-256-GCM-SHA384<br \/>\nport 1194<br \/>\nproto udp<br \/>\nverb 3<br \/>\ncrl-verify crl.pem<br \/>\n<\/code><\/p>\n<p>client config file :<\/p>\n<p><code><br \/>\n~# cat \/etc\/openvpn\/client\/client.conf<br \/>\nclient<br \/>\ndev tun<br \/>\nproto udp<br \/>\nport 1194<br \/>\nremote openvpn.brunocsmartin.fr 1194 udp<br \/>\nremote-cert-tls server<br \/>\nresolv-retry infinite<br \/>\nnobind<br \/>\npersist-key<br \/>\npersist-tun<br \/>\ncomp-lzo<br \/>\nverb 3<br \/>\ncipher AES-256-CBC<br \/>\nauth SHA512<br \/>\ntls-version-min 1.2<br \/>\ntls-cipher TLS-DHE-RSA-WITH-AES-256-GCM-SHA384<\/code><\/p>\n<p>ca ca.crt<br \/>\ncert vps_rpi32.crt<br \/>\nkey vps_rpi32.key<br \/>\ntls-auth ta.key 1<br \/>\nkey-direction 1<\/p>\n<p>pull-filter ignore redirect-gateway<\/p>\n","protected":false},"excerpt":{"rendered":"<p>openvpn to create a vpn or to connect yum install openvpn easy-rsa http:\/\/damiengustave.fr\/mise-en-place-dun-vpn-avec-openvpn-2-3-et-easy-rsa-3\/ for server : cd \/etc\/openvpn\/ Choose TCP (mobile connection issue with udp) copy easy_rsa scripts cp -Rp \/usr\/share\/easy-rsa\/3\/ easy-rsa generate pki and CA: .\/easyrsa init-pki .\/easyrsa build-ca generate tsl key for connection : openvpn &#8211;genkey &#8211;secret ta.key generate server key : .\/easyrsa &hellip; <a href=\"https:\/\/blog.brunocsmartin.fr\/index.php\/2019\/02\/07\/openvpn-and-co\/\" class=\"more-link\">Continuer la lecture de <span class=\"screen-reader-text\">Openvpn and Co<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-186","post","type-post","status-publish","format-standard","hentry","category-non-classe"],"_links":{"self":[{"href":"https:\/\/blog.brunocsmartin.fr\/index.php\/wp-json\/wp\/v2\/posts\/186"}],"collection":[{"href":"https:\/\/blog.brunocsmartin.fr\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.brunocsmartin.fr\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.brunocsmartin.fr\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.brunocsmartin.fr\/index.php\/wp-json\/wp\/v2\/comments?post=186"}],"version-history":[{"count":13,"href":"https:\/\/blog.brunocsmartin.fr\/index.php\/wp-json\/wp\/v2\/posts\/186\/revisions"}],"predecessor-version":[{"id":260,"href":"https:\/\/blog.brunocsmartin.fr\/index.php\/wp-json\/wp\/v2\/posts\/186\/revisions\/260"}],"wp:attachment":[{"href":"https:\/\/blog.brunocsmartin.fr\/index.php\/wp-json\/wp\/v2\/media?parent=186"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.brunocsmartin.fr\/index.php\/wp-json\/wp\/v2\/categories?post=186"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.brunocsmartin.fr\/index.php\/wp-json\/wp\/v2\/tags?post=186"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}