<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
    <channel>
        <title>Posts on zerosec.xyz</title>
        <link>https://zerosec.xyz/posts/</link>
        <description>Recent content in Posts on zerosec.xyz</description>
        <generator>Hugo -- gohugo.io</generator>
        <language>en</language>
        <copyright>&lt;a href=&#34;https://creativecommons.org/licenses/by-nc/4.0/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;CC BY-NC 4.0&lt;/a&gt;</copyright>
        <lastBuildDate>Sat, 04 Nov 2023 00:00:00 +0000</lastBuildDate>
        <atom:link href="https://zerosec.xyz/posts/index.xml" rel="self" type="application/rss+xml" />
        
        <item>
            <title>Working as DevOps Engineer</title>
            <link>https://zerosec.xyz/posts/2023/05/working-as-devops-engineer/</link>
            <pubDate>Mon, 15 May 2023 17:08:20 +0200</pubDate>
            
            <guid>https://zerosec.xyz/posts/2023/05/working-as-devops-engineer/</guid>
            <description>In the fast-paced realm of technology, where software development and IT operations intersect, there exists a crucial role that often goes unnoticed, yet it&amp;rsquo;s the linchpin that holds everything together - the DevOps engineer. These guys are the driving force behind the seamless integration of development and operations, ensuring that the modern digital world keeps running efficiently. Let&amp;rsquo;s take a closer look at the world of DevOps engineers and their vital contributions.</description>
            <content type="html"><![CDATA[<p>In the fast-paced realm of technology, where software development and IT operations intersect, there exists a crucial role that often goes unnoticed, yet it&rsquo;s the linchpin that holds everything together - the DevOps engineer. These guys are the driving force behind the seamless integration of development and operations, ensuring that the modern digital world keeps running efficiently. Let&rsquo;s take a closer look at the world of DevOps engineers and their vital contributions.</p>
<h1 id="what-is-devops">What is DevOps?</h1>
<p>DevOps, short for Development and Operations, is a set of practices and tools aimed at breaking down silos between development and IT operations teams. DevOps engineers bridge this gap by fostering collaboration, enhancing automation, and maintaining a culture of continuous improvement. Their primary goal is to streamline the software development and deployment process, enabling faster and more reliable releases.</p>
<h1 id="the-role-of-devops-engineers">The Role of DevOps Engineers</h1>
<p>Automation: DevOps engineers are automation experts. They script, code, and configure tools that automate manual processes, reducing the risk of human error and increasing efficiency. Whether it&rsquo;s automating software testing or deployment, they ensure that repetitive tasks are a thing of the past.</p>
<p>Continuous Integration and Deployment (CI/CD): DevOps engineers implement CI/CD pipelines to allow for the continuous and automated delivery of code. This accelerates development cycles, resulting in faster feature releases and bug fixes.</p>
<p>System Monitoring and Troubleshooting: They are vigilant watchdogs, constantly monitoring system health, identifying issues, and troubleshooting problems in real-time. They keep the lights on, ensuring that the applications and services remain available.</p>
<p>Security as Code: Security is paramount in the digital age. DevOps engineers incorporate security practices into the development process, ensuring that vulnerabilities are addressed proactively.</p>
<p>Scalability and Resource Optimization: DevOps engineers plan and manage resources efficiently, ensuring that systems can scale as needed to handle growing demands without over-provisioning and wasting resources.</p>
<p>Communication and Collaboration: Collaboration is at the core of the DevOps philosophy. These engineers are skilled in fostering communication and collaboration among developers, operations, and other stakeholders to align goals and create a harmonious working environment.</p>
<h1 id="why-devops-matters">Why DevOps Matters</h1>
<p>In a world where the agility of software development is key, DevOps engineers are the backbone of innovation. Their contributions lead to faster releases, higher quality software, and a more reliable user experience. Moreover, the emphasis on automation and collaboration ensures that the software development lifecycle is more efficient and streamlined, reducing overhead costs and accelerating time-to-market.</p>
<p>DevOps engineers may not always bask in the spotlight, but their dedication to the seamless operation of the digital world is unmatched. They are the silent heroes who keep the engines running smoothly, making our lives in the digital age all the more convenient, secure, and exciting. So, the next time you experience a glitch-free, rapidly evolving tech landscape, remember that DevOps engineers are hard at work behind the scenes, making it all possible.</p>
]]></content>
        </item>
        
        <item>
            <title>Synapse - selfhosted, decentralised and federated messaging service</title>
            <link>https://zerosec.xyz/posts/2023/11/synapse-selfhosted-decentralised-and-federated-messaging-service/</link>
            <pubDate>Sat, 04 Nov 2023 00:00:00 +0000</pubDate>
            
            <guid>https://zerosec.xyz/posts/2023/11/synapse-selfhosted-decentralised-and-federated-messaging-service/</guid>
            <description>Intro Matrix is an open standard for decentralised communication, which securely distributes persistent chatrooms over an open federation of servers preventing any single points of control or failure. 1
What is synapse? Synapse is an open-source Matrix homeserver written and maintained by the Matrix.org Foundation. 2
Because the open-source concept of Matrix and Synapse there are many projects to extend the default functionalities. We cloud use so called bridges to connect an bot to our synpase server which can forward messages from WhatsApp, Signal, Telegram, Instagram or Discord to our private chatroom.</description>
            <content type="html"><![CDATA[<h2 id="intro">Intro</h2>
<p>Matrix is an open standard for decentralised communication, which securely distributes persistent chatrooms over an open federation of servers preventing any single points of control or failure. <a href="https://upcloud.com/resources/tutorials/install-matrix-synapse">1</a></p>
<h2 id="what-is-synapse">What is synapse?</h2>
<p>Synapse is an open-source Matrix homeserver written and maintained by the Matrix.org Foundation. <a href="https://github.com/matrix-org/synapse">2</a></p>
<p>Because the open-source concept of Matrix and Synapse there are many projects to extend the default functionalities. We cloud use so called bridges to connect an bot to our synpase server which can forward messages from WhatsApp, Signal, Telegram, Instagram or Discord to our private chatroom. <a href="https://docs.mau.fi/bridges/go/setup.html?bridge=whatsapp">3</a></p>
<h2 id="basic-docker-deployment">basic docker deployment</h2>
<p>This deployment just include the bare minimium an synapse instance could run. We are using the original docker image and running a postgres database for storing data. With this setup you can only register users via CLI. You also will need an client to connect to your synaps matrix server. I would recommend fluffychat or element. With these settings only local (users on your instance) can chat. Federation will not work. Also please don&rsquo;t run this in any serious/productive type of use-case. All packages getting send via http, so completely unencryted. Later we will use an reverse proxy manager to encrypt the traffic.</p>
<p>requirement:</p>
<ul>
<li>web domain with an subdomain (something like <code>matrix.foryourdomain.com</code>)</li>
<li>access to dns records of the web domain</li>
<li><code>docker</code> and <code>docker-compose</code> installed on the server you want to host your synapse instance</li>
</ul>
<p>Setup an A-record for example <code>matrix.foryourdomain.com</code> and the ip address from your server.</p>
<p>Define some environment variables in ./synapsedb.env</p>
<pre tabindex="0"><code>POSTGRES_USER=YOUR_POSTGRES_USERNAME
POSTGRES_PASSWORD=YOUR_POSTGRES_PASSWORD
POSTGRES_INITDB_ARGS=--encoding=UTF-8 --lc-collate=C --lc-ctype=C
</code></pre><p>Next just run the following docker-compose file with <code>docker-compose up -d</code>.</p>
<pre tabindex="0"><code>version: &#39;3&#39;

services:

  synapse:
    container_name: synapse
    image: docker.io/matrixdotorg/synapse:latest
    restart: unless-stopped
    environment:
      - SYNAPSE_CONFIG_PATH=/data/homeserver.yaml
    volumes:
      - ./synapse:/data
    depends_on:
      - synapse-db
    networks:
      - matrix
      - postgres
    ports:
      - 8008:8008/tcp
    healthcheck:
      test: [&#34;CMD&#34;, &#34;curl&#34;, &#34;-fSs&#34;, &#34;http://localhost:8008/health&#34;]
      interval: 15s
      timeout: 5s
      retries: 3
      start_period: 5s
    runtime: runc

  synapse-db:
    image: docker.io/postgres:12-alpine
    container_name: synapse-db
    # Change that password, of course!
    env_file:
      - synapsedb.env
    volumes:
      - ./db/schemas:/var/lib/postgresql/data
    networks:
      - postgres
    healthcheck:
      test: [&#34;CMD&#34;, &#34;pg_isready&#34;, &#34;-U&#34;, &#34;synapse&#34;]
      interval: 15s
      timeout: 5s
    runtime: runc

networks:
  matrix:
  postgres:
</code></pre><p>After the first run you should stop the container with <code>docker compose stop synapse</code> and adjust the parameter of your <code>homeserver.yaml</code> under <code>./synapse/homeserver.yaml</code>.</p>
<p>Here is my base configuration as an example:</p>
<pre tabindex="0"><code>server_name: &#34;matrix.foryourdomain.com&#34;
pid_file: /data/homeserver.pid
# i&#39;m using an reverse proxy so this should be fine
listeners:
  - port: 8008
    tls: false
    type: http
    x_forwarded: true
    resources:
      - names: [client]
        compress: false
database:
  name: psycopg2
  args:
    user: YOUR_POSTGRES_USERNAME # please change
    password: YOUR_POSTGRES_PASSWORD # please change
    database: YOUR_POSTGRES_USERNAME # please change in the most cases the username == the postgres database names
    host: synapse-db
    cp_min: 5
    cp_max: 10
log_config: &#34;/data/matrix.foryourdomain.com.log.config&#34;
media_store_path: /data/media_store
registration_shared_secret: &#34;AUTOGENERATED_SECRET&#34;
report_stats: true
enable_metrics: true
macaroon_secret_key: &#34;AUTOGENERATED_SECRET&#34;
form_secret: &#34;AUTOGENERATED_SECRET&#34;
signing_key_path: &#34;/data/matrix.foryourdomain.com.signing.key&#34;
trusted_key_servers:
  - server_name: &#34;matrix.org&#34;
</code></pre><p>to register a new user you could run the following commands:</p>
<pre tabindex="0"><code>docker exec -it synapse /bin/bash
register_new_matrix_user -u user1 -p p@ssword -a -c /data/homeserver.yaml
</code></pre><p>this will register a new user with administrator permissions.</p>
<h2 id="lets-secure-our-traffic-with-an-reverse-proxy">lets secure our traffic with an reverse proxy</h2>
<p>Next we will use an reverse proxy to encrypt the http traffic so we could achive an secured connection between our clients and the server. I&rsquo;m using nginx proxy manager there are also alternatives like haproxy, traefik or caddy. There is a nice guide how to setup nginx proxy manager <a href="https://www.linode.com/docs/guides/using-nginx-proxy-manager/">on linode.com</a>.</p>
<p>So I will asume you have an working reverse proxy with SSL certificates and also managed to route the traffic to the reverse proxy. Also you have to establish a encrypted connection between the synapse server and the server the reverse proxy is running on, likely an VPN connection.
I&rsquo;m running the reverse proxy and the synapse server on the same machine so I don&rsquo;t have to mind secured connections between multiple servers.</p>
<p>Acording to the text about the <code>docker-compose.yml</code> should now look something like this:</p>
<pre tabindex="0"><code>version: &#34;3&#34;

services:
  synapse:
    container_name: synapse
    image: docker.io/matrixdotorg/synapse:latest
    restart: unless-stopped
    environment:
      - SYNAPSE_CONFIG_PATH=/data/homeserver.yaml
    volumes:
      - ./synapse:/data
    depends_on:
      - synapse-db
    networks:
      - matrix
      - postgres
    ports:
      - 8008:8008/tcp
    healthcheck:
      test: [&#34;CMD&#34;, &#34;curl&#34;, &#34;-fSs&#34;, &#34;http://localhost:8008/health&#34;]
      interval: 15s
      timeout: 5s
      retries: 3
      start_period: 5s
    runtime: runc

  synapse-db:
    image: docker.io/postgres:12-alpine
    container_name: synapse-db
    # Change that password, of course!
    env_file:
      - synapsedb.env
    volumes:
      - ./db/schemas:/var/lib/postgresql/data
    networks:
      - postgres
    healthcheck:
      test: [&#34;CMD&#34;, &#34;pg_isready&#34;, &#34;-U&#34;, &#34;synapse&#34;]
      interval: 15s
      timeout: 5s
    runtime: runc

  npm:
    image: &#39;jc21/nginx-proxy-manager:latest&#39;
    container_name: nginxproxymanager
    restart: unless-stopped
    volumes:
      - ./data:/data
      - ./letsencrypt:/etc/letsencrypt
    ports:
      - &#39;80:80&#39;
      - &#39;443:443&#39;
      - &#39;81:81&#39;
    networks:
      - proxy

networks:
  matrix:
  postgres:
  proxy:
</code></pre><p>TODO</p>
<ol>
<li>create proxy entry</li>
<li>test connection</li>
<li>add additional settings</li>
</ol>
<h2 id="monitoring">monitoring</h2>
<p>When running services in production a common-practice is to use some monitoring software to identify problems quickly. The synapse documentation recommends the grafana monitoring stack which we will also use. TODO: add link to grafana/synapse documentation
Also the synapse team is providing us a very useful dashboard.</p>
<ul>
<li>grafana</li>
</ul>
<h2 id="optimizations">optimizations</h2>
<ul>
<li>storage data</li>
<li>fast storage for databases and uploads</li>
</ul>
]]></content>
        </item>
        
        <item>
            <title>Nextcloud DB Error after upgrade</title>
            <link>https://zerosec.xyz/posts/2023/03/nextcloud-db-error-after-upgrade/</link>
            <pubDate>Wed, 15 Mar 2023 18:25:20 +0200</pubDate>
            
            <guid>https://zerosec.xyz/posts/2023/03/nextcloud-db-error-after-upgrade/</guid>
            <description>Incorrect definition of table I&amp;rsquo;ve got an MariaDB error after upgrading my nextcloud instance. This was the solution.
Updating to nextcloud 24.0.1 got me this error messages from docker-compose logs
db_1 | 2022-05-31 14:01:22 6057 [ERROR] Incorrect definition of table mysql.column_stats: expected column &amp;#39;hist_type&amp;#39; at position 9 to have type enum(&amp;#39;SINGLE_PREC_HB&amp;#39;,&amp;#39;DOUBLE_PREC_HB&amp;#39;,&amp;#39;JSON_HB&amp;#39;), found type enum(&amp;#39;SINGLE_PREC_HB&amp;#39;,&amp;#39;DOUBLE_PREC_HB&amp;#39;). db_1 | 2022-05-31 14:01:22 6057 [ERROR] Incorrect definition of table mysql.column_stats: expected column &amp;#39;histogram&amp;#39; at position 10 to have type longblob, found type varbinary(255).</description>
            <content type="html"><![CDATA[<h1 id="incorrect-definition-of-table">Incorrect definition of table</h1>
<p>I&rsquo;ve got an MariaDB error after upgrading my nextcloud instance. This was the solution.</p>
<p>Updating to nextcloud 24.0.1 got me this error messages from <code>docker-compose logs</code></p>
<pre tabindex="0"><code>db_1   | 2022-05-31 14:01:22 6057 [ERROR] Incorrect definition of table mysql.column_stats: expected column &#39;hist_type&#39; at position 9 to have type enum(&#39;SINGLE_PREC_HB&#39;,&#39;DOUBLE_PREC_HB&#39;,&#39;JSON_HB&#39;), found type enum(&#39;SINGLE_PREC_HB&#39;,&#39;DOUBLE_PREC_HB&#39;).
db_1   | 2022-05-31 14:01:22 6057 [ERROR] Incorrect definition of table mysql.column_stats: expected column &#39;histogram&#39; at position 10 to have type longblob, found type varbinary(255).
db_1   | 2022-05-31 14:01:22 6057 [ERROR] Incorrect definition of table mysql.column_stats: expected column &#39;hist_type&#39; at position 9 to have type enum(&#39;SINGLE_PREC_HB&#39;,&#39;DOUBLE_PREC_HB&#39;,&#39;JSON_HB&#39;), found type enum(&#39;SINGLE_PREC_HB&#39;,&#39;DOUBLE_PREC_HB&#39;).
db_1   | 2022-05-31 14:01:22 6057 [ERROR] Incorrect definition of table mysql.column_stats: expected column &#39;histogram&#39; at position 10 to have type longblob, found type varbinary(255).
db_1   | 2022-05-31 14:01:22 6057 [ERROR] Incorrect definition of table mysql.column_stats: expected column &#39;hist_type&#39; at position 9 to have type enum(&#39;SINGLE_PREC_HB&#39;,&#39;DOUBLE_PREC_HB&#39;,&#39;JSON_HB&#39;), found type enum(&#39;SINGLE_PREC_HB&#39;,&#39;DOUBLE_PREC_HB&#39;).
db_1   | 2022-05-31 14:01:22 6057 [ERROR] Incorrect definition of table mysql.column_stats: expected column &#39;histogram&#39; at position 10 to have type longblob, found type varbinary(255).
db_1   | 2022-05-31 14:01:22 6057 [ERROR] Incorrect definition of table mysql.column_stats: expected column &#39;hist_type&#39; at position 9 to have type enum(&#39;SINGLE_PREC_HB&#39;,&#39;DOUBLE_PREC_HB&#39;,&#39;JSON_HB&#39;), found type enum(&#39;SINGLE_PREC_HB&#39;,&#39;DOUBLE_PREC_HB&#39;).
db_1   | 2022-05-31 14:01:22 6057 [ERROR] Incorrect definition of table mysql.column_stats: expected column &#39;histogram&#39; at position 10 to have type longblob, found type varbinary(255).
</code></pre><pre tabindex="0"><code>username@host:~/nextcloud$ docker exec -it nextcloud_db_1 /bin/bash
root@ec2620d59bb5:/# mysql_upgrade --user=root --password=YOUR_ROOT_PASSWORD
Phase 1/7: Checking and upgrading mysql database
Processing databases
mysql
mysql.column_stats                                 OK
mysql.columns_priv                                 OK
mysql.db                                           OK
mysql.event                                        OK
mysql.func                                         OK
mysql.global_priv                                  OK
mysql.gtid_slave_pos                               OK
mysql.help_category                                OK
mysql.help_keyword                                 OK
mysql.help_relation                                OK
mysql.help_topic                                   OK
mysql.index_stats                                  OK
mysql.innodb_index_stats                           OK
mysql.innodb_table_stats                           OK
mysql.plugin                                       OK
mysql.proc                                         OK
mysql.procs_priv                                   OK
mysql.proxies_priv                                 OK
mysql.roles_mapping                                OK
mysql.servers                                      OK
mysql.table_stats                                  OK
mysql.tables_priv                                  OK
mysql.time_zone                                    OK
mysql.time_zone_leap_second                        OK
mysql.time_zone_name                               OK
mysql.time_zone_transition                         OK
mysql.time_zone_transition_type                    OK
mysql.transaction_registry                         OK
Phase 2/7: Installing used storage engines... Skipped
Phase 3/7: Fixing views
mysql.user                                         OK
sys.host_summary                                   OK
sys.host_summary_by_file_io                        OK
sys.host_summary_by_file_io_type                   OK
sys.host_summary_by_stages                         OK
sys.host_summary_by_statement_latency              OK
sys.host_summary_by_statement_type                 OK
sys.innodb_buffer_stats_by_schema                  OK
sys.innodb_buffer_stats_by_table                   OK
sys.innodb_lock_waits                              OK
sys.io_by_thread_by_latency                        OK
sys.io_global_by_file_by_bytes                     OK
sys.io_global_by_file_by_latency                   OK
sys.io_global_by_wait_by_bytes                     OK
sys.io_global_by_wait_by_latency                   OK
sys.latest_file_io                                 OK
sys.memory_by_host_by_current_bytes                OK
sys.memory_by_thread_by_current_bytes              OK
sys.memory_by_user_by_current_bytes                OK
sys.memory_global_by_current_bytes                 OK
sys.memory_global_total                            OK
sys.metrics                                        OK
sys.processlist                                    OK
sys.ps_check_lost_instrumentation                  OK
sys.schema_auto_increment_columns                  OK
sys.schema_index_statistics                        OK
sys.schema_object_overview                         OK
sys.schema_redundant_indexes                       OK
sys.schema_table_lock_waits                        OK
sys.schema_table_statistics                        OK
sys.schema_table_statistics_with_buffer            OK
sys.schema_tables_with_full_table_scans            OK
sys.schema_unused_indexes                          OK
sys.session                                        OK
sys.session_ssl_status                             OK
sys.statement_analysis                             OK
sys.statements_with_errors_or_warnings             OK
sys.statements_with_full_table_scans               OK
sys.statements_with_runtimes_in_95th_percentile    OK
sys.statements_with_sorting                        OK
sys.statements_with_temp_tables                    OK
sys.user_summary                                   OK
sys.user_summary_by_file_io                        OK
sys.user_summary_by_file_io_type                   OK
sys.user_summary_by_stages                         OK
sys.user_summary_by_statement_latency              OK
sys.user_summary_by_statement_type                 OK
sys.version                                        OK
sys.wait_classes_global_by_avg_latency             OK
sys.wait_classes_global_by_latency                 OK
sys.waits_by_host_by_latency                       OK
sys.waits_by_user_by_latency                       OK
sys.waits_global_by_latency                        OK
sys.x$host_summary                                 OK
sys.x$host_summary_by_file_io                      OK
sys.x$host_summary_by_file_io_type                 OK
sys.x$host_summary_by_stages                       OK
sys.x$host_summary_by_statement_latency            OK
sys.x$host_summary_by_statement_type               OK
sys.x$innodb_buffer_stats_by_schema                OK
sys.x$innodb_buffer_stats_by_table                 OK
sys.x$innodb_lock_waits                            OK
sys.x$io_by_thread_by_latency                      OK
sys.x$io_global_by_file_by_bytes                   OK
sys.x$io_global_by_file_by_latency                 OK
sys.x$io_global_by_wait_by_bytes                   OK
sys.x$io_global_by_wait_by_latency                 OK
sys.x$latest_file_io                               OK
sys.x$memory_by_host_by_current_bytes              OK
sys.x$memory_by_thread_by_current_bytes            OK
sys.x$memory_by_user_by_current_bytes              OK
sys.x$memory_global_by_current_bytes               OK
sys.x$memory_global_total                          OK
sys.x$processlist                                  OK
sys.x$ps_digest_95th_percentile_by_avg_us          OK
sys.x$ps_digest_avg_latency_distribution           OK
sys.x$ps_schema_table_statistics_io                OK
sys.x$schema_flattened_keys                        OK
sys.x$schema_index_statistics                      OK
sys.x$schema_table_lock_waits                      OK
sys.x$schema_table_statistics                      OK
sys.x$schema_table_statistics_with_buffer          OK
sys.x$schema_tables_with_full_table_scans          OK
sys.x$session                                      OK
sys.x$statement_analysis                           OK
sys.x$statements_with_errors_or_warnings           OK
sys.x$statements_with_full_table_scans             OK
sys.x$statements_with_runtimes_in_95th_percentile  OK
sys.x$statements_with_sorting                      OK
sys.x$statements_with_temp_tables                  OK
sys.x$user_summary                                 OK
sys.x$user_summary_by_file_io                      OK
sys.x$user_summary_by_file_io_type                 OK
sys.x$user_summary_by_stages                       OK
sys.x$user_summary_by_statement_latency            OK
sys.x$user_summary_by_statement_type               OK
sys.x$wait_classes_global_by_avg_latency           OK
sys.x$wait_classes_global_by_latency               OK
sys.x$waits_by_host_by_latency                     OK
sys.x$waits_by_user_by_latency                     OK
sys.x$waits_global_by_latency                      OK
Phase 4/7: Running &#39;mysql_fix_privilege_tables&#39;
Phase 5/7: Fixing table and database names
Phase 6/7: Checking and upgrading tables
Processing databases
information_schema
nextcloud
nextcloud.oc_accounts                              OK
nextcloud.oc_accounts_data                         OK
nextcloud.oc_activity                              OK
nextcloud.oc_activity_mq                           OK
nextcloud.oc_addressbookchanges                    OK
nextcloud.oc_addressbooks                          OK
nextcloud.oc_appconfig                             OK
nextcloud.oc_authorized_groups                     OK
nextcloud.oc_authtoken                             OK
nextcloud.oc_bookmarks                             OK
nextcloud.oc_bookmarks_folders                     OK
nextcloud.oc_bookmarks_folders_public              OK
nextcloud.oc_bookmarks_root_folders                OK
nextcloud.oc_bookmarks_shared_folders              OK
nextcloud.oc_bookmarks_shared_to_shares            OK
nextcloud.oc_bookmarks_shares                      OK
nextcloud.oc_bookmarks_tags                        OK
nextcloud.oc_bookmarks_tree                        OK
nextcloud.oc_bruteforce_attempts                   OK
nextcloud.oc_calendar_appt_bookings                OK
nextcloud.oc_calendar_appt_configs                 OK
nextcloud.oc_calendar_invitations                  OK
nextcloud.oc_calendar_reminders                    OK
nextcloud.oc_calendar_resources                    OK
nextcloud.oc_calendar_resources_md                 OK
nextcloud.oc_calendar_rooms                        OK
nextcloud.oc_calendar_rooms_md                     OK
nextcloud.oc_calendarchanges                       OK
nextcloud.oc_calendarobjects                       OK
nextcloud.oc_calendarobjects_props                 OK
nextcloud.oc_calendars                             OK
nextcloud.oc_calendarsubscriptions                 OK
nextcloud.oc_cards                                 OK
nextcloud.oc_cards_properties                      OK
nextcloud.oc_circles_circle                        OK
nextcloud.oc_circles_event                         OK
nextcloud.oc_circles_member                        OK
nextcloud.oc_circles_membership                    OK
nextcloud.oc_circles_mount                         OK
nextcloud.oc_circles_mountpoint                    OK
nextcloud.oc_circles_remote                        OK
nextcloud.oc_circles_share_lock                    OK
nextcloud.oc_circles_token                         OK
nextcloud.oc_collres_accesscache                   OK
nextcloud.oc_collres_collections                   OK
nextcloud.oc_collres_resources                     OK
nextcloud.oc_comments                              OK
nextcloud.oc_comments_read_markers                 OK
nextcloud.oc_dav_cal_proxy                         OK
nextcloud.oc_dav_shares                            OK
nextcloud.oc_direct_edit                           OK
nextcloud.oc_directlink                            OK
nextcloud.oc_federated_reshares                    OK
nextcloud.oc_file_locks                            OK
nextcloud.oc_file_metadata                         OK
nextcloud.oc_filecache                             OK
nextcloud.oc_filecache_extended                    OK
nextcloud.oc_files_trash                           OK
nextcloud.oc_flow_checks                           OK
nextcloud.oc_flow_operations                       OK
nextcloud.oc_flow_operations_scope                 OK
nextcloud.oc_group_admin                           OK
nextcloud.oc_group_user                            OK
nextcloud.oc_groups                                OK
nextcloud.oc_jobs                                  OK
nextcloud.oc_known_users                           OK
nextcloud.oc_login_flow_v2                         OK
nextcloud.oc_migrations                            OK
nextcloud.oc_mimetypes                             OK
nextcloud.oc_mounts                                OK
nextcloud.oc_notifications                         OK
nextcloud.oc_notifications_pushhash                OK
nextcloud.oc_notifications_settings                OK
nextcloud.oc_oauth2_access_tokens                  OK
nextcloud.oc_oauth2_clients                        OK
nextcloud.oc_preferences                           OK
nextcloud.oc_privacy_admins                        OK
nextcloud.oc_profile_config                        OK
nextcloud.oc_properties                            OK
nextcloud.oc_ratelimit_entries                     OK
nextcloud.oc_reactions                             OK
nextcloud.oc_recent_contact                        OK
nextcloud.oc_schedulingobjects                     OK
nextcloud.oc_share                                 OK
nextcloud.oc_share_external                        OK
nextcloud.oc_storages                              OK
nextcloud.oc_storages_credentials                  OK
nextcloud.oc_systemtag                             OK
nextcloud.oc_systemtag_group                       OK
nextcloud.oc_systemtag_object_mapping              OK
nextcloud.oc_text_documents                        OK
nextcloud.oc_text_sessions                         OK
nextcloud.oc_text_steps                            OK
nextcloud.oc_trusted_servers                       OK
nextcloud.oc_twofactor_backupcodes                 OK
nextcloud.oc_twofactor_providers                   OK
nextcloud.oc_user_status                           OK
nextcloud.oc_user_transfer_owner                   OK
nextcloud.oc_users                                 OK
nextcloud.oc_vcategory                             OK
nextcloud.oc_vcategory_to_object                   OK
nextcloud.oc_webauthn                              OK
nextcloud.oc_whats_new                             OK
performance_schema
sys
sys.sys_config                                     OK
Phase 7/7: Running &#39;FLUSH PRIVILEGES&#39;
OK
root@ec2620d59bb5:/# 
</code></pre><p>Now it shoudl run again.</p>
<h1 id="sources">sources</h1>
<p><a href="https://community.home-assistant.io/t/mariadb-errors-after-update/424731">Home Assistant - Mariadb errors after update</a></p>
]]></content>
        </item>
        
        <item>
            <title>how to fix a incorrect fstab</title>
            <link>https://zerosec.xyz/posts/2022/fix-fstab/</link>
            <pubDate>Wed, 18 May 2022 12:00:18 +0200</pubDate>
            
            <guid>https://zerosec.xyz/posts/2022/fix-fstab/</guid>
            <description>&lt;p&gt;If you messed up your fstab you may can&amp;rsquo;t boot your linux machine. You will need a recovery usb or disk attached to the system, also a dual boot linux will do the job.&lt;/p&gt;</description>
            <content type="html"><![CDATA[<p>If you messed up your fstab you may can&rsquo;t boot your linux machine. You will need a recovery usb or disk attached to the system, also a dual boot linux will do the job.</p>
<p>Lets say you have missconfigured a fstab entry and the server is looping through the boot loader. You can fix the fstab file after booting from a recovery media with the following commands:</p>
<pre tabindex="0"><code>lvm vgscan -v
# this will show your vgs

vgchange -a y ubuntu-vg
# this will activate your vg with the name ubuntu-vg


lvs
# this will list your lvs

mkdir /mnt/mount
mount /dev/mapper/ubuntu-vg/ubuntu-lv /mnt/mount
</code></pre><p>Now your lv should be mounted and you can edit your fstab file under <code>/mnt/mount/etc/fstab</code>.</p>]]></content>
        </item>
        
        <item>
            <title>how to check if a private key does match with a csr or certificate</title>
            <link>https://zerosec.xyz/posts/2022/05/how-to-check-if-a-private-key-does-match-with-a-csr-or-certificate/</link>
            <pubDate>Mon, 16 May 2022 18:37:14 +0200</pubDate>
            
            <guid>https://zerosec.xyz/posts/2022/05/how-to-check-if-a-private-key-does-match-with-a-csr-or-certificate/</guid>
            <description>&lt;p&gt;In RSA public-key cryptography the private and the public key paar are methematically related by sharing the same modulus. The length of the modulus, express in bits, is the key length and should also be the same.&lt;/p&gt;</description>
            <content type="html"><![CDATA[<p>In RSA public-key cryptography the private and the public key paar are methematically related by sharing the same modulus. The length of the modulus, express in bits, is the key length and should also be the same.</p>
<p>To check that a private key matches the public key contained in a certificate signing request (CSR) and a certificate we have to check that the moduli of both keys are identical. This can be done with OpenSSL on Linux as follows:</p>
<h4 id="check-the-md5-hash-of-the-private-key">check the MD5 hash of the private key:</h4>
<pre tabindex="0"><code>openssl rsa -noout -modulus -in private.key | openssl md5
</code></pre><h4 id="check-the-md5-hash-of-the-csr">check the MD5 hash of the CSR:</h4>
<pre tabindex="0"><code>openssl req -noout -modulus -in cert.csr | openssl md5
</code></pre><h4 id="check-the-md5-hash-of-the-certificate">check the MD5 hash of the certificate:</h4>
<pre tabindex="0"><code>openssl x509 -noout -modulus -in cert.crt | openssl md5
</code></pre><p>If all three hashes match, the CSR, certificate and private key are compatible.</p>
<p>Also it is a nice thing to backup these things if you have to regenerate a CSR the private key is really essential.</p>]]></content>
        </item>
        
        <item>
            <title>How to organizing files</title>
            <link>https://zerosec.xyz/posts/2022/05/how-to-organizing-files/</link>
            <pubDate>Wed, 04 May 2022 11:21:14 +0200</pubDate>
            
            <guid>https://zerosec.xyz/posts/2022/05/how-to-organizing-files/</guid>
            <description>&lt;p&gt;This is a post about how to store files in a gerneralized and organized way.&lt;/p&gt;</description>
            <content type="html"><![CDATA[<p>This is a post about how to store files in a gerneralized and organized way.</p>
<p>In general computers dont care how files are stored. You can store all your holiday pictures inside your screenshot folder and it doesn&rsquo;t bother your computer. But we are thinking in a structurized and organized way. Organzing files can helps us to faster find them it can leading in better understanding, in indentifing relationsships between informations or data and also could reduce compexity of problems.</p>
<p>The topics of this post are filenaming, folder hierarchy and a best practice approach in organizing files. Why this is important? Data are representate by files are. They got shared between people, departments, companies and all this can get a real mess over time.</p>
<h2 id="1-filenaming">1. filenaming</h2>
<p>One of the most important things in organizing files is the naming. Naming is important to identify and associate data and files. it&rsquo;s like a heading. You will not read an article if the headline is not seems important or intressting for you.</p>
<p>We should difference between dirctory and file names. When directories are the logical grouping like pictures/ or videos/ than the filenames should be a specific representation of the data of a file pice 20220504_franz_0001.jpg.</p>
<figure class="figure-text-centered"
>
    
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  <img 
    sizes="(min-width: 35em) 1200px, 100vw"
    srcset='
    
      /posts/2022/05/how-to-organizing-files/2022-05-04%20screenshot_file_explorer_001_filenaming_hu36a6ccb71ccae7ef7eaa2d478fa1c1d6_71661_500x0_resize_box_3.png 500w
    
    
      , /posts/2022/05/how-to-organizing-files/2022-05-04%20screenshot_file_explorer_001_filenaming_hu36a6ccb71ccae7ef7eaa2d478fa1c1d6_71661_800x0_resize_box_3.png 800w
    
    
    '
    
      src="/posts/2022/05/how-to-organizing-files/2022-05-04%20screenshot_file_explorer_001_filenaming.png" 
    
    alt="Filenaming example"
  >

      <figcaption>
        <p>Filenaming example for screenshots</p>
    </figcaption>
  </figure>
<h3 id="11-date">1.1 date</h3>
<p>On approach could be: YEAR-MONTH-DAY for example 2022-05-04 or 20220504. So you can directly see how old files are. You can quick identify which files are the newest. Also there will be showed in most modern file explorer in a chronologic order when sorting for names.</p>
<h3 id="12-name">1.2 name</h3>
<p>Think on the first association you have viewing the files. For example images. When I&rsquo;m taking pictures of persons than the persons name is a good indentifier. Also locations, contries, cities, places are good indentifiers as well. If you storing movies than the release year, resolution and audio format could be used. It should summerize the content of the data as well as represent it&rsquo;s values.</p>
<h3 id="13-id-or-unique-filename">1.3 ID or unique filename</h3>
<p>This should be a no brainer. Increasing number like 001, 002 or 003 at the end is grouping.</p>
<h2 id="2-folder-hierarchy">2. folder hierarchy</h2>
<p>The 5+2 rule works the best for me. So In a directory you should only have 5+2 sub directories. This is made by a thesis about the human short term memory.</p>
<p>For work I have this hierarchy.</p>
<pre tabindex="0"><code>CUSTOMERNAME/
  PROJECTS/
    2021/
    2022/
      2022-01-01_PROJECTNAME_/
        Code/
        Documentation/
        Media/
        Misc/
        Tests/
</code></pre><h2 id="3-best-practice">3. best practice</h2>
<p>Use all this techniques will result in a more organized and structure file management. It will help you to faster find your files. Also It is a great way to recap your work.</p>
<p>my sources:
<a href="https://zapier.com/blog/organize-files-folders/">zapier.com</a></p>]]></content>
        </item>
        
        <item>
            <title>Import iSCSI storage in Ubuntu</title>
            <link>https://zerosec.xyz/posts/2022/05/import-iscsi-storage-in-ubuntu/</link>
            <pubDate>Wed, 04 May 2022 10:20:07 +0200</pubDate>
            
            <guid>https://zerosec.xyz/posts/2022/05/import-iscsi-storage-in-ubuntu/</guid>
            <description>&lt;p&gt;This post is about importing iSCSI devices in Ubuntu 20.04 LTS. This could be useful if you for example want share tape drives from your virtual tape library (VTL).&lt;/p&gt;</description>
            <content type="html"><![CDATA[<p>This post is about importing iSCSI devices in Ubuntu 20.04 LTS. This could be useful if you for example want share tape drives from your virtual tape library (VTL).</p>
<p>I&rsquo;m assumes that your iSCSI target is configured and working. I&rsquo;ve tested this under Ubuntu 20.04 LTS but it might also work under Ubutnu 18.04 and 22.04 LTS.</p>
<h2 id="installation">installation</h2>
<p>First we need to install open-iscsi for compatiblity of our Ubuntu OS</p>
<pre tabindex="0"><code>sudo apt install lsscsi open-iscsi
</code></pre><p>Next we have to setup some initial configuration<br>
<code>sudo vi /etc/iscsi/initiatorname.iscsi</code></p>
<pre tabindex="0"><code># DO NOT EDIT OR REMOVE THIS FILE!
...
# for each iSCSI initiator. Do NOT duplicate iSCSI InitiatorNames
InitiatorName=iqn.2006-06.com.quadstor.vtl.test.autoloader
</code></pre><p>And restart the service <code>sudo systemctl restart open-iscsi</code> also you can enable the service with <code>sudo systemctl enable open-iscsi</code> if you want the service to operate also after a reboots.</p>
<h2 id="configuration">configuration</h2>
<p>Let us check if our iSCSI target is working</p>
<pre tabindex="0"><code>$ sudo iscsiadm -m discovery -t sendtargets -p quadstor.lan
192.168.178.30:3260,1 iqn.2006-06.com.quadstor.vtl.test.autoloader
192.168.178.30:3260,1 iqn.2006-06.com.quadstor.vtl.test.drive1
192.168.178.30:3260,1 iqn.2006-06.com.quadstor.vtl.test.drive2
</code></pre><p>next we have to login into the iSCSI devices</p>
<pre tabindex="0"><code>sudo iscsiad -m node --loginall all
</code></pre><h2 id="checks">checks</h2>
<p><code>sudo shutdown -r now</code></p>]]></content>
        </item>
        
        <item>
            <title>Installing artixlinux a systemd-free archlinux with encryption and UEFI</title>
            <link>https://zerosec.xyz/posts/2022/01/installing-artixlinux-a-systemd-free-archlinux-with-encryption-and-uefi/</link>
            <pubDate>Thu, 13 Jan 2022 17:17:00 +0100</pubDate>
            
            <guid>https://zerosec.xyz/posts/2022/01/installing-artixlinux-a-systemd-free-archlinux-with-encryption-and-uefi/</guid>
            <description>Intro: I wish you all a new and healthy year. This post is all about installing artix linux (a systemd-free alternative to archlinux) with UEFI and &amp;ldquo;full&amp;rdquo; disk encryption (LVM on LUKS).
FDE - the term &amp;ldquo;full disk encryption&amp;rdquo; might be a off.. My setup exists out of two partitions boot and a LVM partition/physical volume (PV). The LVM partition contains two logical volumes (LV) root and swap where your user and system data will be saved are full encrypted.</description>
            <content type="html"><![CDATA[<h1 id="intro">Intro:</h1>
<p>I wish you all a new and healthy year. This post is all about installing artix linux (a systemd-free alternative to archlinux) with UEFI and &ldquo;full&rdquo; disk encryption (LVM on LUKS).</p>
<p>FDE - the term &ldquo;full disk encryption&rdquo; might be a off.. My setup exists out of two partitions boot and a LVM partition/physical volume (PV). The LVM partition contains two logical volumes (LV) root and swap where your user and system data will be saved are full encrypted. For more informations check out: <a href="https://wiki.archlinux.org/title/Dm-crypt/Encrypting_an_entire_system#LVM_on_LUKS">LVM on LUKS</a></p>
<p>The next part of this post is a to my preference customized combination from:</p>
<ul>
<li><a href="https://wiki.artixlinux.org/Main/Installation">Artix Linux Wiki - Installation</a></li>
<li><a href="https://wiki.artixlinux.org/Main/InstallationWithFullDiskEncryption">Artix Linux Wiki - Installation With Full Disk Encryption</a></li>
</ul>
<p>The whole installation process with all outputs and dialogs was cut down to in my opinion most important points/decisions i&rsquo;ve made.</p>
<p>Grab your 🍵 and lets go!</p>
<h2 id="installation">Installation</h2>
<h3 id="create-and-boot-from-uefi-usb">create and boot from UEFI usb</h3>
<p>I&rsquo;ve used etecher on my windows gaming machine.. Yeah shame on my. Real linux users would use:
Where if= stands for path to the artix_linux.iso and the of= for the path to the usb e.g. /dev/sdc</p>
<pre tabindex="0"><code>dd if=artix_linux.iso of=/dev/sdc bs=1M
</code></pre><p>When you boot from usb you should select the right keyboard layout. In my case: de. Than boot to launch the basic
artix linux from usb.</p>
<h3 id="preperations">preperations</h3>
<p>Also important to know. I have connected my notebook to ethernet and used dhcp to connect it with the internet.
I case you only have WIFI follow this instructions:
The login data are provided in the console log are artix:artix.</p>
<h4 id="partitioning--encrypting--mounting">Partitioning &amp; Encrypting &amp; Mounting</h4>
<p>I&rsquo;ve installed parted for partitioning my disks:</p>
<pre tabindex="0"><code>pacman -Sy parted
</code></pre><p>we need will need:</p>
<ul>
<li>MBR partition table on sda</li>
</ul>
<p>and at least two partitions</p>
<ul>
<li>on /dev/sda1 will be /boot</li>
<li>on /dev/sda2 will be our encrytped LVM</li>
</ul>
<p>show the actual partition list</p>
<pre tabindex="0"><code>parted -l
</code></pre><p>on my system was linux mint installed so there are some EFI (boot, esp) and ext4 partitions.. which we should delete first.</p>
<pre tabindex="0"><code>dd bs=4096 if=/dev/zero iflag=nocache of=/dev/sda oflag=direct status=progress
CTRL+C/CTRL+Z
sync
</code></pre><p>Now we will create the partitions</p>
<pre tabindex="0"><code>parted -s /dev/sda mklabel msdos
parted -s -a optimal /dev/sda mkpart &#34;primary&#34; &#34;fat16&#34; &#34;0%&#34; &#34;1024MiB&#34;
parted -s /dev/sda set 1 boot on
parted -s /dev/sda print
parted -s /dev/sda align check optimal 1
parted -s -a optimal /dev/sda mkpart &#34;primary&#34; &#34;ext4&#34; &#34;1024MiB&#34; &#34;100%&#34;
parted -s /dev/sda set 2 lvm on
</code></pre><p>awesome. Next we will encrypt the second partition with LUKS and create an LVM PV inside the LUKS container.</p>
<ul>
<li>cryptsetup for LUKS (linux unified key setup) creation</li>
<li>dm-crypt (device-mapper crypt)</li>
</ul>
<pre tabindex="0"><code>pacman -Sy cryptsetup dm-crypt
</code></pre><p>I&rsquo;ve benchmarked my notebook for best encryption performance:</p>
<pre tabindex="0"><code>cryptsetup benchmark
</code></pre><p>For me the following parameters are best. This could be different on your system so choose your personal best.
I&rsquo;VE CHANGED MY KEYBOARD_LAYOUT TO US BECAUSE GRUB WILL USE IT FOR ENTERING THE DECRYPTION PASSPHRASE TOO!</p>
<pre tabindex="0"><code>loadkeys us
cryptsetup --verbose --type luks1 --cipher aes-xts-plain64 --key-size 512 --hash whirlpool --iter-time 10000 --use-random --verify-passphrase luksFormat /dev/sda2
YES
ENTER PASSPHRASE 2-times
loadkeys de
</code></pre><p>now open encrypted luks partition/container</p>
<pre tabindex="0"><code>cryptsetup luksOpen /dev/sda2 lvm-system
</code></pre><p>create the physical volume inside the luks-container</p>
<pre tabindex="0"><code>pvcreate /dev/mapper/lvm-system
</code></pre><p>Now we can a create logical volumes and/inside our volume group</p>
<pre tabindex="0"><code>vgcreate lvmSystem /dev/mapper/lvm-system
lvcreate -L 16G lvmSystem -n volSwap
lvcreate -l 100%FREE lvmSystem -n volRoot
</code></pre><p>We have to format our logical volumes</p>
<pre tabindex="0"><code>mkfs.fat -n BOOT /dev/sda1
mkswap /dev/lvmSystem/volSwap
</code></pre><p>Creating the SWAP partition will output the UUID. Please write it down for later</p>
<pre tabindex="0"><code>UUID=738704ce-d966-6d66-84c6-e123456a2a7
</code></pre><p>Create the root parititon</p>
<pre tabindex="0"><code>mkfs.ext4 -L volRoot /dev/lvmSystem/volRoot
</code></pre><p>Now we finally can mount:</p>
<pre tabindex="0"><code>swapon /dev/lvmSystem/volSwap
mount /dev/lvmSystem/volRoot /mnt
mkdir /mnt/boot
mount /dev/sdX1 /mnt/boot
</code></pre><h3 id="base-installation">base installation</h3>
<pre tabindex="0"><code>basestrap /mnt base base-devel openrc elogind-openrc
basestrap /mnt linux linux-firmware
fstabgen -U /mnt &gt;&gt; /mnt/etc/fstab
</code></pre><p>If you are using solid state disks (SSDs) may considering:</p>
<pre tabindex="0"><code>sed -i &#34;s/ordered/ordered,discard/g&#34; /mnt/etc/fstab
</code></pre><p>Inform you about the advantages and disadvantages at: <a href="/">archlinux wiki</a></p>
<p>We can now chroot inside the base installation and modify/configure our linux</p>
<pre tabindex="0"><code>artix-chroot /mnt /bin/bash
</code></pre><p>First set/change the root password</p>
<pre tabindex="0"><code>passwd
</code></pre><p>Then install an editor and adjust the language</p>
<pre tabindex="0"><code>pacman -Sy vim
vim /etc/locale.gen
</code></pre><p>remove # from de<em>DE and en</em>US &hellip; UTF-8.</p>
<p>Now set the hostname</p>
<pre tabindex="0"><code>vim /etc/conf.d/hostname
</code></pre><p>add your language to locale.gen</p>
<pre tabindex="0"><code>echo LANG=de_DE.UTF-8 &gt; /etc/locale.conf
export LANG=de_DE.UTF-8
locale-gen
</code></pre><p>Edit the mkinitpico.conf</p>
<pre tabindex="0"><code>vim /etc/mkinitcpio.conf
HOOKS=(base udev autodetect modconf block encrypt keyboard keymap lvm2 resume filesystems fsck)

pacman -S lvm2 cryptsetup linux mkinitcpio
mkinitcpio -p linux
pacman -S grub
</code></pre><p>It&rsquo;s time to configure the bootloader grub</p>
<pre tabindex="0"><code>GRUB_TIMEOUT=15
GRUB*CMDLINE*LINUX_DEFAULT=&#34;quiet splash&#34;

# to get UUID from luks encrypted partition
:wq!

blkid /dev/sda2 &gt;&gt; /etc/default/grub

# now only copy the UUID from /dev/sda2 UUID=&#34;xxx-yyy&#34; into

GRUB*CMDLINE*LINUX_DEFAULT=&#34;cryptdevice=UUID=xxx-yyy:lvm-system loglevel=3 quiet resume=UUID=yyy net.ifnames=0&#34;
GRUB*ENABLE*CRYPTODISK=y

pacman -S os-prober efibootmgr
grub-install --target=x86_64-efi --efi-directory=/boot --bootloeader-id=grub (for UEFI systems)
grub-mkconfig -o /boot/grub/grub.conf WRONG should be .cfg
</code></pre><p>add your normal user</p>
<pre tabindex="0"><code>useradd -m YOURUSERNAME
passwd YOURUSERNAME
</code></pre><p>configure network</p>
<pre tabindex="0"><code>vim /etc/hosts

pacman -S dhcpcd
pacman -S cryptsetup-openrc device-mapper-openrc lvm2-openrc
</code></pre><p>now we can reboot</p>
<pre tabindex="0"><code>umount -R /mnt
swapoff -a
loginctl poweroff
</code></pre><h2 id="this-guide-will-be-continued">This Guide will be continued</h2>
]]></content>
        </item>
        
        <item>
            <title>Learning: Deep Learning and AI Part I</title>
            <link>https://zerosec.xyz/posts/2021/11/learning-deep-learning-and-ai-part-i/</link>
            <pubDate>Wed, 10 Nov 2021 15:52:53 +0100</pubDate>
            
            <guid>https://zerosec.xyz/posts/2021/11/learning-deep-learning-and-ai-part-i/</guid>
            <description>Intro: I&amp;rsquo;ve been meaning to publish a small introductory series for Deep Learning and AI on my blog. While I&amp;rsquo;m getting into the subject matter myself and trying to learn, some posts will record my progress and thoughts on the respective topics. To get started, this paper will focus on the use of linear regression. For this purpose, python and the scikit-learn module are used. I wish you a lot of fun!</description>
            <content type="html"><![CDATA[<h1 id="intro">Intro:</h1>
<p>I&rsquo;ve been meaning to publish a small introductory series for Deep Learning and AI on my blog. While I&rsquo;m getting into the subject matter myself and trying to learn, some posts will record my progress and thoughts on the respective topics. To get started, this paper will focus on the use of linear regression. For this purpose, python and the scikit-learn module are used. I wish you a lot of fun!</p>
<h1 id="what-are-coefficients">What are coefficients?</h1>
<p>In mathematics, a coefficient is a multiplicative factor in some term of a polynomial, a series, or any expression; it is usually a number, but may be any expression (including variables such as a, b and c). <a href="https://en.wikipedia.org/wiki/Coefficient">wikipedia.org</a></p>
<h1 id="where-are-they-used">Where are they used?</h1>
<p>Coefficients are used in all kinds of fields. In physics, chemistry, storastics, mathematics. I would like to restrict myself in this contribution to the physical and storastic uses. <a href="https://en.wikipedia.org/wiki/Coefficient">wikipedia.org</a></p>
<h1 id="linear-regression">linear regression</h1>
<p>Linear regression is a statistical technique that attempts to explain an observed dependent variable by one or more independent variables. In linear regression, a linear model is assumed. The goal in our application is to find a coefficient. <a href="https://en.wikipedia.org/wiki/Linear_regression">wikipedia.org</a></p>
<h1 id="example-1">Example 1</h1>
<p>Our task is to find the coefficient for converting kilometers to miles. We have been given input values x (in kilometers) and corresponding output values y (in miles). These values are not very accurate.
1km = 0.621 miles</p>
<pre tabindex="0"><code>x = [
	[10],
	[15],
	[30]
]

y = [
	[6.2],
	[9.3],
	[18.6],
]
</code></pre><p>Now we need to import the module, create the model and train it with our inputs and outputs.</p>
<pre tabindex="0"><code>from sklearn.linear_model import LinearRegression
model = LinearRegression(fit_intercept = False)
model.fit(x,y)
</code></pre><p>In this example the coefficient is 0.62152866 which is relativly close to the real 0.621.</p>
<pre tabindex="0"><code>model.coef_
array([[0.62152866]])
</code></pre><p>If we want to calculate/&ldquo;predict&rdquo; an output for a new value we use</p>
<pre tabindex="0"><code>model.predict([
	[120],
	[130]
])
</code></pre><p>The output will be 74.58343949 and 80.7872611.</p>
<h2 id="mention">mention</h2>
<p>In this example we disabled the so called intercept/&ldquo;bias&rdquo;. We will need to use it in the next example.</p>
<h1 id="example-2">example 2</h1>
<p>In our next task, we are to convert temperatures from degrees Celcius and degrees Fahrenheit. In this example we have to calculate with an offset also called intercept. This is because there is a constant in the conversion formula.</p>
<p>We have been given input values x (in ceclius) and corresponding output values y (in fahrenheit).</p>
<pre tabindex="0"><code>x = [
	[-10],
	[0],
	[20]
]

y = [
	[14],
	[32],
	[68],
]
</code></pre><p>Now we need to import the module, create the model and train it with our inputs and outputs again.</p>
<pre tabindex="0"><code>from sklearn.linear_model import LinearRegression
model = LinearRegression
model.fit(x,y)
</code></pre><p>We can output the coefficient and bias by:</p>
<pre tabindex="0"><code>print(&#34;coefficient: &#34; + str(model.coef_))
print(&#34;bias/offset: &#34; + str(model.intercept_))
</code></pre><p>The coefficient: 1.8 and bias: 32 based on our input and output values are right.</p>
<h1 id="conclusion">Conclusion</h1>
<p>By using sklearn, it is very easy to find linear relationships between input and output values.</p>
]]></content>
        </item>
        
        <item>
            <title>Setup a PowerWalker VI 1000 SCL UPS with nut in Debian 10 or Proxmox 7</title>
            <link>https://zerosec.xyz/posts/2021/08/setup-a-powerwalker-vi-1000-scl-ups-with-nut-in-debian-10-or-proxmox-7/</link>
            <pubDate>Thu, 19 Aug 2021 21:44:08 +0200</pubDate>
            
            <guid>https://zerosec.xyz/posts/2021/08/setup-a-powerwalker-vi-1000-scl-ups-with-nut-in-debian-10-or-proxmox-7/</guid>
            <description>Intro: We won&amp;rsquo;t call our infrastructure &amp;ldquo;safe&amp;rdquo; without running some &amp;#x1f50b;&amp;rsquo;s! This is how I set a PowerWalker VI 1000 SCL UPS from BlueWalker for my homeserver running proxmox. Also I modified the default shutdown procedure and added gotify notifications. Enjoy this post 😊
Installation: First we install the required package:
sudo apt install nut ez.
Configuration: UPS Lots of configuration needs to be done. Lets go! First we define nut to run in standalone mode.</description>
            <content type="html"><![CDATA[<h1 id="intro">Intro:</h1>
<p>We won&rsquo;t call our infrastructure &ldquo;safe&rdquo; without running some &#x1f50b;&rsquo;s! This is how I set a PowerWalker VI 1000 SCL UPS from BlueWalker for my homeserver running proxmox. Also I modified the default shutdown procedure and added gotify notifications. Enjoy this post 😊</p>
<h1 id="installation">Installation:</h1>
<p>First we install the required package:</p>
<pre tabindex="0"><code>sudo apt install nut
</code></pre><p><strong>ez.</strong></p>
<h1 id="configuration">Configuration:</h1>
<h2 id="ups">UPS</h2>
<p>Lots of configuration needs to be done. Lets go!
First we define nut to run in standalone mode.</p>
<pre tabindex="0"><code class="language-/bin/bash" data-lang="/bin/bash">vim /etc/nut/nut.conf
MODE=standalone
</code></pre><p>Now we have to tell nut how it should use our UPS</p>
<pre tabindex="0"><code class="language-/bin/bash" data-lang="/bin/bash">vim /etc/nut/ups.conf
[powerwalker]
    driver = blazer_usb
    port = auto  
    desc = &#34;PowerWalker UPS&#34;
</code></pre><p>nah. We are not done yet with driver stuff..</p>
<pre tabindex="0"><code class="language-/bin/bash" data-lang="/bin/bash">root@pve:~# lsusb
Bus 001 Device 002: ID 0665:5161 Cypress Semiconductor USB to Serial
</code></pre><p>This gives us the Attributes for udev.rules. We need this stuff to set permissions right for our UPS.
The importaint part is this: <strong>ID 0665:5161</strong></p>
<table>
<thead>
<tr>
<th>ATTR{idVendor}</th>
<th>ATTR{idProduct}</th>
</tr>
</thead>
<tbody>
<tr>
<td>0665</td>
<td>5161</td>
</tr>
</tbody>
</table>
<p>Now we can define our udev.rule:</p>
<pre tabindex="0"><code class="language-/bin/bash" data-lang="/bin/bash">vim /etc/udev/rules.d/90-nut-ups.rules
ACTION==&#34;add&#34;, \
SUBSYSTEM==&#34;usb&#34;, \
ATTR{idVendor}==&#34;0665&#34;, ATTR{idProduct}==&#34;5161&#34;, \
MODE=&#34;0660&#34;, GROUP=&#34;nut&#34;
</code></pre><p>to apply the udev.rules do the following:</p>
<pre tabindex="0"><code>udevadm control --reload-rules
udevadm trigger
</code></pre><p>If your UPS wont pull the USB cable and/or reboot the server. You should get this response:</p>
<pre tabindex="0"><code>upsdrvctl start

Supported UPS detected with mustek protocol
</code></pre><h2 id="upsd-our-ups-server">UPSd our UPS-server</h2>
<p>We only want access from our local maschine so:</p>
<pre tabindex="0"><code>vim /etc/nut/upsd.conf
ACL all 0.0.0.0/0
ACL localhost 127.0.0.1/32
ACCEPT localhost
REJECT all
</code></pre><p>add a user:</p>
<pre tabindex="0"><code>vim /etc/nut/upsd.users
[local_mon]
    password = SUPERPASSWORD
    allowfrom = localhost
    upsmon master
    instcmds = ALL
</code></pre><p>.. may adjust the password? Server is ready! &#x270c;&#xfe0f;</p>
<h2 id="upsmon-our-ups-client">UPSMon our UPS-client</h2>
<p>nothing to say here.</p>
<pre tabindex="0"><code>vim /etc/nut/upsmon.conf
MONITOR powerwalker@localhost 1 local_mon SUPERPASSWORD master
POWERDOWNFLAG /etc/killpower
SHUTDOWNCMD &#34;/sbin/shutdown -h now&#34;
</code></pre><h1 id="testing">Testing</h1>
<pre tabindex="0"><code>systemctl start nut-server
systemctl start nut-client
systemctl status nut-server
systemctl status nut-client
</code></pre><p>both services should run without any problems. may restart or check the logs. &#x1f918;</p>
<p>now you can do this:</p>
<pre tabindex="0"><code>root@pve:~# upsc powerwalker
Init SSL without certificate database
battery.charge: 100
battery.voltage: 27.50
battery.voltage.high: 26.00
battery.voltage.low: 20.80
battery.voltage.nominal: 24.0
device.type: ups
driver.name: blazer_usb
driver.parameter.pollinterval: 2
driver.parameter.port: auto
driver.parameter.synchronous: no
driver.version: 2.7.4
driver.version.internal: 0.12
input.current.nominal: 5.0
input.frequency: 50.0
input.frequency.nominal: 50
input.voltage: 230.7
input.voltage.fault: 230.7
input.voltage.nominal: 230
output.voltage: 230.7
ups.beeper.status: enabled
ups.delay.shutdown: 30
ups.delay.start: 180
ups.load: 0
ups.productid: 5161
ups.status: OL
ups.type: offline / line interactive
ups.vendorid: 0665
</code></pre><p>awsome! Here are all values from our UPS.</p>
<p>In my understanding these values are extracted directly from the ups-driver. You can add them in your ups.conf or override some if you want to disable the beeper:</p>
<pre tabindex="0"><code class="language-/bin/bash" data-lang="/bin/bash">upscmd -u local_mon -p SUPERSECRET powerwalker@localhost beeper.toggle
</code></pre><p>Run a battery test with (this turn&rsquo;s your server off):</p>
<pre tabindex="0"><code class="language-/bin/bash" data-lang="/bin/bash">upscmd -u local_mon -p mypass powerwalker@localhost test.battery.start.quick
</code></pre><h1 id="extra">extra</h1>
<p>I want my server to shutdown after 3min the power to USP turned off. So I modified /etc/nut/upscmon.conf and added:</p>
<pre tabindex="0"><code class="language-/bin/bash" data-lang="/bin/bash">NOTIFYFLAG ONBATT SYSLOG+WALL+EXEC
NOTIFYFLAG ONLINE SYSLOG+WALL+EXEC
NOTIFYCMD &#34;/etc/nut/notifycmd&#34;
</code></pre><p>The <strong>NOTIFYCMD</strong> will trigger the /etc/nut/notifycmd script below:</p>
<pre tabindex="0"><code class="language-/bin/bash" data-lang="/bin/bash">root@pve:~# cat /etc/nut/notifycmd 
#!/bin/bash
#
# NUT NOTIFYCMD script

PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/sbin:/usr/local/bin

trap &#34;exit 0&#34; SIGTERM

if [ &#34;$NOTIFYTYPE&#34; = &#34;ONLINE&#34; ]
then
        echo $0: power restored | wall
	/bin/curl &#34;https://YOUR-GOTIFY-URL/message?token=YOURTOKEN&#34; -F &#34;title=UPS MESSAGE&#34; -F &#34;message=running back on power&#34; -F &#34;priority=5&#34; &amp;
        # Cause all instances of this script to exit.
        killall -s SIGTERM `basename $0`
fi

if [ &#34;$NOTIFYTYPE&#34; = &#34;ONBATT&#34; ]
then
        echo $0: 3 minutes till system powers down... | wall
	/bin/curl &#34;https://YOUR-GOTIFY-URL/message?token=YOURTOKEN&#34; -F &#34;title=UPS MESSAGE&#34; -F &#34;message=shutdown server in 3min&#34; -F &#34;priority=5&#34; &amp;
        # Loop with one second interval to allow SIGTERM reception.
        let &#34;n = 180&#34;
        while [ $n -ne 0 ]
        do
                sleep 1
                let &#34;n--&#34;
        done
        echo $0: commencing shutdown | wall
	/bin/curl &#34;https://YOUR-GOTIFY-URL/message?token=YOURTOKEN&#34; -F &#34;title=UPS MESSAGE&#34; -F &#34;message=shutting down&#34; -F &#34;priority=5&#34; &amp;
        upsmon -c fsd
fi


### back in shell
root@pve:~# chmod +x /etc/nut/notifycmd
</code></pre><p>Now restart everything with:</p>
<pre tabindex="0"><code class="language-/bin/bash" data-lang="/bin/bash">systemctl restart nut-driver
systemctl restart nut-server
systemctl restart nut-monitor
systemctl restart nut-client
</code></pre><p>When you pull the plug from the USP and power comes back you will get this notifications in gotify:
<img alt="gotify notification example" src="/posts/2021/08/setup-a-powerwalker-vi-1000-scl-ups-with-nut-in-debian-10-or-proxmox-7/img/Screenshot_20210819-213959_Gotify.jpg" title="gotify notification example"></p>
<h1 id="conlusion">conlusion</h1>
<p>Now I feel even safer.. 😴💕</p>
<h1 id="sources">Sources:</h1>
<p><a href="https://blog.shadypixel.com/monitoring-a-ups-with-nut-on-debian-or-ubuntu-linux/">[1] blog.shadypixle.com</a></p>
<p><a href="https://thomas-leister.de/powerwalker-ups-debian-stretch/">[2] homas-leister.de</a></p>
<p><a href="https://linux.die.net/man/5/ups.conf">[3] ups.conf</a></p>
<p><a href="https://srackham.wordpress.com/2013/02/27/configuring-nut-for-the-eaton-3s-ups-on-ubuntu-linux/">[4] srackham.wordpress.com</a></p>
]]></content>
        </item>
        
        <item>
            <title>Privacy 101 - The Begin</title>
            <link>https://zerosec.xyz/posts/drafts/proxmox-lxc-provisioning/</link>
            <pubDate>Tue, 10 Aug 2021 21:42:06 +0200</pubDate>
            
            <guid>https://zerosec.xyz/posts/drafts/proxmox-lxc-provisioning/</guid>
            <description>Intro: sources [1] Peter Müller - https://crycode.de/openvpn-zugriff-auf-netzwerk-hinter-einem-client </description>
            <content type="html"><![CDATA[<h1 id="intro">Intro:</h1>
<h1 id="sources">sources</h1>
<ul>
<li><a href="https://crycode.de/openvpn-zugriff-auf-netzwerk-hinter-einem-client">[1] Peter Müller - https://crycode.de/openvpn-zugriff-auf-netzwerk-hinter-einem-client</a></li>
</ul>
]]></content>
        </item>
        
        <item>
            <title>Tunneling your LAN into your private OpenVPN network</title>
            <link>https://zerosec.xyz/posts/2021/08/tunneling-your-lan-into-your-private-openvpn-network/</link>
            <pubDate>Tue, 10 Aug 2021 21:42:06 +0200</pubDate>
            
            <guid>https://zerosec.xyz/posts/2021/08/tunneling-your-lan-into-your-private-openvpn-network/</guid>
            <description>Intro: In this post I want to show you my OpenVPN LAN tunneling solution 📶. I wanted to access my homeserver and NAS from outside my LAN. There are many options for this problem. You could setup a dynamic DNS service or write a script to report a changing public ip from your router. But you had to rely on for e.g. your DynDNS provider and.. yeah a public ip reporting script is shitty.</description>
            <content type="html"><![CDATA[<h1 id="intro">Intro:</h1>
<p>In this post I want to show you my OpenVPN LAN tunneling solution 📶. I wanted to access my homeserver and NAS from outside my LAN. There are many options for this problem. You could setup a dynamic DNS service or write a script to report a changing public ip from your router. But you had to rely on for e.g. your DynDNS provider and.. yeah a public ip reporting script is shitty.
Cool stuff you could do? Accessing your NAS, using your piHole to block ads or just remote control local computers and printers.</p>
<h1 id="requirements">requirements</h1>
<ul>
<li>you need a small VPS
<ul>
<li>I&rsquo;m using the stardust instance at <a href="scaleway.com">scaleway.com</a> (I am not getting paid by scaleway, it is just cheap)</li>
</ul>
</li>
<li>raspi, odroid or a small LXC container to run a OpenVPN client for 24/7</li>
<li>may adjust your LAN network address</li>
</ul>
<h1 id="setup">setup</h1>
<ol>
<li>install and configure the openvpn server on your VPS instance</li>
<li>create the VPN users</li>
<li>configure VPN client at your raspi or LXC container</li>
</ol>
<h2 id="install-and-configure-the-openvpn-server-on-your-vps-instance">install and configure the openvpn server on your VPS instance</h2>
<p>Well. I&rsquo;m lazy and others have create some pretty nice installation scripts. I&rsquo;ve used this: <a href="https://github.com/Angristan/OpenVPN-install">OpenVPN Install from Angristan at github.com</a></p>
<ul>
<li>there is many techical stuff if you want setup a secured openvpn server</li>
<li>if you don&rsquo;t have any knowledge about openvpn setups I recommend use this script</li>
</ul>
<pre tabindex="0"><code class="language-/bin/bash" data-lang="/bin/bash">curl -O https://raw.githubusercontent.com/angristan/openvpn-install/master/openvpn-install.sh
chmod +x openvpn-install.sh
</code></pre><p>This command download the installation script and make it executeable.</p>
<p>The next step is to run it.</p>
<pre tabindex="0"><code class="language-/bin/bash" data-lang="/bin/bash">./openvpn-install.sh
</code></pre><p>It will install and configure your openvpn server automatically. The setup is interactive and you could change many stuff if you want. We will adjust some settings later.</p>
<h2 id="create-the-vpn-users">create the VPN users</h2>
<pre tabindex="0"><code class="language-/bin/bash" data-lang="/bin/bash">yourusername@yourservername:~/openvpn# ./openvpn-install.sh 
Welcome to OpenVPN-install!
The git repository is available at: https://github.com/angristan/openvpn-install

It looks like OpenVPN is already installed.

What do you want to do?
   1) Add a new user
   2) Revoke existing user
   3) Remove OpenVPN
   4) Exit
Select an option [1-4]: 1

Tell me a name for the client.
The name must consist of alphanumeric character. It may also include an underscore or a dash.
Client name: ENTER_YOUR_CLIENTNAME

Do you want to protect the configuration file with a password?
(e.g. encrypt the private key with a password)
   1) Add a passwordless client
   2) Use a password for the client
Select an option [1-2]: 1

... 

Write out database with 1 new entries
Data Base Updated

Client ENTER_YOUR_CLIENTNAME added.

The configuration file has been written to /yourusername/ENTER_YOUR_CLIENTNAME.ovpn.
Download the .ovpn file and import it in your OpenVPN client.
</code></pre><p>Now just download your .ovpn files to your client maschines. For example with:</p>
<pre tabindex="0"><code class="language-/bin/bash" data-lang="/bin/bash">scp yourusername@server:/PATHTOFILE ~/Downloads/CLIENT.ovpn
</code></pre><p><em>(you need to exchange ssh keys with ssh-copy-id before)</em></p>
<p>Then just import the .ovpn file and test the connection.</p>
<h2 id="configure-your-lan-to-vpn-client">configure your LAN to VPN client</h2>
<p>In my case I&rsquo;m using an LXC container at my proxmox homeserver. I&rsquo;m using a Ubuntu template for the container so..</p>
<p>to setup openvpn in my lxc container</p>
<pre tabindex="0"><code class="language-/bin/bash" data-lang="/bin/bash">sudo apt-get install openvpn
</code></pre><p>than we copy our created and downloaded .ovpn file to the server and move it to:</p>
<pre tabindex="0"><code class="language-/bin/bash" data-lang="/bin/bash">cp ~/client.ovpn /etc/openvpn/vpn-gw.conf
</code></pre><p>now we activate ip-forwarding and some NAT-rules for iptables</p>
<pre tabindex="0"><code class="language-/bin/bash" data-lang="/bin/bash">sudo sysctl -w net/ipv4/ip_forward=1
sudo iptables -t nat -F POSTROUTING
sudo iptables -t nat -A POSTROUTING -o eth0 -s 10.8.0.0/24 -j MASQUERADE
</code></pre><p>for loading this settings after reboot create a /etc/rc.local textfile and insert:</p>
<pre tabindex="0"><code class="language-/bin/bash" data-lang="/bin/bash">root@openvpn-client:~# cat /etc/rc.local 
#!/bin/bash

echo 1 &gt; /proc/sys/net/ipv4/ip_forward

iptables -t nat -F POSTROUTING
iptables -t nat -A POSTROUTING -o eth0 -s 10.8.0.0/24 -j MASQUERADE

exit 0
</code></pre><p>now we start and enable our openVPN client service with:</p>
<pre tabindex="0"><code>sudo ln -s /lib/systemd/system/openvpn@.service /etc/systemd/system/openvpn@vpn-gw.service
sudo systemctl start openvpn@vpn-gw.service
</code></pre><h2 id="adjust-the-openvpn-server-settings">adjust the openvpn server settings</h2>
<p>add the following lines to your /etc/openvpn/server.conf</p>
<pre tabindex="0"><code class="language-/bin/bash" data-lang="/bin/bash">client-config-dir ccd

;route 192.168.1.0 255.255.255.0 # optional route to your LAN from openvpn client maschine

push &#34;route 192.168.1.0 255.255.255.0&#34; # route for all openvpn user devices

push &#34;dhcp-option DNS 192.168.1.1&#34; # your pihole for example
push &#34;dhcp-option DNS 1.1.1.1&#34; # some other nice dns servers
push &#34;dhcp-option DNS 1.0.0.1&#34;
</code></pre><p>also we have to create the directory /etc/openvpn/ccd</p>
<pre tabindex="0"><code class="language-/bin/bash" data-lang="/bin/bash">mkdir /etc/openvpn/ccd
touch /etc/openvpn/ccd/vpn-gw
vim /etc/openvpn/ccd/vpn-gw

ifconfig-push 10.8.0.50 255.255.255.0 # static ip for your openvpn lan client maschine

iroute 192.168.1.0 255.255.255.0 # internal routing to the lan from this client
</code></pre><p>now we only restart the openvpn server</p>
<pre tabindex="0"><code class="language-/bin/bash" data-lang="/bin/bash">sudo systemctl restart openvpn
</code></pre><h1 id="sources">sources</h1>
<ul>
<li><a href="https://crycode.de/openvpn-zugriff-auf-netzwerk-hinter-einem-client">[1] Peter Müller - https://crycode.de/openvpn-zugriff-auf-netzwerk-hinter-einem-client</a></li>
</ul>
]]></content>
        </item>
        
        <item>
            <title>My favorite Android apps</title>
            <link>https://zerosec.xyz/posts/2021/08/my-favorite-android-apps/</link>
            <pubDate>Wed, 04 Aug 2021 14:40:00 +0200</pubDate>
            
            <guid>https://zerosec.xyz/posts/2021/08/my-favorite-android-apps/</guid>
            <description>Intro: Here is a list of my favorite android apps in 2021 👏. The most apps are free and open source and also check out the source code! The list: QR/Barcode Scanner App: BinaryEye (FOSS SourceCode from github.com) Download: F-DROID GOOGLE PLAY Notification App: Gotify (FOSS SourceCode from github.com) Download: F-DROID GOOGLE PLAY </description>
            <content type="html"><![CDATA[<h2 id="intro">Intro:</h2>
<ul>
<li>Here is a list of my favorite android apps in 2021 👏. The most apps are free and open source and also check out the source code!</li>
</ul>
<h2 id="the-list">The list:</h2>
<ul>
<li>QR/Barcode Scanner App: BinaryEye (FOSS <a href="https://github.com/markusfisch/BinaryEye">SourceCode from github.com</a>)
<ul>
<li>Download: <a href="https://f-droid.org/en/packages/de.markusfisch.android.binaryeye/">F-DROID</a> <a href="https://play.google.com/store/apps/details?id=de.markusfisch.android.binaryeye">GOOGLE PLAY</a></li>
</ul>
</li>
<li>Notification App: Gotify (FOSS <a href="https://github.com/gotify/android">SourceCode from github.com</a>)
<ul>
<li>Download: <a href="https://f-droid.org/de/packages/com.github.gotify/">F-DROID</a> <a href="https://play.google.com/store/apps/details?id=com.github.gotify">GOOGLE PLAY</a></li>
</ul>
</li>
</ul>
]]></content>
        </item>
        
        <item>
            <title>KVM and Vagrant for automated deployment</title>
            <link>https://zerosec.xyz/posts/2021/07/kvm-and-vagrant-for-automated-deployment/</link>
            <pubDate>Tue, 13 Jul 2021 23:46:42 +0200</pubDate>
            
            <guid>https://zerosec.xyz/posts/2021/07/kvm-and-vagrant-for-automated-deployment/</guid>
            <description>Intro: For my university degree 🎓 I have to code a plugable microservice for iRODS. In this blog post, I document the process from conception, modeling to implementation and testing an automated two server deployment with vagrant and KVM as provider.
Setting up KVM requirements I&amp;rsquo;m running an debian based distro so I&amp;rsquo;m working with apt package manager. To verify that our CPU supports virtualization use this command:
egrep -c &amp;#39;(svm|vmx)&amp;#39; /proc/cpuinfo 8 If the command returns 0 your CPU does not support hardware virtualization.</description>
            <content type="html"><![CDATA[<h1 id="intro">Intro:</h1>
<p>For my university degree 🎓 I have to code a plugable microservice for iRODS. In this blog post, I document the process from conception, modeling to implementation and testing an automated two server deployment with vagrant and KVM as provider.</p>
<h2 id="setting-up-kvm">Setting up KVM</h2>
<h3 id="requirements">requirements</h3>
<p>I&rsquo;m running an debian based distro so I&rsquo;m working with apt package manager. To verify that our CPU supports virtualization use this command:</p>
<pre tabindex="0"><code class="language-/bin/bash" data-lang="/bin/bash">egrep -c &#39;(svm|vmx)&#39; /proc/cpuinfo
8
</code></pre><p>If the command returns 0 your CPU does not support hardware virtualization.</p>
<h3 id="install-kvm">Install KVM</h3>
<pre tabindex="0"><code class="language-/bin/bash" data-lang="/bin/bash">sudo apt-get install qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils virt-manager
</code></pre><p>Add your user to the libvirt and kvm group with the following commands. Replace <em>$USERNAME</em> with your real username.</p>
<pre tabindex="0"><code class="language-/bin/bash" data-lang="/bin/bash">sudo usermod -aG libvirt $USERNAME
$ sudo usermod -aG kvm $USERNAME
</code></pre><h3 id="verify-kvm-installation">Verify KVM Installation</h3>
<pre tabindex="0"><code class="language-/bin/bash" data-lang="/bin/bash">virsh -c qemu:///system list
</code></pre><h2 id="setting-up-vagrant">Setting up vagrant</h2>
<pre tabindex="0"><code class="language-/bin/bash" data-lang="/bin/bash">sudo apt install qemu libvirt-daemon-system libvirt-clients libxslt-dev libxml2-dev libvirt-dev zlib1g-dev ruby-dev ruby-libvirt ebtables dnsmasq-base vagrant
</code></pre><pre tabindex="0"><code class="language-/bin/bash" data-lang="/bin/bash">vagrant plugin install vagrant-libvirt
</code></pre><p>sources:</p>
<ul>
<li><a href="https://ostechnix.com/how-to-use-vagrant-with-libvirt-kvm-provider/">How To Use Vagrant With Libvirt KVM Provider - ostechnix.com</a></li>
<li><a href="https://linuxhint.com/install_kvm_virtualization_ubuntu/">Install KVM Virtualization on Linux Mint 20 - linuxhint.com</a></li>
</ul>
]]></content>
        </item>
        
        <item>
            <title>DIY Proxmox homeserver</title>
            <link>https://zerosec.xyz/posts/2021/07/diy-proxmox-homeserver/</link>
            <pubDate>Mon, 12 Jul 2021 14:10:56 +0200</pubDate>
            
            <guid>https://zerosec.xyz/posts/2021/07/diy-proxmox-homeserver/</guid>
            <description>Homeserver
Intro: There is a time in life of an sysadmins where he needs to bring all his services, data and projects back home. I was considering to buy a 4-Bay-NAS from Synology or Asustor. But I think I&amp;rsquo;ve build something better and more flexible for less money. A Synology DS920+ 4-Bay 12TB Bundle with 4X 3TB HDDs costs about 920€. So I set my budget limit to be less than 1000€ for more storage and more compute power.</description>
            <content type="html"><![CDATA[<p>Homeserver</p>
<h2 id="intro">Intro:</h2>
<p>There is a time in  life of an sysadmins where he needs to bring all his services, data and projects back home. I was considering to buy a 4-Bay-NAS from Synology or Asustor. But I think I&rsquo;ve build something better and more flexible for less money. A Synology DS920+ 4-Bay 12TB Bundle with 4X 3TB HDDs costs about 920€. So I set my budget limit to be less than 1000€ for more storage and more compute power. So this is my homeserver-build.</p>
<h2 id="hardware">Hardware</h2>
<p><strong>!!!IF YOU WANT TO BUILD THIS BY YOUR OWN PLEASE BY A CPU WITH GRAPHICS!!!</strong></p>
<ul>
<li>Case: Chieftec Gaming Cube (CI-01B-OP) for 48€</li>
<li>Processor: Intel i3 9100F for 122€
<ul>
<li><em>please buy a i3-9100 or i3-9100T WITH iGPU</em></li>
</ul>
</li>
<li>Mainboard: Fujitsu D3644-B Intel C246 So.1151 Dual Channel DDR for 153€</li>
<li>RAM: 2x 16GB REG ECC DDR4 Samsung for 85€ (used)
<ul>
<li><del>REG ECC is not working with this board :(</del></li>
<li>brought unregistered ECC UDIMM ECC RAM</li>
</ul>
</li>
<li>SSD: Samsung 980 1 TB PCIe 3.0 (up to 3.500 MB/s) NVMe M.2 Internes Solid State Drive (SSD) (MZ-V8V1T0BW) for 110€
<ul>
<li>_should have about 600TBW (lasting ~25 years)</li>
</ul>
</li>
<li>HDD: 3x 4000GB Seagate IronWolf (ST4000VN008) 3x 100€ = 300€ total
<ul>
<li><em>best price and performance overall for my use-case</em></li>
</ul>
</li>
<li>Power: 300 Watt be quiet! Pure Power 11 Non-Modular 80+ Bronze 38€
<ul>
<li><em>should be enough</em></li>
</ul>
</li>
<li>Fans: ~ 30€
<ul>
<li>3x Arctic P12 PWM 120x120x25mm 200-1800 U/min</li>
</ul>
</li>
</ul>
<p>💸 = 1025€</p>
<h2 id="software">Software</h2>
<p>As hypervisor for my homeserver I&rsquo;m using <a href="https://www.proxmox.com/en/">Proxmox 7 CE</a></p>
<h2 id="storage">Storage</h2>
<ul>
<li>NVMe: used for proxmox os and vm&rsquo;s</li>
<li>3x HDDs are setup as RAID-Z1 and provide a 8TB pool</li>
</ul>
<p>Also I&rsquo;m using a 8TB external HDD for regulary backups every 14 days.</p>
<h3 id="the-raid-z1">The RAID-Z1</h3>
<p><strong>Theory</strong></p>
<ul>
<li>
<p>with this setup one disk can fail without crashing the whole RAID</p>
</li>
<li>
<p>if one disk fails it must be replaced immediately</p>
</li>
<li>
<p>calculate avaiable storage for RAID-Z1 (Single parity with variable stripe width)
$$\ raw\ storage\ capacity=(N-1) \cdot S(min)$$
$$N=total\ number\ of\ disks$$
$$S(min)=smallest\ disks\ size$$</p>
</li>
<li>
<p>in my case: $$(3-1) \cdot 4000GB = 8000GB = 8TB$$</p>
</li>
<li>
<p>online calculator <a href="https://wintelguy.com/zfs-calc.pl">wintelguy.com</a></p>
</li>
</ul>
<p><del><strong>cache and log</strong>
The maximum size of a log device should be about half the size of physical memory, so this is usually quite small. The rest of the SSD can be used as cache.
I have an 1000GB SSD and 32GB RAM. So my log should be about 16GB and the rest can be used as cache.</del></p>
<ul>
<li>after some more research I think an SSD Cache is not useful for my purpose</li>
</ul>
<h3 id="monitoring">Monitoring</h3>
<ul>
<li>to monitor all disks I followed this guide: <a href="https://pve.proxmox.com/wiki/Disk_Health_Email_Alerts">Disk Health Email Alerts</a></li>
</ul>
<h2 id="conclusion">Conclusion</h2>
<p>The project has already made me headaches. Especially the i3-9100F without iGPU&hellip; Nevertheless, I am happy about the server and the possibilities it provides me.</p>
]]></content>
        </item>
        
        <item>
            <title>Gotify as notification service</title>
            <link>https://zerosec.xyz/posts/2021/07/gotify-as-notification-service/</link>
            <pubDate>Fri, 09 Jul 2021 10:16:26 +0200</pubDate>
            
            <guid>https://zerosec.xyz/posts/2021/07/gotify-as-notification-service/</guid>
            <description>Intro: You want to sleep calmly through the night? 😴 For security reasons I wan&amp;rsquo;t to get notified if something happens on my servers. My way to go is to use gotify instead of using for example the default email/sendmail way. Gotify is a simple, open source, MIT-licensed, docker deployable, push-messaging implementation in golang. It is lightweight, fast, and intuitive. Another great thing is the android app. Also it is free and open source.</description>
            <content type="html"><![CDATA[<h2 id="intro">Intro:</h2>
<p>You want to sleep calmly through the night? 😴 For security reasons I wan&rsquo;t to get notified if something happens on my servers. My way to go is to use gotify instead of using for example the default email/sendmail way.
Gotify is a simple, open source, MIT-licensed, docker deployable, push-messaging implementation in golang. It is lightweight, fast, and intuitive. Another great thing is the android app. Also it is free and open source. So you can receive instant gotify messages on android devices as well as on every notebook or desktop computer with a browser like firefox installed on.</p>
<h2 id="installation">Installation</h2>
<p>We need a gotify server to use the services.</p>
<p>For the server installation take a quick look at the <a href="https://gotify.net/docs/install">Installation Guide</a> from the officall site. It is very easy to setup up a gotify server.</p>
<p>I&rsquo;m using the docker-compose installation method by <a href="https://www.portainer.io/">portrainer</a>. You could also use rancher with an kubernetes cluster.</p>
<p>my docker-compose.yml looks like:</p>
<pre tabindex="0"><code>version: &#34;3&#34;

services:
  gotify:
    image: gotify/server
    ports:
      - 8080:80
    environment:
      - GOTIFY_DEFAULTUSER_PASS=SECRET # YOU SHOULD CHANGE THIS
	  - TZ=&#34;Europe/Berlin&#34;
    volumes:
      - &#34;./gotify_data:/app/data&#34;
</code></pre><p>Use <code>docker-compose up -d</code> to start the docker instance.</p>
<p>Alternatively you could use the binary to run the gotify server without docker. Just check out their website.</p>
<h2 id="configuration">configuration</h2>
<p>In my <strong>docker-compose.yml</strong> environment variables I have defined the administrator password as <em>SECRET</em>. So the initial login will work with admin:SECRET. Onced login the administrator password should be changed!</p>
<p>When you first login in and change the password you could also create another user MENU &ndash;&gt; USERS. It is best practice to not use the admin account or a user with admin privilages.</p>
<p>The next step is to add apps you wan&rsquo;t to connect with gotify. I&rsquo;m using a different api-key and api-token for every app. In my example I wan&rsquo;t to show you an SSH login notification. So I called the app <em><strong>sshnotify</strong></em>.</p>
<p>The simplest way to push messages with gotify under linux is:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>$ curl <span style="color:#e6db74">&#34;https://push.example.de/message?token=&lt;apptoken&gt;&#34;</span> -F <span style="color:#e6db74">&#34;title=my title&#34;</span> -F <span style="color:#e6db74">&#34;message=my message&#34;</span> -F <span style="color:#e6db74">&#34;priority=5&#34;</span>
</span></span><span style="display:flex;"><span>$ http -f POST <span style="color:#e6db74">&#34;https://push.example.de/message?token=&lt;apptoken&gt;&#34;</span> title<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;my title&#34;</span> message<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;my message&#34;</span> priority<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;5&#34;</span>
</span></span></code></pre></div><p>so you only have to add your apptoken to the URL and change the selfexplaining parameters to your use.</p>
<p>Here is the script for the ssh-login-notification.
I got it from: <a href="https://peekread.info/tech/20190716-ssh-login-notifications-with-gotify/">peekread.info</a> check also out his awesome blog!</p>
<pre tabindex="0"><code>#!/bin/bash

exec &amp;&gt; /dev/null #Hide output

Gotify_URL=&#39;https://gotify.stecher.space&#39;
Gotify_Token=&#39;AQ_TZBdcy-U13FG&#39;

notify()
{

        now=$(date -d &#34;-60 seconds&#34; +%s) #Get current time minus 60 seconds
        end=$((SECONDS+30)) #Set 30s Timeout for loop

        while [ $SECONDS -lt $end ]; do

                SSHdate=$(date -d &#34;$(who |grep pts|tail -1 | awk &#39;{print $3, $4}&#39;)&#34; +%s) #Check for the latest SSH session

                if [ $SSHdate -ge $now ]; then #Once who is updated continue with sending Notification

                        title=&#34;SSH Login for $(/bin/hostname -f)&#34;
                        message=&#34;$(/usr/bin/who | tr -s &#39; &#39;)&#34;

                        /usr/bin/curl -X POST -s \
                                -F &#34;title=${title}&#34; \
                                -F &#34;message=${message}&#34; \
                                -F &#34;priority=5&#34; \
                                &#34;${Gotify_URL}/message?token=${Gotify_Token}&#34;

                        break
                fi
        done

}

notify &amp; #Run in background to prevent holding up the login process
</code></pre><p>Next step is to set executive privileges
<code>chmod +x /usr/local/bin/sshnotif</code></p>
<p>And lastly edit the following file</p>
<pre tabindex="0"><code>user@hostname:~$ vi /etc/pam.d/sshd
session optional pam_exec.so /usr/local/bin/sshnotif
</code></pre><p>optional because if the script fail you still want to get logged in.</p>
<h2 id="conclusion">conclusion</h2>
<p>I really love how easy gotify could be used to get push-notifications. The possibilties are endless. My next plans are to send automated notifications for:</p>
<ul>
<li>security audits</li>
<li>finished backups</li>
<li>notification if storage usage is above 70%</li>
</ul>
<p>All this checks could run via cronjob and are fastly and easy written. Even if gotify apptoken gets leaked it cannot be abused to distribute spam and viruses like an email service.</p>
]]></content>
        </item>
        
        <item>
            <title>Backup your Android Phone without ADB</title>
            <link>https://zerosec.xyz/posts/2020/12/backup-your-android-phone-without-adb/</link>
            <pubDate>Wed, 09 Dec 2020 14:11:00 +0100</pubDate>
            
            <guid>https://zerosec.xyz/posts/2020/12/backup-your-android-phone-without-adb/</guid>
            <description>Intro: I have been looking for a way to backup my android phone regularly and easily. For security reasons I dont want to enable android developer options like usb debugging. My backup strategy is to store the data locally on my hard drive and then pack and encrypt the files and uploading them into my cloud.
Link to the awesome adbackup script by BojanStipic
Example You have to create the same folder structure like your phone generates by connecting in MTP mode.</description>
            <content type="html"><![CDATA[<h1 id="intro">Intro:</h1>
<p>I have been looking for a way to backup my android phone regularly and easily. For security reasons I dont want to enable android developer options like usb debugging. My backup strategy is to store the data locally on my hard drive and then  pack and encrypt the files and uploading them into my cloud.</p>
<p><a href="https://github.com/BojanStipic/adbackup">Link to the awesome adbackup script by BojanStipic</a></p>
<h1 id="example">Example</h1>
<p>You have to create the same folder structure like your phone generates by connecting in MTP mode.</p>
<pre tabindex="0"><code>fnz@os:/run/user/1000/gvfs/mtp:host=ANDROID_PHONE$ tree -L 2
├── Card
│   ├── Alarms
│   ├── Android
│   ├── DCIM
│   ├── Documents
│   ├── Download
│   ├── Memes
│   ├── Movies
│   ├── Music
│   ├── Notifications
│   ├── Podcasts
│   ├── Ringtones
│   ├── Sync
└── Phone
   ├── DCIM
    ├── Documents
    ├── Download
    ├── Pictures
    ├── Podcasts
    ├── Ringtones
</code></pre><p>filesystem example with selected folders for backup</p>
<pre tabindex="0"><code>fnz@pop-os:/media/fnz/Volume/backup/phone$ tree 
.
├── Card
│   ├── DCIM
└── Phone
    └── DCIM
</code></pre><p>now just launch the script with the given path to your backup folder <code>adbackup /media/fnz/Volume/backup/phone</code></p>
<p>output should look like this:</p>
<pre tabindex="0"><code>fnz@pop-os:~/code/sh/adbackup$ adbackup /media/fnz/Volume/backup/phone
Device:


Backup root directory:
/media/fnz/Volume/backup/phone

Leaf directories found: 
sed: -e expression #1, char 11: unknown option to `s&#39;

Continue? [Y/n] Y
sending incremental file list
./
Camera/
Camera/20200606_194225.mp4
Camera/20200607_162134.jpg
Camera/20200607_162139.jpg
...
</code></pre><h1 id="conclusion">CONCLUSION</h1>
<p>the script will create incremental backups when run repeatedly. It is suitable for those who do not want to share developer / usb debugging permissions for their android smartphone. in case of theft and the possibility of future android debugging exploits, it is for me a reliable and secure way to backup my android phone.</p>
]]></content>
        </item>
        
        <item>
            <title>Simple LACP Ubuntu 18.04/20.04 configuration</title>
            <link>https://zerosec.xyz/posts/2020/11/simple-lacp-ubuntu-18.04/20.04-configuration/</link>
            <pubDate>Tue, 10 Nov 2020 20:37:08 +0100</pubDate>
            
            <guid>https://zerosec.xyz/posts/2020/11/simple-lacp-ubuntu-18.04/20.04-configuration/</guid>
            <description>&lt;p&gt;You want to learn how to setup LACP in Ubuntu 18.04/20.04? Take a look!&lt;/p&gt;</description>
            <content type="html"><![CDATA[<p>You want to learn how to setup LACP in Ubuntu 18.04/20.04? Take a look!</p>
<h1 id="intro">Intro:</h1>
<p>I was struggling with the new netplan configuration options under Ubuntu 18.04 LTS or Ubuntu 20.04.1 LTS. In this post I will you will find to production ready configurationexamples. The first with simple LACP and the second with a bit advanced + VLAN on bond. I hope this configuration will help you guys. Works for me like a charm.</p>



























<img 
  sizes="(min-width: 35em) 1200px, 100vw"
  srcset='
  
    /posts/2020/11/simple-lacp-ubuntu-18.04/20.04-configuration/ubuntu_hu2485b8c81b6eda981f8b2a85c7f126ef_304798_500x0_resize_q75_box.jpg 500w
  
  
    , /posts/2020/11/simple-lacp-ubuntu-18.04/20.04-configuration/ubuntu_hu2485b8c81b6eda981f8b2a85c7f126ef_304798_800x0_resize_q75_box.jpg 800w
  
  
    , /posts/2020/11/simple-lacp-ubuntu-18.04/20.04-configuration/ubuntu_hu2485b8c81b6eda981f8b2a85c7f126ef_304798_1200x0_resize_q75_box.jpg 1200w
  
  
    , /posts/2020/11/simple-lacp-ubuntu-18.04/20.04-configuration/ubuntu_hu2485b8c81b6eda981f8b2a85c7f126ef_304798_1500x0_resize_q75_box.jpg 1500w 
  '
  
    src="/posts/2020/11/simple-lacp-ubuntu-18.04/20.04-configuration/ubuntu.jpg" 
  
  alt="picture of fiber interfaces"
>
<p>The first thing to learn is how to set interfaces up and down</p>
<pre tabindex="0"><code>ip a
ip link set INTERFACE_NAME up
ip link set INTERFACE_NAME down
</code></pre><p>to configure a basic LACP in Ubuntu 18.04 or 20.04 you can use this configuration. Just adjust it for your needs:</p>
<pre tabindex="0"><code>sudo vim /etc/netplan/01-lacp.yaml
network:
  ethernets:
    eno1:
      dhcp4: true
    switchports:
      match: eno* # for example if your interfaces are named with eno1np0 and eno2np1
  version: 2
 
  bonds:
    bond0:
      dhcp4: false
      addresses:
        - 192.168.1.3/24
      interfaces:
        - switchports
      parameters:
        mode: 802.3ad
        mii-monitor-interval: 5
        lacp-rate: slow
        min-links: 1
</code></pre><p>or if you want to setup a VLAN too here or close to production configuration:</p>
<pre tabindex="0"><code>network:
  bonds:
    bond0:
      addresses:
        192.168.1.5/24 # Server-IP
      gateway4: 192.168.1.1 # Gateway or Router IP
      interfaces: # Interfaces for LACP / Bonding
        eno1np0
	eno2np1
      nameservers:
        addresses:
	  - 192.168.1.2 # first nameserver
	  - 192.168.1.3 # second nameserver
	search:
	  - YOUR.LOCAL.DOMAIN # If you needed
	parameters:
          lacp-rate: fast
	  mode: 802.3ad
	  transmit-hash-policy: layer2
  ethernets:
    eno1np0: {}
    eno2np1: {}
  version: 2
  vlans:
    bond0.455:
      addresses:
      - 10.59.0.1/24
      id: 455
      link: bond0
      nameservers:
        addresses: []
	search: []
</code></pre><p>To apply the changes you have to enter <code>sudo netplan apply</code> but double check the configuration. In the worst case you will be disconnected from your SSH session or disconnecting the server from your network!</p>]]></content>
        </item>
        
    </channel>
</rss>
