diff --git a/.drone.yml b/.drone.yml index b3540db..449022c 100644 --- a/.drone.yml +++ b/.drone.yml @@ -6,7 +6,7 @@ clone: disable: false steps: -- name: testing-jekyll +- name: testing pull: always image: jekyll/jekyll:latest commands: @@ -33,7 +33,48 @@ steps: # when: # status: # - success +<<<<<<< HEAD +======= + +- name: running + image: jekyll/jekyll:latest + settings: + TZ: Europe/Amsterdam + port: 4000 + script: + - jekyll serve --force_polling + when: + status: + - success + + # website: + # image: jekyll/jekyll:latest + # container_name: website + # hostname: website + # command: jekyll serve --force_polling + # network_mode: SWAG + # environment: + # - TZ=Europe/Amsterdam + # restart: unless-stopped + # volumes: + # - /home/sthope/docker/website:/srv/jekyll + # - /etc/localtime:/etc/localtime:ro + # - /etc/timezone:/etc/timezone:ro + # - website_cache:/srv/jekyll/.jekyll-cache + # - website_site:/srv/jekyll/_site + # labels: + # - swag=enable + # - swag_port=4000 + # - swag_proto=http + # - swag_url=www.sthope.dev +# - swag_auth=authelia +# - swag_auth_bypass=/api,/otherfolder + + + + +>>>>>>> f7090510b1b31c9fbe921ebd9372fa91944c8531 # - name: discord # pull: always # image: appleboy/drone-discord diff --git a/_drafts/2021-09-03-ssh-keys.md b/_drafts/2021-09-03-ssh-keys.md index 1400fb2..026a93b 100644 --- a/_drafts/2021-09-03-ssh-keys.md +++ b/_drafts/2021-09-03-ssh-keys.md @@ -18,3 +18,62 @@ Default generally is `~/.ssh/id_rsa`, you can omit `-f "/opt/.certs/service"` if ssh-keygen -t rsa -b 4096 -f "/opt/.certs/service" -C "Private Key Comment" ``` +Key should be created along also with .pub key + +``` +eval $(ssh-agent -s) +ssh-add /opt/.certs/service +ssh-copy-id -i /opt/.certs/service USERNAME@IP -p PORT +``` +Login one last time using your old username and password and remember to disable them or remove them. +
+ +After that you can login into the host with: +``` +ssh -i /opt/.certs/service -p PORT USERNAME@IP +``` +
+ +Or you can go little further and create file: +``` +sudo nano /etc/ssh/ssh_config.d/myssh.conf +``` +
+ +With: +``` +Host 192.168.1.* + AddKeysToAgent yes + IdentityFile /opt/.certs/service + Port 22 + +Host service.local 192.168.1.2 + User USERNAME + HostName 192.168.1.2 + +### Github.com +# don't forget to add the .pub key into your profile +Host github.com + User git + Hostname github.com + AddKeysToAgent yes + IdentityFile /opt/.certs/github + +### Gitea +# don't forget to add the .pub key into your profile +Host gitea.com + User git + Hostname gitea.com + AddKeysToAgent yes + IdentityFile /opt/.certs/gitea + +### Gitlab +# don't forget to add the .pub key into your profile +Host gitlab.com + User git + Hostname gitlab.com + AddKeysToAgent yes + IdentityFile /opt/.certs/gitlab +``` +Now you should be able to connect using `ssh service` or ssh git clone your repos from respective git repository +Test if it's working with: ```ssh -T git@github.com``` \ No newline at end of file diff --git a/_posts/2021-09-04-openssh-server-docker-ci.md b/_posts/2021-09-04-openssh-server-docker-ci.md new file mode 100644 index 0000000..495eb1a --- /dev/null +++ b/_posts/2021-09-04-openssh-server-docker-ci.md @@ -0,0 +1,56 @@ +--- +layout: post +title: "Openssh-server Docker Container" +description: "" +author: sthope +image: +categories: [ Docker, Portainer, SSH ] +comments: true +--- + +First create openssh-server configuration folders: +``` +mkdir -p ~/docker/openssh-server/{config,ssh} +``` +
+ +Portainer Stack: +```yaml +--- +version: "3.8" +services: + openssh-server: + image: ghcr.io/linuxserver/openssh-server:latest + container_name: openssh-server + hostname: my_server + environment: + - PUID=1000 + - PGID=1000 + - TZ=Europe/Amsterdam + - DOCKER_MODS=linuxserver/mods:openssh-server-rsync|linuxserver/mods:openssh-server-openssh-client|linuxserver/mods:openssh-server-git + - PUBLIC_KEY_FILE=~/docker/openssh-server/ssh + - PASSWORD_ACCESS=false + - SUDO_ACCESS=true + volumes: + - ~/docker/openssh-server/config:/config + - ~/docker/openssh-server/ssh:/root/.ssh + - ~/docker:/my_server + ports: + - 2222:2222 + restart: unless-stopped +``` + +After is running configure your ssh keys, you can generate new ones with command: +``` +docker run --rm -it --entrypoint /keygen.sh linuxserver/openssh-server +``` + +And after keys are configured you can ssh with: +``` +ssh -i /root/.ssh/your_key -p PORT USERNAME@IP +``` + +And from your Docker terminal you can enter the container with: +``` +docker exec -it openssh-server /bin/bash +```