跳到主要內容

發表文章

目前顯示的是有「DevOps」標籤的文章

Google Compute Engine‎ - AccessDeniedExceptions 403

原因 打算從 instance 打包 logs 到 google cloud storage 發生了 AccessDeniedException: 403 Insufficient OAuth2 scope to perform this operation. , 看起來是 instance 沒有 storage 權限 解決 Reference: https://cloud.google.com/compute/docs/access/create-enable-service-accounts-for-instances#changeserviceaccountandscopes 重新設定 service account 權限 instance 上內建有 gcloud , 就直接用現有的工具查詢一下 instance 的 account. $ gsutil info 或者在本機直接 gcloud compute instances describe INSTANCE_NAMES Account: [alpha-number-compute@developer.gserviceaccount.com] Project: [our-project-name] 會看到 instance 的一些狀態, 接下來就簡單多了, 按照下列的說明, 要先 stop instance, 更改 storage scope 再重新 start 。 To change an instance's service account and access scopes, the instance must be temporarily stopped. To stop your instance, read the documentation for Stopping an instance. After changing the service account or access scopes, remember to restart the instance. # Stop Instance gcloud compute instances stop INSTANCE_NAMES # 設定 storage scope 為 full (Read, Write) gcloud co...

Ubuntu 常用指令

id - 查詢使用者權限 id jerry uid=1003(jerry) gid=1004(jerry) groups=1004(jerry) ... 查詢檔案權限 getfacl getfacl docker-compose # file: docker-compose # owner: root # group: root user::rw- group::r-- other::r-- ls ls -al drwxr-xr-x 2 root root 4096 Jan 11 02:26 . drwxr-xr-x 10 root root 4096 Dec 12 14:21 .. -rw-r--r-- 1 root root 8479184 Jan 11 02:26 docker-compose chown - 更改檔案擁有者 chown UserName FileName chgrp - 更改檔案群組 系統的群組都紀錄在 /etc/group 檔案內 chgrp UserName FileName chmod - 修改權限 # a : 全部 user # u : 目前檔案的 owner # g : 目前檔案的 group # o : 其他 # + : 給予 # - : 移除 # = : 設定 # r : 讀 # w : 寫 # x : 執行 chmod [a/u/g/o] [+/-/=] [r/w/x] FileName # 讓所有 user 可以執行這個 File chmod a+x FileName tar - 壓縮, 解壓縮 # -z : 透過 gzip 的支援進行壓縮/解壓縮:此時檔名最好為 *.tar.gz # -cv : 建立打包檔案,可搭配 -v 來察看過程中被打包的檔名(filename) # -f FileName : 後面要立刻接要被處理的檔名!建議 -f 單獨寫一個選項囉!(比較不會忘記) # -x : 解打包或解壓縮的功能,可以搭配 -C (大寫) 在特定目錄解開, -c, -t, -x 不可同時出現在一串指令列中。 壓縮 tar -zcv -f FileName.tar.gz DirName 解壓縮 tar -zxv -f FileName.tar.gz which - 查詢指令所在位置 ...

用 shell 解析 Json 的好工具 jq

JQ tutorial Sample $docker network inspect bridge [{ "Name": "bridge", "Id": ""fake-id", "Created": "2017-07-05T01:07:55.747497179Z", "Scope": "local", "Driver": "bridge", "EnableIPv6": false, "IPAM": { "Driver": "default", "Options": null, "Config": [{ "Subnet": "172.17.0.0/16", "Gateway": "172.17.0.1" }] }, "Internal": false, "Attachable": false, "Ingress": false, "ConfigFrom": { "Network": "" }, "ConfigOnly": false, "Containers": { "b59a12af7c87621b43c95a9adbcf047076b8a4b6b6ce0d6c5e6e48e21188ce6a": { "Name": "heuristic_rosalind", "EndpointID": "fake-endpoint-id", "MacAddr...

Web 可以裸奔多久

輕鬆的口吻,嚴肅的態度,來看一下 Server 上線後的資安問題。 PHP DevOps https://medium.com/@Negaihoshi/%E6%9C%8D%E5%8B%99%E9%83%A8%E7%BD%B2%E6%80%9D%E8%B7%AF-35b8b905d5fe 常見的探測與攻擊手法 http://rdcqii.hundsun.com/portal/article/447.html OS 工具與設定 https://plusbryan.com/my-first-5-minutes-on-a-server-or-essential-security-for-linux-servers