Last active
December 13, 2017 20:08
-
-
Save mcconkiee/9919b784f0c47d34fcecde4069bd158f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# EMBER NOTES | |
## passing control action to component through HBS | |
declare the controller action in the component markup | |
``` | |
//templates/account/booking/show.hbs | |
{{booking/show-detail booking=booking gear=gear onCancel=(action 'onCancel')}} | |
``` | |
assign the action in the component | |
``` | |
//templates/components/show-details.hbs | |
<button type="button" class="btn btn-danger" data-dismiss="modal" {{action onCancel booking}}>Yes, cancel this booking.</button> | |
``` | |
//in controller .js, write the action | |
``` | |
//controllers/account/booking/show.js | |
import Ember from 'ember'; | |
const { | |
Controller,set | |
} = Ember; | |
export default Controller.extend({ | |
init() { | |
this._super(...arguments); | |
// console.log('*******this',this); | |
}, | |
actions: { | |
onCancel(booking) { | |
const self = this; | |
booking.deleteRecord(); | |
booking.save().then(result => { | |
set(self, 'deleted', result); | |
self.transitionToRoute('account.bookings'); | |
}).catch(error => { | |
set(self, 'error', error); | |
}); | |
} | |
} | |
}); | |
``` | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Android Paper | |
cd to web/assets/js/android/paper/ | |
``` | |
babel --presets react,es2015 ./src --watch --out-dir . | |
``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# POYNT WEB | |
sublime search : | |
/Users/ericmcconkie/Documents/work/poyntweb/,-*/node_modules/*,-*/bower_components/*,-*/l10n/* | |
## APN | |
change node-utils/apn.js connect function to | |
``` | |
const path = process.cwd() + '/local/apn_'; | |
const options = { | |
cert : process.cwd() + '/local/dev/apns-dev-cert.pem', | |
key : process.cwd() + '/local/dev/apns-dev-key-noenc.pem', | |
production : (configs.env === 'production') | |
}; | |
``` | |
## SSH | |
``` | |
ci-nodejs1: ssh [email protected] -i /Users/ericmcconkie/.ssh/id_rsa | |
ci-nodejs2: ssh [email protected] -i /Users/ericmcconkie/.ssh/id_rsa | |
``` | |
`ssh eric@nodejs1` then `sudo -s` then `service poynt-web logs` | |
## change port on node | |
stats needd this to run | |
`PORT=1340 node bin/stats` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# REACT NATIVE | |
## recreate bundle js | |
``` | |
react-native bundle --platform android --dev false --entry-file index.android.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res/ | |
``` | |
## Add host file | |
### EMULATOR | |
``` | |
which adb | |
cd path/to/adb | |
./adb root && ./adb -s emulator-5554 remount && ./adb -s emulator-5554 push ~/Documents/work/hq-android/hosts /system/etc/hosts | |
``` | |
### DEVICE | |
#### host file (must be rooted!) | |
``` | |
//push host file to sdcard | |
adb push ~/Documents/work/hq-android/hosts /sdcard2/hosts | |
adb shell | |
su | |
cd sdcard2 | |
mv hosts /system/etc/hosts | |
``` | |
#### dev server | |
`adb reverse tcp:8081 tcp:8081` | |
## Reload from CLI | |
``` | |
adb -d shell input text "RR" | |
``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Terminal Pointed to CI | |
``` | |
1) factory reset without dropping keys (easiest way to do this is go to poynt settings -> About -> ten tap Poynt OS Verson to enable Developer Preferences -> back to Poynt Settings -> Developer Preferences -> tap the WARNING ten times and you should see a popup that says “factory resetting…would reactivating your terminal” -> click Yes and your terminal should start spinning saying “shutting down” | |
you want to add a file to /sdcard/ | |
`adb shell` | |
`cd /sdcard` | |
`echo "ci" > .poynt_env` | |
`cat .poynt_env` // make sure it reads ci | |
adb exit | |
adb reboot | |
``` | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# VPN | |
GIZMO = CI | |
SECTOR= PRODUCTION | |
## Setup OpenVPN, on Linux, server and client | |
This is for Ubuntu 14.04 and 16.04. | |
Install the following package | |
Server | |
``` | |
apt-get install openvpn easy-rsa | |
``` | |
Client | |
``` | |
apt-get install openvpn | |
``` | |
## Configure the Server | |
#### Create the certs | |
``` | |
mkdir -p /etc/openvpn /etc/openvpn/keys /etc/openvpn/users /var/log/openvpn | |
touch /etc/openvpn/ipp.txt | |
cp -arv /usr/share/easy-rsa/ /etc/openvpn | |
cd /etc/openvpn/easy-rsa | |
ln -s openssl-1.0.0.cnf openssl.cnf | |
cp vars vars.dpkg | |
``` | |
Edit the **vars** file and change the **Cert info** section with your own info. | |
``` | |
# - start | |
export EASY_RSA_DIR="/etc/openvpn/easy-rsa" | |
export OPENSSL="openssl" | |
export PKCS11TOOL="pkcs11-tool" | |
export GREP="grep" | |
export KEY_CONFIG=$EASY_RSA_DIR/openssl.cnf | |
export KEY_DIR="/etc/openvpn/keys" | |
# Issue rm -rf warning | |
echo NOTE: If you run ./clean-all, I will be doing a rm -rf on $KEY_DIR | |
export PKCS11_MODULE_PATH="dummy" | |
export PKCS11_PIN="dummy" | |
export KEY_SIZE=2048 | |
# 10 years CA cert | |
export CA_EXPIRE=3650 | |
export KEY_EXPIRE=3650 | |
# Cert info | |
export KEY_COUNTRY="US" | |
export KEY_PROVINCE="California" | |
export KEY_CITY="Palo Alto" | |
export KEY_ORG="Momo Co" | |
export KEY_OU="Operations" | |
export KEY_EMAIL="[email protected]" | |
export KEY_NAME="Momo CO" | |
# - end | |
``` | |
Source the file **vars** and then execute the following scripts: | |
``` | |
. ./vars | |
./clean-all | |
./build-ca | |
``` | |
Adjust the key-server name to your own info, **do not set password** otherwise openvpn will only start if you enter the password and answer yes to other questions. | |
``` | |
./build-key-server vpn.momo.io | |
./build-dh | |
openvpn --genkey --secret /etc/openvpn/keys/ta.key | |
``` | |
#### Create the Server configuration file | |
First choose a UDP port and network for the VPN, this network will be used between the server and clients, then create the file **/etc/openvpn/server.conf** | |
1. **local** is your VPN-server's local IP! | |
2. **port** use any port between 4000 and 7000, 5500 <-> 5900 I like these :-) | |
3. **dev**, which will be tunnel name under the command ifconfig, can be name whatever name you like. | |
4. **server** any RFC1918 : must be /24! and make sure it does not conflict with the server's network. | |
5. **max-clients** only 2 users can login at the same time, adjust for your need. | |
``` | |
# - start | |
mode server | |
local xxx.xxx.xxx.xxx | |
proto udp | |
port xxxx | |
# Tunnel directive | |
dev ovpn-server | |
dev-type tun | |
persist-key | |
persist-tun | |
# Certificates and Encryption | |
tls-server | |
ca /etc/openvpn/keys/ca.crt | |
cert /etc/openvpn/keys/vpn.momo.io.crt | |
key /etc/openvpn/keys/vpn.momo.io.key | |
dh /etc/openvpn/keys/dh2048.pem | |
tls-auth /etc/openvpn/keys/ta.key 0 | |
cipher BF-CBC | |
# Users key Directory | |
client-config-dir /etc/openvpn/users | |
# uncomment to allow users to have multiple connection | |
# security-wise it is not a good thing! | |
# if duplicate-cn is used then the 'client-config-dir' above can not be used! | |
# duplicate-cn | |
# Compression | |
comp-lzo | |
# Server Mode and DHCP/Network options | |
ifconfig-pool-persist /etc/openvpn/ipp.txt | |
server xxx.xxx.xxx.xxx 255.255.255.0 | |
max-clients 2 | |
# push info to client for experts only! | |
#push "route xxx.xxx.xxx.xxx xxx.xxx.xxx.xxx" | |
#push "redirect-gateway def1" | |
#push "dhcp-option DNS 8.8.8.8 8.8.4.4 " | |
#push "dhcp-option DOMAIN xxx.xxx" | |
#push "dhcp-option DOMAIN-SEARCH xxx.xxx" | |
# Log and Security | |
user root | |
group sys | |
keepalive 10 120 | |
status /var/log/openvpn/server-status.log | |
log-append /var/log/openvpn/server-vpn.log | |
syslog openvpn | |
verb 2 | |
mute 2 | |
management localhost 7505 | |
# - end | |
``` | |
#### Start the VPN and monitor | |
Check logs and monitor | |
``` | |
systemctl start openvpn@server | |
systemctl status openvpn@server | |
systemctl enable openvpn@server | |
cat /var/log/openvpn/server-status.log | |
tail -f /var/log/openvpn/server-vpn.log | |
``` | |
**note** the `enable` sent to systemctl is to make sure openvpn starts at boot time. | |
Monitor live activities | |
``` | |
telnet localhost 7505 | |
``` | |
Then type **status** this will show who is connected, to kill a sesion (example momo) use **kill momo**, type **quit** to exit and **help** to see more options. | |
#### Create the users certs | |
This done on the vpn server! | |
Go to the easy-rsa directory and source the **vars** file. | |
``` | |
cd /etc/openvpn/easy-rsa | |
. ./vars | |
``` | |
Adjust to your own info, **do not set password**, otherwise openvpn will only start if you enter the password and answer yes to other questions | |
**note** the XXXXXs will be random | |
``` | |
./build-key momo | |
cd /tmp | |
mktemp -d momoXXXXX | |
cp /etc/openvpn/keys/ca.crt /etc/openvpn/keys/ta.key /tmp/momoXXXXX | |
cp /etc/openvpn/keys/momo.crt /etc/openvpn/keys/momo.key /tmp/momoXXXXX | |
chmod 400 /tmp/momoXXXXX/* | |
``` | |
Create a encrypted file so it can be email if needed, it will ask for a password and confirm it, we using openssl to encrypt the tar-gzipped file | |
``` | |
( cd /tmp/momoXXXXX ; tar zc * | openssl enc -aes-256-cbc -e > /tmp/momo.data ) | |
cd /tmp ; rm -rf /tmp/momoXXXXX | |
``` | |
Now transfer the file /tmp/momo.data to the client (scp/email) and then delete this file! | |
#### OPTIONAL | |
Setup a **static vpn ip** for the users | |
create a file under /etc/openvpn/user with the same name as the cert name, example **/etc/openvpn/users/momo** | |
Linux client needs 2 ips while windows always 4! The very first octect should be 4, and do not share same range between users. The ip network should be same as it was set in the server.conf; **server** section | |
``` | |
ifconfig-push xxx.xxx.xxx.4 xxx.xxx.xxx.7 | |
``` | |
## Setup the client | |
This is done on the client! | |
#### Create the configuration file | |
So you can have run multiple clients, we use a sub-directory. Example here we called it office! so note the word office in the config! | |
``` | |
mkdir -p /var/log/openvpn/office | |
cp momo.data /etc/openvpn/office | |
(cd /etc/openvpn/office ; openssl aes-256-cbc -d -in momo.data | tar xzv ) | |
``` | |
Create the file **/etc/openvpn/office/office.conf** | |
1. **remote** is the hostname or ip and port-number of the vpn server (public facing) | |
2. Replace the **momo.crt** and **mono.key** with the correct file name. | |
3. The **dev**, which will be tunnel name under the command ifconfig, can be name whatever name you like. | |
``` | |
# - start | |
remote xxx.xxx.xxx.xxx xxxx | |
pull | |
tls-client | |
tls-auth /etc/openvpn/office/ta.key 1 | |
proto udp | |
persist-key | |
ca /etc/openvpn/office/ca.crt | |
nobind | |
persist-tun | |
cert /etc/openvpn/office/momo.crt | |
comp-lzo adaptive | |
dev ovpn-officee | |
dev-type tun | |
key /etc/openvpn/office/momo.key | |
cipher BF-CBC | |
# | |
user root | |
group sys | |
keepalive 10 120 | |
# | |
status /var/log/openvpn/office-status.log | |
log-append /var/log/openvpn/office-vpn.log | |
# - end | |
``` | |
Link the config file to openvpn top directory | |
``` | |
ln -s /etc/openvpn/office/office.conf /etc/openvpn/office.conf | |
``` | |
#### Start the client side | |
On server site telnet to the 7505 port and type status so that you are able to see the client connecting, then execute the following command. | |
``` | |
systemctl start openvpn@office | |
systemctl status openvpn@office | |
systemctl enable openvpn@server | |
cat /var/log/openvpn/office-status.log | |
tail -f /var/log/openvpn/office-vpn.log | |
``` | |
**note** the `enable` sent to systemctl is to make sure openvpn starts at boot time. | |
# Note for OSX | |
For OSX the following VPN client are availabe | |
1. [Viscocity](https://www.sparklabs.com/viscosity) ($10/seat, highly recommended) | |
2. [TunnelBlick](https://tunnelblick.net/downloads.html "TunnelBlick"). | |
To configure Viscocity or Tunnelblick: | |
``` | |
mkdir ~/Desktop/vpn | |
cp momo.data ~/Desktop/vpn | |
cd ~/Desktop/vpn | |
openssl aes-256-cbc -d -in momo.data | tar xzv | |
``` | |
Now create the configuration file, **office.ovpn** | |
Do note: | |
1. the file extension name | |
2. not using full paths! | |
See section `Client: Create the configuration file` for more information. | |
``` | |
# - start | |
remote xxx.xxx.xxx.xxx xxxx | |
pull | |
tls-client | |
tls-auth ta.key 1 | |
proto udp | |
persist-key | |
ca ca.crt | |
nobind | |
persist-tun | |
cert momo.crt | |
comp-lzo adaptive | |
dev tun | |
key momo.key | |
cipher BF-CBC | |
# - end | |
``` | |
Then double click the .ovpn file, Viscocity or Tunnelblick will import the configuration file and copy all files to the correct location. Once completed, you should delete the directory. | |
# THE END |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment